Realistic shadows and other stuff
Sun 31 Dec 2017
Author: Sam Pickett
After careful thought and discussion, we've made a big change to First Light. We decided to implement shadow mapping to replace the block lighting system. I won't bother explaining what shadow mapping is. There are lots of articles on the subject. Some reasons for the change are:
- More realistic- The block based lighting was nice, but not realistic and not dynamic.
- Consistent frame rate- Although adding fancier shadows and effects can reduce the frame rate, the chunk lighting is no longer being computed, which makes chunk generation MUCH faster. The frame rate is a bit more consistent while moving now, as there is not a huge hit from chunk generation.
- Universal lighting- The block based lighting system could be used to light models, based on the light at their world position. Shadow mapping can be applied to the entire scene in exactly the same way, removing the need for specialised lighting set-ups for models.
We have implemented the shadows as a post-effect. We've also set up the rendering loop to draw directional lighting and the outline effect as post-effects as well. The new set-up allows for other shader effects to be added in easily. One effect that will be added is SSAO (screen space ambient occlusion). The block lighting system provided fake ambient occlusion, but without this an alternative is required. Other recent changes:
- Models- We have a .obj file parser to import models, and a system for animating them.
- Weather- The weather changes now. The clouds clear and thicken over time. When the clouds are thick, it rains, and the sky darkens.
As usual, some screenshots, including some... interesting ones...
We updated from using GL_QUADS to GL_TRIANGLES. Some stuff happened...