✦ Unity 6 · URP + HDRP

Gradient &
Liquid Fill
Shaders

Hand-written HLSL shader pack for Unity 6. Gradients, animated skies, liquid fill, and full UI support — across both URP and HDRP — with a polished custom inspector, zero texture dependencies, and SRP Batcher compatibility.

URP HDRP Unity 6 Mobile · half precision WebGL 2.0 SRP Batcher

01 — Getting StartedInstallation & Setup

Prismatica works out of the box. Pipeline detection runs automatically on first Editor load — no manual configuration needed.

Folder Structure

Assets/
└── Prismatica/
    ├── Shaders/
    │   ├── CoreShaderFiles/    ← GradientCore.hlsl, LiquidFillCore.hlsl
    │   ├── URP/                ← All URP shader variants
    │   └── HDRP/               ← All HDRP shaders (pipeline-guarded)
    ├── Scripts/
    │   ├── Editor/             ← GradientShaderGUI.cs, GradientShaderSetup.cs
    │   └── Runtime/            ← GradientSkySettings.cs, GradientSkyRenderer.cs
    └── Demo/                   ← 7 demo scenes

Pipeline Detection

Automatic on Editor open

Runs silently on the first domain reload. Logs only when something actually changes.

Manual trigger

Go to Tools → Prismatica → Detect Pipeline to force a re-run at any time.

After moving files

A move watcher re-runs the include path fixer automatically — shaders stay green anywhere.

HDRP projects: Detection adds PRISMATICA_HDRP_AVAILABLE automatically. In URP-only projects, HDRP shaders compile to magenta — never an error.

Demo Scenes

SceneDemonstrates
Scene 1 — Animated SkyLinear gradient, 3-stop mid colour, day/sunset animation, horizon offset
Scene 2 — 3D Object ShowcaseSphere (Linear), Cube (Radial), Cylinder (Angular), Capsule (Diamond) + LiquidFill
Scene 3 — 2D Liquid SpritesSprite Renderer LiquidFill with staggered animations
Scene 4 — Layers5 layered quads, staggered Z depths + FlowOffsets
Scene 5 — Distortion ComparisonDistortion=0 vs Distortion=0.55 side by side
Scene 6 — UI ShowcaseCooldown ring, slider, liquid UI image, metallic button
Scene 7 — Gradient SkySkybox gradient with TMP text, slow Y rotation

02 — ArchitectureShared Core Design

All shaders share one of two HLSL core files. A fix in the core propagates to every variant automatically.

GradientCore.hlsl

Shared by all 8 gradient variants — Mesh, UI, Skybox across URP and HDRP. All gradient math, noise, animation, sweep mask, and metallic streak.

LiquidFillCore.hlsl

Shared by all 4 LiquidFill variants — 3D and UI across URP and HDRP. Wave simulation, glass shell, rim glow, specular highlight, wave-fade clamping.

Precision System

// REAL macro — both core files
#if defined(SHADER_API_GLES3) || defined(SHADER_API_METAL) || defined(SHADER_API_WEBGL)
  #define REAL half   // mobile + WebGL → half precision, 2× ALU throughput
#else
  #define REAL float  // desktop → full float precision
#endif

SRP Batcher Compatibility

All material properties live in a single CBUFFER_START(UnityPerMaterial) block. Textures and samplers are declared outside the CBUFFER as required. Confirm in the Frame Debugger — look for SRP Batch.

03 — Gradient ShadersGradient_URP & Gradient_HDRP

General-purpose gradient shaders for 3D meshes, 2D sprites, UI Raw Images, and quads.

Gradient_URP

Two passes: UniversalForward (3D, UI, quads) + Universal2D (Sprite Renderer). Configurable Cull Mode.

Gradient_HDRP

Single ForwardOnly pass. Pipeline-guarded — magenta fallback in URP projects. All same features.

Cull Mode Guidance

SurfaceCull ModeReason
3D mesh (sphere, cube, capsule)BackStandard — hides backfaces
Quad / PlaneOffFlat — both sides visible
UI Raw ImageOffCanvas element — always flat
Sprite Renderer 2DOffSprite is always flat

04 — Gradient TypesAll Gradient Modes

Four core gradient types — same across all mesh, UI, and skybox shaders.

