Godot Version
4.2
Question
Hello! Newbie here. I want to create a reflex sight with gdshader. So I tried this:
shader_type spatial;
uniform sampler2D tex;
uniform float scale = 0.5;
void fragment(){
vec2 uv = vec2(dot(VIEW, TANGENT), dot(VIEW, BINORMAL));
uv /= scale;
uv += 0.5;
ALBEDO = texture(tex, uv).rgb;
ALPHA = (0.0 <= uv.x && uv.x <= 1.0 && 0.0 <= uv.y && uv.y <= 1.0) ? 1.0 : 0.0;
}
However, there are some issues. Firstly, distortion occurs when the scale is too high. Secondly, I am unable to adjust the depth distance. How can I resolve these? Thanks in advance.