Table of Contents
The LiquidVolume component presents many appearance and behaviour options organized in the following sections:
- Topology: specifies the underline geometry, which must be compatible with sphere, cylinder, cube or irregular types. The potion and beer flask included in the demos uses a cylinder topology for example. However for most non-primitive types choosing Irregular will produce better results at any angle.
- Detail: simple (do not uses 3D textures and is compatible with mobile), default, default with no flask (has fewer render passes), texture bump (adds additional texturing and bump mapping options to the flask) and reflections (uses a cubemap for reflections).
- Depth Aware: enable this option to allow objects inside the liquid container.
- Parent Aware: uses parent object’s geometry as a boundary for the current liquid. Use only with irregular topology when liquid volume is inside another object and to prevent seeing through the container other liquids in the background. If you don’t see any artifact, don’t enable this option as it adds an additional render pass for the liquid containers.
- Global Alpha: allows you to control the overall transparency of liquid and smoke.
- This section controls the appearance of the liquid under the foam.
- Level: this is the fill level.
- Color1, Color2, Scale1 and Scale2: controls the appearance of the two liquid components which are blended together to produce the final pixel color.
- Emission, Emission Brightness: controls the emission color and brightness of the liquid.
- Murkiness: amount of noise.
- Alpha: global transparency for the liquid, but also for the smoke and foam.
- Dither Shadow: enable to apply a dither to the liquid shadow trying to simulate a partially transparent shadow. For best results enable soft shadows in Unity Quality Settings and also in the light setting itself.
- Turblence 1: small turbulence amount.
- Turblence 2: big turbulence amount. Mix wisely with turbulence 1 to produce a reaslistic movement. Note that turbulence also affects smoke and foam.
- Frecuency: increase to produce shorter turbulence waves when using models with scale greater than one. A default value of one is fine for most cases though.
- Sparling Intensity/Amount: let’s you add sparks to the liquid.
- Deep Obscurance: creates a gradient to darker colors at bottom.
- Light Scattering: enables backlight passing through the liquid producing a light diffusion effect. Power and Amount parameters controls the focus and intensity of this particular effect.
This section allows you to customize the foam appearance:
- Color and Scale: basic color and resolution of the foam effect.
- Thickness: relative height of the foam with respect to the flask height.
- Density: increase this value to create opaque foam.
- Weight: controls the smoothness of the foam at the bottom, near the liquid.
- Turbulence: multiplier to the turbulence factors of the liquid. Set this to zero to produce a static foam regardless of the liquid turbulence.
- Visible From Bottom: enable this option to allow the foam to be visible from bottom-up, throught the liquid (if liquid alpha is low).
This section controls the look and behaviour of smoke effect inside the flask and above the liquid/foam:
- Color and Scale: as with liquid and foam, these properties controls the basic appearance of the smoke pixels (color and resolution).
- Speed: custom speed multiplier for the smoke.
- Base Obscurance: makes the smoke darker at the bottom.
This sections controls the look of the flask (the container itself):
- Tint: color applied to the flask. For transparent containers, reduce the alpha component to zero.
- Thickness: flasks have walls, and this property controls the width of the walls.
- Glossiness: the “glossiness” or brightness of the external and internal side of the flask walls.
- Refraction Blur: when enabled, the visible background is blurred to simulate light refraction.
When “Detail” is set to “Texture Bump” additional options appear in this section:
- Texture: allows you to wrap a texture around the flask. This feature supports transparency.
- Bump Map: assign a normal map texture to create a relief effect.
- Distortion Map: assign a texture (like normal map) which will be used to compute additional image distortion.
This section controls the response to quick changes in position or accelerations:
- React to Forces: when enabled, the turbulence of the liquid will react to external forces or accelerations. The sphere topology allows rotation of liquid inside the container as well as change in turbulence. Cylinder and Cube topologies will only alter the turbulence.
- Mass: defines the “mass” of the liquid. A higher value will increase the weight of the liquid thus it will move less.
- Angular Damp: defines the internal friction of the liquid. A higher value will make the liquid return to calm state faster.
- Ignore Gravity: enable this option to force liquid to rotate with the flask. Note that “React To Forces” option disables this.
This sections controls “rare” parameters that you usually won’t need to use but are useful as well:
- Smoke/Liquid/Foam Ray Steps: the shaders uses a ray-marching approach to compute the pixel color. These settings specify the number of samples taken per each ray traced. The more samples, more dense and quality will be the liquid, but also slower.
- Noise Variation: the asset includes three precomputed 3D noise textures. Move this slider to switch between them. Experiment with the different possibilities to get the best result.
- Upper Limit: when using models that are not symmetrical (like a bottle which has a cork which you want to top the liquid effect) you can use this property to limit the height to which the liquid can reach.
- Extents Scale: optional multiplier to the real model extents (size). You can use this property to reduce the area of the geometry used by the liquid volume.
- Allow View From Inside: if enabled, the asset will detect if the camera enters the liquid container and will render appropiately. Note that this is an experimental option and some other properties are not supported when the camera is inside the container, like turbulence.
- Fix Mesh: this option centers the pivot of the mesh at runtime. It does not modify the original mesh so it can be more convenient than “Center Pivot” option (see below) which produces a permanent change in the model mesh. Adjusting mesh pivot is necessary on certain models so Liquid Volume can compute liquid level properly (meshes that are designed with pivot at bottom, like glasses or flasks usually require this option).
- Bake Current Transform: many times when you import a model from a third party application, either rotation or scale won’t match Unity standards. You usually compensate this applying some transform but the problem is the mesh itself is incorrectly oriented, so some calculations done by Liquid Volume shader will not work. To fix this, you can bake the transform of the gameobject to the mesh itself using this option. After executing this operation, gameobject’s rotation will be reset and scale will be set to 1.
- Center Pivot: similar to the previous issue, some times you may want to correct or move the pivot point of the mesh to the center. This operation does just that, effectively centering the mesh around a common center.
- Render Queue: by default, Liquid Volume renders at Transparent+1 in the render queue (which is 3000 + 1). You can change it to 3000 so it renders as a normal gameobject or use any other value if needed. Changing this value has the same effect that editing the shader and changing the RenderQueue tag.
- Double Sided Bias: when using Irregular topology and open flasks, you may want to use this parameter to ensure only the far and face viewing triangles are being rendered. Problem with open flasks is that their boundaries has two sides so usually there’s some overdraw. Using this parameter ensures the only one part of the geometry is being rendered. Try different values until you get the result you need.
- Rotation Level Bias. Liquid might seem to disappear under certain rotations. This effect is more visible when the level of liquid is low and the flask is not 100% straight. If you see liquid disappear when rotating the flask, try increasing this value (probably until 1.0).
You can disable some shader features completely to make the execution a bit faster or increase compatibility on older devices. Disabling these settings on modern devices or PC won’t improve performance. Only disable Floating Point buffers if Liquid Volume does not render correctly.
- Light Scattering: disables shader code related to diffusion of directional light through the liquid.
- Smoke: disables ray-marching code through the liquid container to generate smoke (so only liquid/foam is rendered). This is similar to unchecking the “Visible” option of Smoke section but disabling smoke will still compile the shader variants that include the smoke rendering.
- Floating Point Buffers: disable only if Liquid Volume does not render correctly on older devices that do not support floating point render textures. Disabling this option will make the shaders fallback to use low precision buffers which will render with less precision.