Partial Controlable Wetness

Hello.
I am trying to make a wetness effect on a mesh. The hard part is it has to be wet exactly where I want it to be wet. By “wet” I mean apply a color modifier on a texture and probably take roughness to 0. The wetness should be controlled through a variable, which I’d change in C++.
Imagine we have a shirt. So I’d like to have a variable that would control the wet part in percents that would go from bottom to top. Can’t do it with decals, although it would be awesome if I could, but unfortunately, decals don’t have an object filter that could say on which object to apply the decal and which to skip.

What you searching for is dynamic material instances and setting parameters. You can make parameters in material shader which values can be controlled by code, so you can dynamically alter how your material behaves. So you could do some wetness map or routhness map on your materials and using parameter you can change insensitivity how it effects the material roughness (by multiplying parameter with that wetness map?)

Here tutorial:

https://docs.unrealengine.com/latest/INT/Videos/PLZlv_N0_O1gbQjgY0nDwZNYe_N8IcYWS-/srUSDU1u0og/
https://docs.unrealengine.com/latest/INT/Videos/PLZlv_N0_O1gbQjgY0nDwZNYe_N8IcYWS-/i2XmTbfIJ3s/index.html

There no exeample on C++ in offical docs but it’s the same, you just call this to create and set instance in mesh component:

And then from what that function return you can set parameters (sadly there UDynamicMaterialInstance page is empty, but auto complete should help you out to find those functions, they always start with word “Set”

Thank you! Especially for the fast reply! :slight_smile: