Cem Tezcan gave a detailed breakdown of his amazing moisture/rain material he created with the help of Substance Designer.
Raindrops in Substance Designer
Actually, I love the realism that fluid effects add to our visuals. Fluids are also one of the most challenging subjects on real-time technology because you can’t add simulations to your workflow considering the limited computing power.
I started to create this material a year ago. Instead of getting rain material, my purpose in those days was to achieve some moistened glass material with few drops. I was going to use that for a composition of fresh water on glass bottles. I created just a roughness map and a normal map.
These maps were just tiling of random combinations of 4 different drops that I created procedurally. I made the drops blend with the surface it is attached on, to get a more realistic look.
Project link
This material has the parameters to tweak moist density and randomization options.
Substance material tweak video:
Put aside the Substance Designer’s general material design capability, it also has an amazing procedural way to create very realistic and accurate “geometries” by designing just height maps and normal maps. Drops that I created on Substance Designer look very realistic to me from the start. For the advantage that they are customizable, randomizable and more importantly “tileable”.
Substance material shape movement video:
This kind of textures is not possible to create by image conversion. Real world drops have either translucency or reflectivity. This means it is not possible to get any proper depth information by the photo references. Because of the inability to capture a tileable water drop normal map from the real world, these should be created artificially. Finally, few weeks before, I decided to make that drops animated on a real-time rainy scene with Unreal Engine.
Import
At first glance, I exported randomized 4 different tiles of drop normal and roughness maps, and 4 different grayscale flow maps in 1k resolution from Substance Designer. Then I mixed, blended and panned these sets with different speeds and UV tilings. Substance Designer gave me the perfect tileable sets, and by panning those sets, I created endlessly and differently looping rain flows.
After creating and adding parameters to this material, I worked on the blueprint to decrease the 4 sets of textures to 1 piece of 1k normal map and 1k grayscale flow alpha by re-using them with different rotations and mirroring to consume less system source. Finally, I got the same result with 2 pieces of 1k textures!
After all the blending and panning in a material function blueprint, I used that result on a translucent material that I created with another blueprint.
Maps
Unreal Engine’s material blueprint system is different than the general blueprint system in the engine. It has no flow control like events, branches and loops. It is very hard to get time-based randomization within material blueprint. As I know that panner is a time-based UV changer, I created 2 pieces of 128 x 128 B&W maps to pan them differently to get random intersections between them.
This workaround created a random flashing mask for random raindrops on the surface.
By this randomization system and differently panned normal maps, I blended those to get ultimate disordered flows.
Animation
Just simple panning, randomizing and blending took the job. I added some multipliers to control the rain effect on the glass like layered flow speeds, static drop densities, general movement, tiling and so on.
You can stop the flow and make the drops just randomly appear when you need to use the material on a horizontal plane by parameters.
Material adjustments video:
The whole system can be blended with every object which has textures and normal maps already on it. Just don’t forget to lower the roughness values for a wet look.
Adding material to an existing object:
The magnifying glass effect is created by the engine but it is looking good even in close up renders because the curvature and the shape of normal map properly generated in Substance Designer at first place.
Close up animation:
Optimization
This version is easily rendered on my Nvidia GTX 1070 in 4k resolution with >90 fps on the rainy cafeteria scene. I’m currently working on a light version of the material.
There are 500 instructions on the material right now, but I didn’t optimize any nodes yet. Because I just focused only on quality and realism. Textures can be reduced to 512 x 512 resolution, It will be enough because I tile them 4 to 8 times on 1-meter glass. There is no need to 1k resolution. I will cancel some roughness iterations. I suppose, it can be reduced to 200-300 iterations and can be used on games by canceling additional more layer blendings by leaving some different flow styles.
Real-time capture video with FPS counter on my machine with Nvidia GTX 1070.