Dynamic wetness







 Render Target practice - dynamic wetness

 The dynamic wetness was done in UE4 basically by
  • Gathering all intersecting meshes that allows for dynamic wetness (a switch case inside the materials)
had to expose it to blueprints

  •  then for each instance create render targets and MIDs


  •  then at startup, using a material, unwrap object to match lightmap UV layout and bake out objects positions.
added atlasing support but didn't end up using it this time

  • for each tick, update water surfaces position into a render target.
    • This was done by having a secondary object positioned outside of the screen that does the exact same world displacement as the water surface due to a few reasons such as:
      • Switching the material for capture wasn't possible due to visual issues.
      • Setting the secondary object to not be rendering in main pass made it also not visible in the scene render capture that I used to capture the position of the water surface.



capturing of the water surface
the material used for capturing the position of the water surface

  • Using the water surface position map and meshes position map I could calculate what part of the mesh if any was below the water surface. Which was done using a material rendered into a render target for each instance.

  • Once that was done all I had to do was to sample the generated wetness map in each material and apply the wetness (to avoid adding too many instructions I kept this part simple) 




And that's it.
Almost...

I Also made an underwater effect but since it's not complete yet I wont bother going through how it was done so I'll just leave it here for viewing purposes.



Comments

Popular Posts