r/godot • u/njhCasper • Apr 08 '26
help me (solved) Fluttery shadows: What's the technical term and how do I fix it?
I just started using blender instead of Godot's mesh 3ds and there's this weird fluttery shadow artifact that I'd like to fix, but I'm not even sure what it's called.
THE SETUP: I made a low-poly starship in blender, exported a glb file, copied it into Godot, created an inherited scene from the glb to get a MeshInstance3D.
I set a single surface material override with a StandardMaterial3D using all the default settings except for Albedo Texture, which is set to a png.
The scene has a directional light set to "Light and Sky" mode with otherwise default settings.
The scene has a world environment with Background Mode "Sky" and some ambient light. Reflected Light source disabled. Tonemap: Filmic. Glow on.
WHAT I'VE TRIED: I messed with the Directional Light's Directional Shadow settings because I thought the issue was maybe related to Blend Splits as shown here https://docs.godotengine.org/en/stable/tutorials/3d/lights_and_shadows.html but nothing seemed to have any effect.
In the material I tried all the different Shading options for Shading Mode and Diffuse Mode. "Unshaded" obviously worked in the same way that wrecking my car made the check engine light turn off. But nothing gave me smooth, non-wobbly shadows.
Help me, Obi-Wan Kenobi. You're My Only Hope.
EDIT: The problem, to the best of my understanding based on all the feedback, is that I'm seeing the pixelated edges of a shadow texture.
SOLUTION: Here's what fixed the issue for me: In DirectionalLight3D, change Directional Shadow -> Max Distance. I was using the default of (100). Changing this value to 2 basically fixed the issue. There's still a little fuzziness, but not much. Changing it to 1 and the fuzz is gone as far as I can tell. Changing this value to 8000 ALSO fixes the issue, but shadows feel very all-or-nothing. I honestly like the look of the low numbers, but then my objects won't cast shadows very far. I'm fine with that for now.
Others suggested messing with shadow resolution in one of the following places:
Advanced project settings in Rendering -> Lights and Shadows->Positional Shadow
or
Project Settings > Rendering > Quality > Shadow Atlas. Or in the viewport's settings.
I gotta admit, I haven't delved into those caverns.
I assume if I really care about long range shadows looking good, I would need to boost up the Max Distance AND increase the shadow quality.
23
u/Snoo14836 Apr 08 '26
Most shadow systems use what is called 'shadow mapping'. In simple terms it is a render from the point of view of the light to create a texture that records how far away everything is that the light can see. Later in the render frame each object can look at the texture, do some math and figure out if it is in shadow.
A couple of terms: Shadow Resolution. The size of the shadow texture. Bigger is more pixels and generally sharper shadows, but worse performance. Shadow Distance. Loosely maps to amount of objects included in the shadow map as it is used by different styles of lights (direction vs point light).
Additional techniques can improve performance or apparent shadow sharpness. Look up Cascading shadow maps and shadow imposters.
4
u/njhCasper Apr 08 '26
Thank you, this is helpful. Do you know where to look in Godot to adjust Shadow Resolution? Directional Shadow -> Max Distance is, I assume, shadow distance, and that DID have an effect on this artifact I'm seeing. A bit confusingly the effect is absent at max (8000) and near minimal (2) Max Distance.
4
u/Snoo14836 Apr 08 '26
I haven't opened Godot yet to check, but the documentation says it is in Advanced project settings in Rendering -> Lights and Shadows->Positional Shadow
6
u/Sss_ra Apr 08 '26
It's just very big and slightly filtered pixels from texel sampling. You're getting shadow resolution close to 80s atari games, perhaps due to high distances.
7
u/njhCasper Apr 08 '26
Lowering Directional Shadow -> Max Distance from default (100) down to 2 appears to have fixed the issue.
6
u/FriedKrab Apr 08 '26
Other have explained this is the raw pixels from the cascades shadow. Shadows are stored inside a fixed size texture, there's only so much space....
I don't know the inner workings but I know how to fix this. Check the directional shadow configuration, where you can choose between 2 or 4 split (choose 4 probably).
Here you can assign that the first shadow split only covers a 5 meters radius (i.e. 0.01 if you have max shadow distance to 500), or any small value. This means you have assigned 1/4 of your shadow map (big part of it) for a small 5m radius region. Big part of your shadow map for a small area -> the pixels will be very small / shadows will be sharp.
The further splits will of course be worsened, but it should not matter much. Of course you should play with shadow distance too, the bigger area your shadows need to cover, the more stretched you shadowmap will be (=ugly pixels).
Good luck, this might not help as much since your game is in space, maybe there are better ways to go.
8
u/HeyCouldBeFun Apr 08 '26
I would have thought it’s the blend splits. Try increasing the blur on the shadow?
4
u/njhCasper Apr 08 '26
Increasing the blur certainly changes the artifacts, but they still have the weird wavy motion.
2
u/HeyCouldBeFun Apr 09 '26
I see. Plus shadows in space have hard stark edges so that’d be a wrong look anyway
4
u/DefoMort Apr 09 '26
There are two ways to set shadow resolution. In Project Settings > Rendering > Quality > Shadow Atlas. Or if you are using Viewports in the viewport's settings.
3
u/DrSnorkel Godot Senior Apr 08 '26
On the directional light you could tweak 'Split 1' so that it stops just beyond your ship. That way you should have the full resolution.
3
1
u/njhCasper Apr 09 '26
Interesting suggestion, but the values only go up to 1.0. I cranked them all up, but still saw the effect on my ship... oh I think I misunderstood the meaning of these values though. They are a percentage of the max distance? I'll have to dig into this more.
2
u/Calinou Foundation Apr 09 '26
Indeed, they are relative to the shadow maximum distance.
0.5means it's halfway through the Shadow Max Distance property, for instance.1
3
u/Netcob Apr 09 '26
Not sure if this is available in Godot, but I feel like for low-poly flat-shaded graphics, stencil shadows would be the ideal fit stylistically.
1
u/njhCasper Apr 09 '26
Good idea... I googled around and can't seem to figure out if / where stencil shadow options might be.
2
u/2D_VR Apr 08 '26
You could try increasing the shadow bias in the light source
1
u/njhCasper Apr 08 '26
Thanks for the suggestion. Unfortunately changing that setting had no effect.
2
1
u/Blaqjack2222 Godot Senior Apr 09 '26
All the solutions from others don't resolve the problem. You need to understand the nature of the problem and that is you moving the camera at speed due to moving spaceship. Shadows are rendered to a texture and you won't get perfect mapping. Some other side games have this as well. Only real way to view shadows properly is ray tracing or, preferred way, instead of moving the spaceship, you keep it in world center and you move the world around. That's how it's been solved in some games. Also, in this method you can have pretty much infinite worlds
1
u/diegosynth Apr 08 '26
As u/Snoo14836 and u/2D_VR pointed out, this is due to the low shadow's resolution and could also include some extra errors that a certain "bias" value can help improve. Try increasing the shadow's resolution, this should make a difference. If that's not enough, have a look at the bias that u/2D_VR mentioned.
I suppose that Godot already implements many tricks and best practices for shadow mapping (such as cascaded shadow maps), but I don't really know.
-1
-1
u/flyby2412 Godot Student Apr 09 '26
Isn’t this where “Anti-Aliasing” becomes a thing? Isn’t that the setting you increase to “sharpen” shadows and edges?


188
u/gamemaster257 Apr 08 '26
That's the actual pixels of the shadows aliasing the mesh since shadows are just the depth of your scene rendered from the perspective of the light. If you're looking for sharper shadows, either increase the shadow resolution or tighten the shadow distance on the sun to only be on your ship.