Along the Rain system task, I was also tasked with making the world wet all by myself. After all, I make the rain fall on things, so I have to make stuff get wet from that rain, right? So, alongside the rain, it is one of my biggest works for Alan Wake 2.
The system is what I call a "GBuffer filter" - I process the GBuffer data using compute shaders to apply "wetness" to it. Some highlight features of this system:
- The system modifies normals, roughness, metalness of pixels before they are lit. It works essentially like a post processing pass... just done on Gbuffer instead of on final image!
- The droplets are animated without a flipbook, using a bunch of data packed in Alpha channel of the texture, making a single 512x512 texture serve all the wetness droplets in the game.
- It uses the same World Height buffer system that the Rain system is using, with some additional work to make sure that transitions between dry and wet spaces are smooth and natural.
- A big part of the system is a heap equations applying wetness differently to different things based on wetness level and porosity of objects. Stuff like sand will get dark and damp, smooth surfaces like metal will have droplets from on them.
- The system supports full transition from dry to wet and back in a natural manner.
Huge thanks to the Rendering team and Daniel Forsberg for the hard work on tooling that enabled me to shoot compute shaders at the screen - the wetness would not be possible without it.
Also thanks to Johannes Richter for making the droplets in Houdini so I could use them further!
Wetness system applies animated droplets and PBR modifications to all objects exposed to rain
Wetness is also applied to characters in a similar way. Character wetness is tracked per-character to ensure they can independently go wet/dry when going under a roof and out.