Happy New Year everybody!
Late at night, when everybody is sleeping – Reto.Hal9k climbs into his programming hideout and with only a single candle lit, he writes new render features that hopefully makes their way into the game one day. This time he has been working on weather effects – and in this case: SNOW! – Reto.Robotron3000
This is the second iteration of the snow system. Making a snow cover is simple in a deferred engine, but I’ve been thinking a long time about how to implement it so that it has a small as possible performance impact. I initially had ideas about laying down the g-buffer and then do another pass to mask out snow, but I disliked the solution because of the increased (2x g-buffer fill). I finally came to the solution described below.
It consists of two parts: The snow cover on the terrain and objects, and the snow flakes falling down.
- The snow cover is integrated into the g-buffer layout part of the material shaders. It works by fading albedo, specular and normals towards the snow cover colors based on the dot product of up vector and the normal vector. It also uses a topdown runtime generated shadow map to avoid snow inside buildings, etc.
- The snow flakes are done by a simple particle shader, using a time based offsetting of the initial position to avoid updating the vertex buffer.
The system can be turned on and off runtime so it integrates nicely with our current weather system.
From here its quite simple also to add rain..
We still need to work on masking out dynamic and user defined objects, masking out snow particles using the same shadow map as the snow cover, creating tracks after vehicles, creating special impacts and explosions and adjusting the soundscape and so on, so it will still take a while before it gets into the game.