Geometry Creator

Unity fills a Sprite Shape with as few triangles as it can get away with. That is perfectly reasonable for a static shape, but it leaves the Liquid Shader with almost no vertices to displace, and the waves and ripples with almost nothing to act on.

LiquidSpriteShapeGeometryCreator.cs solves this. It is a SpriteShapeGeometryCreator – a ScriptableObject that the Sprite Shape Controller uses in place of Unity's built-in geometry generator. It fills the spline with an evenly tessellated grid of triangles and generates matching UVs, while keeping the collider working as usual. It also writes an edge mask into the red channel of the vertex colors, which the shader uses to fade out the emission towards the outline of the shape.

The Geometry Creators folder contains three ready-made assets. To use one, drag it onto the Creator field of your Sprite Shape Controller.

To create your own, use Assets > Create > Project GAMEDEV > Essential 2D Shaders > Liquid Sprite Shape Geometry Creator.

A Geometry Creator asset is shared by every Sprite Shape that references it, so changing its settings updates all of them at once. To give one liquid a denser mesh than another, give it its own Geometry Creator asset.

Mesh Detail

The density of the generated mesh (1 to 128), i.e., both the number of vertex columns per local unit and the number of quad rows. This is the most important setting of the asset: higher values produce smoother, more detailed vertex displacement, at the cost of a heavier mesh. Values around 12 to 32 are plenty for a calm liquid; violent lava benefits from far more. Sprite Shape meshes use 16-bit index buffers, which caps them at 65,535 vertices and indices. Rather than fail, the Geometry Creator stays within that limit by reducing the effective detail of very large shapes. If a huge shape looks coarser than a small one at the same Mesh Detail, this is why – split it into several smaller Sprite Shapes instead.

Open Ended Width

The total width of the generated strip when the Sprite Shape spline is open-ended rather than closed. The spline stays centered within the strip. Closed shapes are simply filled and ignore this setting.

Stretch UVs To Bounds

Generates the UVs from the bounds of the generated mesh instead of tiling them from the local position. Enable this to stretch a single copy of the liquid texture across the whole shape; leave it disabled to tile the texture at a consistent scale, regardless of the size of the shape.

Edge Mask Width

The distance from the outline of the Sprite Shape over which the edge mask fades out. The mask is stored in the red channel of the vertex colors, and the shader uses it to darken the emission near the outline. A wide value produces a broad, cooled rim, while a very small value effectively disables the rim.

Edge Mask Softness

The softness of the edge mask falloff (0 to 1). At 0, the mask ends abruptly with a hard border; at 1, it fades smoothly across the full edge mask width.

Included Assets Mesh Detail Open Ended Width Stretch UVs To Bounds Edge Mask Width Edge Mask Softness