Godot Version
v4.2.2
Question
I added a FogVolume to my scene, and added a Shader to it. In the scene Editor the preview is good, nothing out of the ordinary.
When playing the scene and I move the character, the fog seems to cut/disappear around the edges if I turn left or right and cut in the middle if I move the Camera up or down.
I appreciate your help
This is the shader code
shader_type fog;
uniform sampler2D noise_texture: repeat_enable;
uniform float noise_scale = 1.0;
uniform float flatness = 1.0;
uniform float density = 1.0;
uniform sampler2D gradient_texture;
void fog() {
vec2 move_uv = vec2(0.2, 0.0) * TIME;
float detail_noise = texture(noise_texture, WORLD_POSITION.xz * noise_scale + move_uv * 0.5).r;
detail_noise *= 0.2;
float noise = texture(noise_texture, WORLD_POSITION.xz * noise_scale + move_uv + detail_noise).r;
DENSITY = mix(1.0, noise, UVW.y * flatness);
DENSITY *= step(0.0, -SDF) * density;
vec3 color= texture(gradient_texture, vec2(DENSITY, 0.5)).rgb;
ALBEDO = vec3(color);
}
This is a screenshot of how it gets: (the entire floor should be covered with Fog)