Quick Liquid Setup

The Liquid Shader exposes many properties, and finding a believable combination by hand takes time. QuickLiquidSetup.cs lets you skip that step: it maps five intuitive controls onto the whole set of shader properties, so a plausible liquid is only a couple of sliders away.

Attach the component to the same GameObject as your Sprite Shape Renderer via Add Component > Project GAMEDEV > Essential 2D Shaders > Quick Liquid Setup. Changes apply immediately, both in the Editor and in Play mode.

The component writes its values through a MaterialPropertyBlock, so it never modifies your material asset. Disabling or removing the component restores the material to exactly the values you set in the inspector, and two Sprite Shapes that share a material can still use different Quick Liquid Setup settings. While the Quick Liquid Setup component is enabled, it overrides the shader properties through a MaterialPropertyBlock. Setting those properties on the material has no visible effect until the component is disabled or removed. Quick Liquid Setup requires a Renderer on the same GameObject, and only one instance of the component is allowed per GameObject. If nothing happens after you attach it, make sure the GameObject has a Sprite Shape Renderer (or another Renderer) with a Liquid Shader material assigned.

Movement Speed

The base speed of the whole liquid – the flow, the waves, the ripples, and the patches. Each layer applies its own multiplier on top of this value, so they never move in lockstep. Set it to 0 to bring the liquid to a complete standstill.

Movement Direction

The primary direction of movement, in degrees (0 to 360). 0 moves along the +X axis; 90 moves along the +Y axis. The waves and patches are automatically offset by a few degrees from this direction, which keeps the surface from looking mechanical.

Viscosity

How thick the liquid is (0 to 1). Thin liquids such as water move quickly, with fine, lively surface detail. Thick liquids such as lava, honey, or tar crawl along, with a heavier, slower surface response and more pronounced surface relief.

Volatility

How energetic the surface is (0 to 1). Low values produce an almost still surface; high values produce tall waves, strong ripples, and pronounced vertex displacement.

Patch Preset

The behavior of the patches floating on the liquid, chosen from seven presets: None, Subtle, Sparse, Balanced, Dense, Crust, and Slick. None disables the patches entirely, Crust covers the surface in large, hard-edged plates of cooled crust, and Slick produces a thin, oily film. The patch color is not part of the preset – set it on the material with the Patch Color property.

All five settings are also available from code. Assigning any of them re-applies the setup immediately, which makes it easy to, for example, have lava thicken and slow down as it cools. The component lives in the ProjectGamedev.Shaders.Essential2DShaders.LiquidShader namespace.

With quickLiquidSetup being the Quick Liquid Setup component of your liquid, change the settings like so:
quickLiquidSetup.MovementSpeed = 0.5f;
quickLiquidSetup.MovementDirection = 90f;
quickLiquidSetup.Viscosity = 0.9f;
quickLiquidSetup.Volatility = 0.25f;
quickLiquidSetup.Patches = QuickLiquidSetup.PatchPreset.Crust;

public float MovementSpeed

See Movement Speed. Negative values are clamped to 0.

public float MovementDirection

See Movement Direction. Values are clamped between 0 and 360.

public float Viscosity

See Viscosity. Values are clamped between 0 and 1.

public float Volatility

See Volatility. Values are clamped between 0 and 1.

public QuickLiquidSetup.PatchPreset Patches

public void Apply()

Re-applies the setup to the Renderer on the same GameObject. The property setters above already call this method, so you only need it on demand. The Apply Quick Liquid Setup entry in the component's context menu does the same.

Movement Speed Movement Direction Viscosity Volatility Patch Preset Scripting