To make a MotoGP track look wet, our first task was to desaturate the colors, reduce the contrast, and soften the shadows.
Remember how we abused the fog settings to implement fake HDR? We reused the same idea here:
- Create a separate rainy sky texture for each track
- Adjust the fog color to match the sky
- Set the fog start distance to a negative value
- Optionally also decrease the fog end distance
Voila! Contrast is reduced, and colors desaturated, globally across the entire scene. The artists were able to create considerable variety by varying the settings from one track to another. Some tracks were wet but had clear visibility, while others were misty. Some were dark and foreboding, some white and foggy, some grey, or with a bluish tint.
Softening the shadows took a little more work. We entirely disabled the realtime bike and rider shadows, to free up processing power for other rainy day effects. But the track lighting was precalculated, using per-vertex colors plus the occasional overlay texture for objects such as bridges that cast distinctively shaped shadows onto the ground below them.
The artists created special rainy day vertex colors in our level editing tool, by decreasing the brightness of the diffuse light while increasing the ambient, then baking the result into a second vertex color channel.
I used the MotoGP equivalent of a custom content processor to automatically adjust any shadow texture layers while building the level. The artists had already set attributes to mark which textures were shadows (this was necessary to make them blend correctly in our multitexturing pixel shaders) so I could find these textures and create rainy versions by reducing their contrast to 25%. In an ideal world I would also have blurred them, but I ran into some problems when I tried a naive 2D blur, and didn't have time to come up with anything smarter. This didn't have to be perfect, just good enough that we could move on to the next task...