Linear

Full 360° directional gradient via Gradient Angle. Combine with Horizon Offset to shift the blend band.

Radial

Centre-outward on meshes. Pole-outward on skybox. Gradient Angle rotates the pattern.

Angular

Full 360° azimuthal conical sweep. Maps to the full horizon band on skybox.

Diamond

Symmetric reflected ramp from centre creating a diamond / rhombus gradient.

Gradient Modifiers

ModifierPropertiesDescription
Three-stop mid colourUseMidStop, MidColor, MidPointThird colour at configurable position 0.01–0.99
SharpnessSharpness (0.1–8)Power curve — hard bands or ultra-soft blends
Horizon offsetHorizonOffset (−0.5–0.5)Shifts blend band without changing angle
Scrolling UVScrollSpeedX, ScrollSpeedYFlowing, lava, and liquid motion effects
Noise distortionDistortion, DistortionScaleProcedural noise warp. Zero texture dependency.
Dithered edgeDitherAmount, DitherScaleDissolve-style noise threshold on boundary
Colour animationFlowSpeed, TargetTopColor, TargetBottomColorSine-wave oscillation between colours. 0 = static.
HDR brightnessBrightness (0–3, skybox 0–5)Above 1 = HDR bloom-ready output

05 — UI ShadersGradientUI_URP & GradientUI_HDRP

Extends the base gradient with shape masking, a sweep arc cooldown mask, and a metallic highlight streak.

Shape Masking

Assign any sprite to _MainTex. The alpha channel is multiplied into the gradient — fills the exact silhouette.

Sweep Arc Mask

Enable UseSweep. Set FillAmount 0–1. Ideal for cooldown rings, circular progress, radial meters.

Metallic Streak

Enable UseMetallic. Additive specular band for gloss/foil sheen on buttons and UI panels.

HDRP Canvas limitation: Screen Space — Overlay is not supported in HDRP (engine constraint). Use Screen Space — Camera or World Space instead — both work correctly.

06 — Skybox ShadersGradient_Skybox_URP & HDRP

Full-sphere environment sky shaders using world-space view direction. All four gradient types, procedural sun disc, HDR brightness up to 5.

Gradient_Skybox_URP

Assigned via Lighting → Environment → Skybox Material. All 4 gradient types, sun disc, brightness up to 5.

Gradient_Skybox_HDRP

Integrated with the HDRP Volume system. Add a Volume → Gradient Sky override. Cubemap bake + camera passes.

URP Sky Setup

Create a Material

Assign the Prismatica/Gradient_Skybox_URP shader.

Assign to Lighting

Window → Rendering → Lighting → Skybox Material slot.

Configure

Adjust colours, enable sun disc, set brightness. Live in Scene view.

HDRP Sky Setup

Add a Volume

Add a GameObject with a Volume component (Global).

Add Visual Environment override

In the Volume profile → Add Override → Sky → Visual Environment. Enable the Sky Type checkbox and set it to Gradient Sky.

Add Gradient Sky override

Add Override → Sky → Gradient Sky. Enable the checkboxes next to at least Top Color and Bottom Color.

Set Sky Type in Lighting

Window → Rendering → Lighting → Environment → Sky Type → Gradient Sky.

Skybox defaults: FlowSpeed = 0 (static), UseMidStop = On (horizon colour visible), Brightness range 0–5 for HDR/Bloom skies.

07 — LiquidFill ShadersAnimated Liquid Fill

Animated liquid simulation for 3D meshes, 2D sprites, and UI Canvas. Wave surface, glass shell, rim glow, and specular highlight — all independently toggleable.

LiquidFill_URP

Two passes: 3D mesh (positionOS) + Sprite Renderer (UV). SRP Batcher compatible.

LiquidFillUI_URP

Single pass, UV-based fill and wave. UI Canvas Image / Raw Image.

LiquidFill_HDRP

Pipeline-guarded HDRP equivalent for 3D meshes.

LiquidFillUI_HDRP

Pipeline-guarded HDRP equivalent for UI Canvas.

Visual Layers

