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.

Leave a Reply

Your email address will not be published. Required fields are marked *