Home Artists Posts Import Register

Content

Today was all about shadows - flickering, camera positioning, acne, blending and all sorts of other strange shadow issues that have been plaguing me for years. Today I decided to tackle them one at a time, understand what was going wrong and fix it properly.

The majority of these issues came from a rendering approach called Cascaded Shadow Maps. This is where the game renders the scene from the sun's point of view 4 times, each time zooming in closer to the player.

This lets us render shadows over a large amount of terrain, while also having highly detailed shadows close up.

To visualise these four shadow maps - called 'cascades' - I've given each a different colour:

The issue I faced here was the dark lines between each cascade. If I turn the cascade visualisation off, the dark lines are clearer to see:

These lines were caused by an error in the shader code responsible for choosing the right cascade to sample from, as well as the matrix maths that positions the camera when rendering each cascade.

I also fixed a bug in the code that blends between cascades, meaning we can now smooth out the sudden difference in quality from one cascade to the next.

I no longer see strange lines when moving the camera around, nor the strange artifacts at the edge of the screen in previous videos when looking at large scale terrain.

This might all be technical jargon to you, so I recommend checking out the screenshots and video here. The main differences are:

  • Less flickering
  • No artifacts at the edge of the screen
  • High quality close-up shadows on the fern leaves



Files

Comments

No comments found for this post.