LayerToggleDescription
Liquid bodyAlways onGradient fill between LiquidColorBottom and LiquidColorTop
Wave surfaceAlways on (fades at extremes)Sine-wave displacement at the fill level
Surface edge glowAlways on (fades at extremes)Bright glow strip at the liquid surface line
Glass shellUseGlassTranslucent outer container shell
Rim glowUseGlassFresnel-approximation rim glow around the edge
Specular highlightUseGlassSmooth circular specular dot on the glass surface

Choosing the right LiquidFill shader: For 3D meshes (capsule, sphere, cylinder) use LiquidFill_URP on a Mesh Renderer. For shaped 2D containers (test tube, flask, bottle sprite) use LiquidFillUI_URP on a Canvas UI Image — Unity's UI system handles silhouette clipping automatically. For simple rectangular sprites (health bars, progress fills) use LiquidFill_URP on a Sprite Renderer with the sprite's Mesh Type set to Full Rect in import settings.

Wave seam on capsule/cylinder: Unity's meshes have a UV seam where uv.x wraps 1→0. The 3D pass uses positionOS.x instead — no seam, no configuration needed.

FillScale / FillBias

// Maps objectY range to fill level
REAL fillT = saturate(objectY * _FillScale + _FillBias + _FillAmount - 0.5);

Default maps objectY −0.5 → +0.5, matching Unity unit-scale meshes. Adjust for custom geometry.

08 — Use Case GuideWhich Shader to Use

Use CasePipelineShaderCull
3D mesh (sphere, cube, capsule, cylinder)URPGradient_URPBack
3D meshHDRPGradient_HDRP
Quad / PlaneURPGradient_URPOff
UI Raw ImageURPGradient_URP or GradientUI_URPOff
UI Raw ImageHDRPGradientUI_HDRPOff
Sprite Renderer 2DURPGradient_URPOff
Shape mask / cooldown ring / metallic buttonURPGradientUI_URPOff
Shape mask / cooldown ringHDRPGradientUI_HDRPOff
SkyboxURPGradient_Skybox_URP
SkyboxHDRPGradient_Skybox_HDRP via Volume
Liquid fill — 3D meshURPLiquidFill_URPBack
Liquid fill — 2D shaped sprite (test tube, flask)URPLiquidFillUI_URP on Canvas UI ImageOff
Liquid fill — rectangular sprite (health bar)URPLiquidFill_URP — Sprite Renderer, Mesh Type: Full RectOff
Liquid fill — UI CanvasURPLiquidFillUI_URPOff
Liquid fill — 3D meshHDRPLiquidFill_HDRP
Liquid fill — UI CanvasHDRPLiquidFillUI_HDRP

09 — Properties ReferenceAll Shader Properties

Gradient Shaders — Mesh & UI

Gradient_URP · Gradient_HDRP · GradientUI_URP · GradientUI_HDRP

PropertyTypeDefaultNotes
TopColorHDR ColorBlueTop / start colour
BottomColorHDR ColorDark blueBottom / end colour
TargetTopColorHDR ColorOrangeAnimation target for top
TargetBottomColorHDR ColorPurpleAnimation target for bottom
UseMidStopToggleOffEnable three-stop gradient
MidColorHDR ColorGreyMiddle colour stop
MidPoint0.01–0.990.5Position of mid stop
GradientTypeKeywordEnumLinearLinear / Radial / Angular / Diamond
GradientAngle0–3600Rotation of gradient direction
HorizonOffset−0.5–0.50Vertical shift of blend band
FlowSpeed0–101.0Animation speed. 0 = static.
FlowOffset0–6.280Phase offset
ScrollSpeedX / Y−5–50UV scroll per axis
Sharpness0.1–81.0Power curve on ramp
Distortion0–10Noise warp amount
DistortionScale0.5–204.0Noise scale
DitherAmount0–10Dissolve threshold
DitherScale1–5010.0Dither noise scale
Brightness0–31.0Output multiplier
CullModeEnumBack (2)URP only — Off (0) for quads/UI

GradientUI Only

PropertyTypeDescription
UseSweepToggleEnable sweep arc mask
FillAmount0–1Arc fill fraction
SweepStartAngle0–360Arc start rotation
SweepSoftnessRangeArc tip softness
UseMetallicToggleEnable metallic streak
StreakAngle0–360Highlight band direction
StreakPosition0–1Position on surface
StreakWidthRangeSpecular band width
StreakIntensityRangeAdditive brightness

