shader_type canvas_item; uniform vec2 center = vec2(0.5, 0.5); uniform float radius : hint_range(0.0, 1.0) = 0.3; uniform float softness : hint_range(0.0, 1.0) = 0.1; // Use 'repeat_enable' to ensure the noise tiles seamlessly uniform sampler2D noise_texture : repeat_enable, filter_nearest; uniform float noise_strength : hint_range(0.0, 1.0) = 0.1; uniform float noise_scale = 4.0; // New: Controls how "dense" the fog clouds are void fragment() { vec2 uv = UV; // 1. Scale the UVs for the noise lookup. // Higher scale = more frequent/smaller clouds. vec2 noise_uv = (uv * noise_scale) + vec2(TIME * 0.05); // 2. Center the noise! // Texture returns 0.0 to 1.0. Subtracting 0.5 makes it -0.5 to 0.5. // This allows the fog to distort BOTH inward and outward. float noise = texture(noise_texture, noise_uv).r - 0.5; float dist = distance(uv, center); // 3. Apply the centered noise to the threshold float fog_threshold = radius + (noise * noise_strength); // 4. Smoothstep for the alpha transition float alpha = smoothstep(fog_threshold - softness, fog_threshold, dist); COLOR.a *= alpha; }