Rain Again

The task is simple – add some kind of detail (PBR) in the rain. So this we have from the start.

rain_1

Add a special option for materials to get wet (wood, asphalt and other rough surfaces become darker when it’s raining)

rain_2

Change the ground shader, underfoot the same bare ground.

rain_3

Slate in the rain becomes wet and darker but obviously  not shine as a metal.

float4 position_with_offset = float4( view_space_position + normal * 1.3f, 1.0f );
float4 projected_position = mul( view_to_shadow, position_with_offset );
float rain_mask = saturate( read_rain_mask( projected_position ) ); // rain mask, where rain effect visible
float roughness = gb.roughness;
float fresnel = gb.fresnel;
float metalness = saturate( ( dot( fresnel, 0.33 ) * 1000 - 500 ) );
float porosity = saturate( ( roughness - 0.5) / 0.1 );
float factor = lerp( 0.1, 1, metalness * porosity );
float3 to_eye = -view_space_position;
diffuse_result *= lerp ( 0.85, ( factor * 5 ), rain_mask );

rain_4

Add some details and dof. Perhaps that’s it.

rain_5

rain_1 rain_5

 

 

 

Looks better and this is well.

In-game result with tone mapping.

Different decals depends on smoothmap

When it’s raining we need to have a different drops depends on material. To do this we can use the smoothmap to control surface, more smoother surface we have, more differen drops we will have.

PuddleSmooth1 PuddleSmoothMap

This is the result without smoothmap using. We see the same type drops everywhere.

PuddleSmooth2

Here we set the smoothmap to to determine where surface is rough and where no. Also we need to make a dual texture.

texture

PuddleSmooth3

And here is the finished result, now we can see that on the asphalt we have own drops and on the puddle own.

PuddleSmooth4

puddle2

Fatal error: Uncaught exception 'wfWAFStorageFileException' with message 'Unable to save temporary file for atomic writing.' in /home2/openyour/public_html/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/storage/file.php:29 Stack trace: #0 /home2/openyour/public_html/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/storage/file.php(567): wfWAFStorageFile::atomicFilePutContents('/home2/openyour...', 'saveConfig() #2 {main} thrown in /home2/openyour/public_html/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/storage/file.php on line 29