Skip to main content

LiquidVisualData

A class in Root.Township, Alta.Liquid.

Asset with the look of a liquid (colours, rim, fresnel, highlight, waves) that liquid surfaces apply as material properties. Client visuals only.

Constructors​

MemberWhat it is
LiquidVisualData()Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets.

Fields​

MemberWhat it is
const int MaxThicknessConstant 100, the top of the Thickness range.
24 private and internal fields
MemberWhat it is
private Color androidLiquidColorLiquid colour used on Android.
private float depthBacking field for Depth, the shader's liquid depth value.
private Color fresnelColorBacking field for FresnelColor, the edge glow colour.
private float fresnelExponentBacking field for FresnelExponent, how tight the edge glow is.
private float glossinessBacking field for Glossiness.
private Color liquidColorBacking field for LiquidColor, the main liquid colour.
private Color liquidDepthColorBacking field for LiquidDepthColor, the colour deeper in the liquid.
private float refractionAmountBacking field for RefractionAmount.
private Color rimColorBacking field for RimColor, the colour of the rim where the liquid meets the container.
private float rimFalloffBacking field for RimFalloff.
private float rimSizeBacking field for RimSize.
private float rimTilingBacking field for RimTiling.
private Dictionary<Material, Material> sharedMaterialsMaterials made from these settings, one per template material, reused by GetSharedMaterial.
private float surfaceHighlightBacking field for SurfaceHighlight.
private Color surfaceHighlightColorBacking field for SurfaceHighlightColor.
private float surfaceHighlightSizeBacking field for SurfaceHighlightSize.
private float surfaceHighlightTilingBacking field for SurfaceHighlightTiling.
private int thicknessBacking field for Thickness (1 by default, up to MaxThickness of 100).
private float tilingBacking field for Tiling.
private float transparencyBacking field for Transparency.
private float waveSpeedBacking field for WaveSpeed, the surface wave speed at rest.
private AnimationCurve waveSpeedByTemperatureBacking field for WaveSpeedByTemperature, the curve used for boiling.
private float waveStrengthBacking field for WaveStrength, the surface wave strength at rest.
private AnimationCurve waveStrengthByTemperatureBacking field for WaveStrengthByTemperature, the curve used for boiling.

Properties​

MemberWhat it is
float Depth { get; }Shader depth value for the liquid.
Color FresnelColor { get; }Colour of the fresnel edge glow.
float FresnelExponent { get; }Sharpness of the fresnel effect.
float Glossiness { get; }Surface glossiness.
Color LiquidColor { get; }Main colour of the liquid.
Color LiquidDepthColor { get; }Colour used deeper in the liquid.
float RefractionAmount { get; }How much the liquid distorts what is behind it.
Color RimColor { get; }Colour of the rim where the liquid meets the container.
float RimFalloff { get; }How quickly the rim colour fades.
float RimSize { get; }Width of the rim.
float RimTiling { get; }Texture tiling of the rim.
float SurfaceHighlight { get; }Strength of the surface highlight.
Color SurfaceHighlightColor { get; }Colour of the surface highlight.
float SurfaceHighlightSize { get; }Size of the surface highlight.
float SurfaceHighlightTiling { get; }Texture tiling of the surface highlight.
int Thickness { get; }How thick the liquid is, passed to the liquid gravity effect when pouring and sloshing (default 1).
float Tiling { get; }Main texture tiling.
float Transparency { get; }How see-through the liquid is.
float WaveSpeed { get; }Speed of surface waves.
AnimationCurve WaveSpeedByTemperature { get; }Wave speed by temperature, for boiling.
float WaveStrength { get; }Height of surface waves.
AnimationCurve WaveStrengthByTemperature { get; }Wave strength by temperature, for boiling.

Methods​

MemberWhat it is
Material GetSharedMaterial(Material materialTemplate, Func<LiquidVisualData, Material, Material> createNewMaterialFromSettings)Returns one shared material per template for this liquid, creating it on first use with the given function. Logs an error on clients if the template is null.

Used in​

Members of other types that take, return or hold a LiquidVisualData: