Skip to Content
DocumentationFeaturesHeight Gradient

Height Gradient

Height Gradient samples the world-space Y position of each pixel and blends colors (or layer weights) along that axis. It is the cheapest way to get snow on mountain tops, moss along waterlines, or lava that brightens at the base of a cliff, all from one texture-free function.

When to use it

  • Snow caps on terrain and rocks.
  • Waterlines — moss or dirt at the base of a wall.
  • Lava cliffs — hot at the bottom, cool at the top.
  • Atmospheric tinting for tall environments such as skyscrapers and towers.

How it works

The shader reads positionWS.y, subtracts _HeightMin, divides by _HeightMax - _HeightMin, and saturates the result. That 0–1 value becomes either the lerp factor for _BottomColor / _TopColor or the weight for a Layer Textures slot.

Properties

Inspector labelShader propertyTypeDefaultDescription
Height Min_HeightMinFloat0.0World-Y where the gradient starts.
Height Max_HeightMaxFloat10.0World-Y where the gradient ends.
Bottom Color_BottomColorColorRGB(0.3, 0.2, 0.1)Tint at or below Height Min.
Top Color_TopColorColorRGB(0.95, 0.95, 1.0)Tint at or above Height Max.
Falloff_HeightFalloffFloat (0–1)0.1Smoothstep softness of the band edge.
Noise Texture_HeightNoiseTexture2DNoneOptional noise that breaks up the band.
Output_HeightOutputEnumColorColor, LayerWeight, or Emission.

Usage

  1. Set Height Min / Max in world units. A 5m band gives a soft transition; 0.5m is a sharp ring.
  2. Pick the Bottom and Top colors. For snow, run warm rock to white-blue.
  3. Add a noise texture for organic edges — without it the band looks suspiciously straight.
  4. Switch Output to LayerWeight to drive Layer Textures instead of color.
material.SetFloat("_HeightMin", 4f); material.SetFloat("_HeightMax", 12f); material.SetColor("_TopColor", new Color(0.92f, 0.95f, 1.0f));

Tips & gotchas

  • The gradient is world-space, not local. Moving the mesh up keeps the snow at the same world height — usually correct for terrain, but watch moving props.
  • Add noise: a straight horizontal band reads as fake instantly, and even 10% noise looks natural.
  • Combine with Triplanar for terrain; both are world-space and pair perfectly.
  • Lightmapped objects still receive the gradient on top of the bake — good for snow but odd for emissive lava, where the Emission output is better.
Last updated on