Draw 3d brush cursor procedurally

This commit is contained in:
luboslenco
2025-01-17 13:53:44 +01:00
parent 042bc34651
commit ce1a0f016d
7 changed files with 8 additions and 21 deletions
+6 -6
View File
@@ -1,15 +1,15 @@
#version 450
uniform vec3 tint;
#ifdef SPIRV
uniform sampler2D gbufferD; // vulkan unit align
#endif
uniform sampler2D tex;
in vec2 tex_coord;
out vec4 frag_color;
void main() {
vec4 col = texture(tex, tex_coord);
frag_color = vec4((col.rgb / col.a) * tint, col.a);
float radius = 0.45;
float thickness = 0.03;
float dist = distance(tex_coord, vec2(0.5, 0.5));
float ring = smoothstep(radius - thickness, radius, dist) -
smoothstep(radius, radius + thickness, dist);
frag_color = vec4(tint, min(ring, 0.6));
}
+1 -6
View File
@@ -7,10 +7,6 @@ uniform vec2 tex_step;
uniform float radius;
uniform vec3 camera_right;
uniform sampler2D gbufferD;
#ifdef HLSL
// direct3d12 unit align
uniform sampler2D texa;
#endif
#ifdef HLSL
in vec4 pos;
@@ -21,8 +17,7 @@ out vec2 tex_coord;
vec3 get_pos(vec2 uv) {
#ifdef HLSL
float keep = textureLod(texa, vec2(0.0, 0.0), 0.0).r; // direct3d12 unit align
float keep2 = pos.x + nor.x;
float keep = pos.x + nor.x;
#endif
#ifdef GLSL