Godot Version
4.2.2 stable
Question
I have a post processing quad with a shader that detects edges of meshes. However, I wanted edges to be darker or lighter than the surrounding mesh surface based on lighting.
This is the shadercode.
void light(){
DIFFUSE_LIGHT = vec3(1.0);
SPECULAR_LIGHT = vec3(0.0);
if (LIGHT_IS_DIRECTIONAL == false){
if (is_edge == true) {
DIFFUSE_LIGHT += dot(normalize(NORMAL), normalize(LIGHT)) * LIGHT_COLOR;
}
}
}
is_edge is determined by fragment shader and passed by varying. The problem is that this omni light I have is causing a pixelated bubble around it where the effect takes place.
As you can see, the green cube is illuminated ( sort of) correctly, however, this white slab on the right is also illuminated because it is overlapping the range of the light.
It’s difficult to show without a video, but there’s a pixel bubble filling the range of this light which causes any edges within it to be illuminated. These pixels are massive and do not scale with distance, however there will be less pixels occupying the range of the light the farther the camera moves away.
I haven’t found anybody talk about this and I’ve run into this problem a few times when trying other shader stuff, but this is starting to annoy me. Any help is appreciated.