Sand rippling over rocks - material blending based on height
Procedural boat rusting
This past week I've improved my technique for the boat's shader-based rusting and deterioration sequence. My initial approach was to hand paint mask keyframes that designated where the rust formed, and blend between them. This worked out fine, and accomplished what I needed it to for the most part. If you notice in my previous work in progress videos of the boat rusting, most things are working, but when the boat starts to deteriorate away, the transition gets a bit choppy and it disappears in pretty large chunks. This is my own error, due to me jumping too much between these keyframes -- kind of like a choppy animation with not enough in-betweens. I was going to go in and repaint some of these keyframes again, when I realized this was about the fourth time I've repainted these keyframes and it can be a pretty painstaking process. I finally decided to pursue a procedural method that involved blending different masks in the material.
Essentially, the entire transition is controlled by a linear gradient mask from black to white, projected onto the boat. The boat starts out masked by black, and the gradient is moved down until the boat is white. So the transition variable that controls the progression of the sequence is controlling the downward offset of the projected linear gradient in world space. The reason that the main mask is a linear gradient sliding down is because I do want this deterioration to generally happen from top to bottom. I feel like downward is a believable pattern for rusting, and deteriorating from top to bottom makes for a nice reveal of the skeleton underneath. Lastly, it helps to make sure that when parts of the boat start deteriorating away, there aren't any "floating" and unsupported pieces left in the air.
The linear gradient mask is just the base, though. This mask needs to be broken up for a little bit more serendipity in the rusting pattern. To do this, I warp the projected UVs of the linear gradient by multiplying them by a general perlin noise pattern - just to get some broad wavy variation instead of a straight horizontal line moving downwards. Warping this enough can allow for rust to emerge in areas lower down on the boat but still follow an overall trend of top to bottom rusting. The rust drips use the same warped noise as the areas where the rust flakes appear, but the noise is offset downwards a bit more, to give the directional appearance of rust dripping.
Getting into even more specific, small scale variation to break up this warped linear gradient mask, I overlay another noise into the grayscale values of the gradient. I generate a curvature map from the normal of the boat hull using Substance Designer. This highlights just the peaks of the normal map - the areas with ribbing. I use this mask to give these areas of the boat rusting priority. In real life, the most exposed features and areas that water could collect would rust first, so this adds a bit to the believability of where the rust starts to form first.