-
Notifications
You must be signed in to change notification settings - Fork 21
UE5 Dynamic Liquid Shader: Tutorial
Before using the liquid shader in Unreal Engine, there are some important points you need to consider:
- The liquid shader works with Static Mesh Actor or Static Mesh Component.
- The mesh that receives the liquid shader needs to be closed.
- Ensure that your mesh's normal direction is correct.
In Unreal:
- Download the Liquid Shader plugin from here
- Create a
Plugins
folder in your project root directory and copy/paste the plugin folder into it. - In Unreal Engine, go to
Edit -> Plugins
in the top left panel of the main editor window and enable the UTC_LiquidShader plugin. - Go to
Edit -> Project Settings
in the top left panel of the main editor window, search forSubstrate materials (Experimental)
, and enable it. - Reload the editor.
Select the Static Mesh Actor you want to add the liquid shader to. In the detail panel at the root, add the Liquid Shader Component
:
You can find a BP already set up in ../Plugins/UTC_LiquidShader/Content/BP/BP_LiquidActor
Otherwise, create your BP as usual. Add your Static Mesh
and the Liquid Shader Component
to the BP.
Go to the Class Settings
panel on the BP top bar. In the Implemented Interfaces
section of the right detail panel under the Interfaces
section, add the UTC LSInterface
.
In the left panel My Blueprint
, under the INTERFACES -> Liquid Shader
category, right-click on the Request Static Mesh Component
interface and select Implement Event
.
Drag and drop the Liquid Shader Component onto the graph and search for Set LS Static Mesh Component
with the component selected.
Connect the Request Static Mesh Component Event
execution pin to the Set LS Static Mesh Component
node and connect your Static Mesh Component
to the LS Static Mesh Component
pin.
-
Liquid Material Instance: Set your main Liquid Shader Instance here. The default instance has already been set up and can be found in
../Plugins/UTC_LiquidShader/Content/Library/MI/MI_Liquid
. (Must be the same instance set to the mesh) - Include Materials: Sometimes you may need to include materials to close the mesh, for example with the bottle, where the cork closes the mesh but it's not a liquid shader's instance. Add the cork material to this list.
- Waves Intensity: The main parameter to modify the wave sensitivity. It is recommended to keep it at 1.
- Waves Rotation Sensibility: The parameter to modify the wave sensitivity during rotation. Modify this parameter instead of the first one.
- Waves Offset Sensibility: The parameter to modify the wave sensitivity during translation. Modify this parameter instead of the first one.
- Viscosity: Modify the wave speed.
- Show Voxel: If you want to debug the voxel size. (has a high performance cost)
- Voxel Factor: Modify the voxel size.
- Adaptation Speed Scale: A higher value hides the liquid's adaptation and removes the compression effect but could create stuttering for slow rotation. This speed is relative to the wave sensitivity parameters, so remember to adjust it if you modify those.
- Generate Cap: Enable/Disable cap
- Clean Up Cap: Enable/ Disable clean-up pass for the cap
- Liquid Adaptation: Enable/Disable liquid adaptation. If your object is uniform with a centered pivot point, you can disable it (for example, a sphere).
These are the names of the different parts of the shader mask:
You can find a glass instance already set up at ../Plugins/UTC_LiquidShader/Content/Library/MI/MI_Glass.
There are classic parameters to modify the color, specularity, normal, and roughness to add details and modify the refraction. Note that the Start Refraction Offset parameter is useful to remove internal refraction (for example, in the case of a cork), but it can be affected by other objects in the scene and needs improvement.
The liquid shader instance is actually an instance of the glass shader. You can find a liquid instance already set up at ../Plugins/UTC_LiquidShader/Content/Library/MI/MI_Liquid
.
For clarity, I will not cover all the liquid parameters, but I will highlight the most important ones for me:
- Cap deformation intensity: Under the Liquid – Cap Mask category, this creates deformation on the liquid side.
- Side cap size: Under the Liquid – Cap Mask category, this controls the size of the front and back side caps.
- Liquid Offset: Under the Liquid – Position category, this controls the liquid's position relative to the object's pivot point
- Debug Bubbles: Under the Bubbles category, the bubbles' positions require runtime parameters. If you want to see an approximate representation of how they will render, set this Boolean to "true" (Don't forget to disable it before playing).
All parameters set under the "Value Set by Component" category cannot be modified.
Limitations:
- Needs GPU support (Not tested on APU).
- Display bug between Substrate and 1000 series GPUs.
- Max Render Targets size: 2048 x 2048px.
- Max object material slots: 16.
Troubleshooting:
Don't hesitate to give me feedback !