Required Setup (only in Universal Rendering Pipeline)
Check your URP settings
- Please make sure you have an URP asset assigned to Project Settings / Graphics or Project Settings / Quality (for the quality levels available). If no URP assets are assigned to Project Settings / Quality section, the URP asset assigned into the Graphics section will be used as default.
- Certain features of Liquid Volume such as refraction or irregular topology requires you to add the Liquid Volume Depth PrePass Render Feature to the URP asset. You can find a ready to use URP asset inside the demos folder.
- Ensure you have the Depth Texture option (also Opaque Texture option enabled if you use refraction effect):
If you use a different URP asset, add the Liquid Volume DepthPrePass Render Feature to the Forward Renderer:
There’re several demo scenes included. We highly recommend checking them out before using the asset in your project and to play with the different script values in those scenes. The Potion demo scene contains a Potion prefab which you may also use in your scene. The Beer scene contains a BeerFlask prefab as well.
Adding Liquid Volumes to 3D Scenes
To create a liquid volume in a 3D scene, simply attach a LiquidVolume component to any sphere, cylinder, or box game object:
For convenience you can find ready to use prefabs located in Resources/Prefabs folder which you may drag and drop to your scene.
Add Liquid Volumes to 2D Scenes (and GUI)
Liquid Volume can also be used to show indicators in your UI. Check demo scene “RPG_LifeAndMagic”.
To add a sphere indicador to your scene, locate the CameraLife or CameraMagic prefabs in LiquidVolume/Resources/Prefabs and drop it into your scene. It will create a sphere flask with a custom camera that will render the image to the render texture s LifeRT or MagicRT, located in Resources/Textures.
Once you accomplish the step above, you can use the LifeRT texture in a RawImage UI component of your game interface.
The same approach can be used to create other types of indicators.