LiquidFill Shaders

PropertyTypeDefaultNotes
FillAmount0–10.60 = empty, 1 = full
LiquidColorBottomHDR ColorCyanBottom colour
LiquidColorTopHDR ColorLight cyanTop colour
LiquidOpacity0–11.0Body opacity
SurfaceEdgeColorHDR ColorWhiteGlow strip colour
SurfaceEdgeWidthRange0.022Glow strip thickness
SurfaceEdgeIntensityRange2.2Glow strip brightness
WaveSpeedRange2.0Animation speed
WaveAmplitudeRange0.015Wave height
WaveFrequencyRange4.0Spatial frequency
GlassColorHDR ColorWarm whiteShell tint
GlassOpacity0–10.10Shell transparency
RimColorHDR ColorOrangeRim glow colour
RimIntensityRange1.2Rim brightness
RimPowerRange2.0Falloff sharpness
HighlightColorHDR ColorWhiteSpecular dot colour
HighlightPosX / PosY0–10.62 / 0.82UV position
HighlightSizeRange0.045Dot size
HighlightIntensityRange2.5Dot brightness
FillScale / FillBiasRange1.0 / 0.03D mesh fill calibration
UseGlassToggleOnOff = disables glass, rim, highlight
Brightness0–31.0Output multiplier

10 — Custom InspectorGradientShaderGUI

One inspector class covers all Prismatica gradient shaders. Sections appear and disappear based on which properties exist in the active shader.

Collapsible Sections

Foldout sections styled with EditorStyles.helpBox. Pro and Light skin aware.

Live Gradient Preview

Preview strip renders live — showing top/mid/bottom blend and animation target colours.

#

Hex Colour Input

Accepts #RGB, #RRGGBB, #RRGGBBAA. Bidirectional — hex updates the picker and vice versa.

Contextual Greying

Irrelevant properties grey out automatically based on active toggles and settings.

11 — Pipeline DetectionGradientShaderSetup

Editor-only script — handles all pipeline configuration automatically.

What It Does

Move the entire Prismatica folder anywhere inside Assets/ — the Move Watcher detects it and re-runs the path fixer automatically. Shaders stay green.

12 — WebGL & MobilePlatform Compatibility

PlatformPipelineStatusNotes
Windows / macOS / LinuxURP + HDRP✓ SupportedFull feature set
AndroidURP✓ Supportedhalf on GLES3 / Vulkan
iOSURP✓ Supportedhalf on Metal
WebGL 2.0URP✓ Supportedhalf via SHADER_API_WEBGL
WebGL 1.0URP⚠ UntestedMay work — not validated
Console (PS5, Xbox)URP + HDRP⚠ UntestedNo platform-specific code

WebGL noise: GradientNoise() uses sin() hashing — can be slow on some WebGL drivers. Only active when Distortion > 0 or DitherAmount > 0. Both default to 0.

13 — HDRP NotesHDRP-Specific Details

Automatic Detection

When HDRP is installed, the setup script adds PRISMATICA_HDRP_AVAILABLE to Scripting Define Symbols automatically, enabling all HDRP shaders and the sky C# runtime files.

Time Variable

HDRP shaders use _TimeParameters.x instead of _Time.y — handled automatically.

Screen Space — Overlay canvas not supported in HDRP. Engine constraint — use Screen Space — Camera or World Space canvas mode instead.

HDRP Sky Volume

GradientSkySettings and GradientSkyRenderer are wrapped in #if PRISMATICA_HDRP_AVAILABLE — no errors in URP projects. Uses [SkyUniqueID(20260222)] to prevent ID collisions.

14 — PerformanceOptimisation Notes

SRP Batcher

All properties in a single CBUFFER_START(UnityPerMaterial) block. Confirm in the Frame Debugger — look for SRP Batch.

Shader Variants

shader_feature_local on all toggles — unused variants stripped at build time. Zero runtime branching cost.

📱

half Precision

All gradient math runs as half on mobile and WebGL. 2× ALU throughput on Mali, Adreno, and Apple GPU.

0

Zero Textures

All effects are procedural — no baked textures. Saves memory on mobile, eliminates load overhead on WebGL.

Mobile Tips