top of page

Grass Shader

Engine : Unreal

Tools : Unreal, Blender

The shader is built in Unreal Engine using a Masked, Two-Sided Foliage material. Key features include wind sway, per-instance color variation, opacity masking, and parameter controls for flexibility.

Material Settings.png
Base Color

Base Color:

  • Base Color texture blended with Grass Tint using Blend_Overlay.

  • PerInstanceRandom * ColorVariation parameter introduces per-instance hue randomness.

  • SpeedTreeColorVariation adds subtle natural variation.

  • Ambient Occlusion (AO) output from 3PointLevels is multiplied here to darken base regions, improving depth and realism.

Opacity Mask

Opacity Mask:

  • Opacity texture combined with OpacityStrength scalar and PerInstanceFadeAmount for distance fade.

Normal Map

Normal Map:

  • Normal texture scaled with NormalStrength parameter.

  • FlattenNormal ensures consistency for two-sided shading.

Roughness

Roughness:

  • Roughness texture adjusted with a Power node and RoughnessStrength parameter for micro-surface control.

Specular

Specular:

  • Specular texture multiplied with SpecularStrength scalar to tune highlights.

Ambient Occlusion

Ambient Occlusion:

  • AO texture passed through 3PointLevels with AO Controls parameter for remapping.

  • Final AO result multiplied into the Base Color variation for grounded shading.

Subsurface Scattering

Subsurface Scattering:

  • Implemented by blending Base Color overlay with scalar SSS parameter.

Wind Sway

Wind Sway:

  • CustomGrassWind node driven by WindIntensity, WindSpeed, and WindWeight.

  • Randomized wind direction per instance using PerInstanceRandom for varied sway.

  • Switch parameter allows toggling between fixed global direction and randomized instance-based sway.

Wind Sway (CustomGrassWind)

Wind Sway (CustomGrassWind):

  • Inputs:

    • WindDirection (Vector3) — global wind direction.​

    • WindSpeed (Scalar) — controls oscillation speed.

    • WindIntensity (Scalar) — overall bending strength.

    • WindWeight (Scalar) — scales wind effect across vertex height or mask.

    • AdditionalWPO (Vector3) — allows extra displacement.

    • VertexColor (Vector4) — for per-vertex masking (e.g., roots vs. tips).

  • Direction Setup: WindDirection normalized and remapped into usable X/Y directional vectors.​

  • Time & Oscillation: Time × WindSpeed drives periodic sine-like oscillation.

  • World Position Influence: Absolute World Position introduces spatial variation so grass patches don’t move identically.

  • Wind Weight Mask: WindWeight parameter ensures the sway strength can be scaled, often combined with vertex masking.

  • Vertex Masking: VertexColor multiplies the effect so painted values control sway strength.

  • Combination: Offset = (Direction × Intensity × Oscillation × WindWeight × VertexMask) + AdditionalWPO.

  • Output: The result drives World Position Offset for realistic vertex movement.

Exposed Parameters
  • Color Variation - controls hue randomness per instance.

  • AO Controls - remaps AO black/grey/white points.

  • Normal Strength - adjusts normal map influence.

  • Opacity Strength - fine-tunes alpha cutout.

  • Roughness Strength - adjusts micro-reflectivity.

  • Specular Strength - sets highlight intensity.

  • SSS - controls light transmission through grass blades.

  • Wind Intensity / Speed / Weight - controls sway motion.

  • WPO (World Position Offset) - adjusts sway amplitude.

  • Grass Tint - global tint applied with Base Color.

  • Base Color Texture - main grass color.

  • Opacity Texture - cutout mask.

  • Normal Texture - lighting detail.

  • Roughness Texture - surface roughness variation.

  • Specular Texture - specular highlights.

  • AO Texture - ambient occlusion map.

Performance vs Quality Trade-offs
  • Masked blend mode chosen over Translucent for efficiency and proper shadow support.

  • AO multiplied with Base Color - adds depth without extra textures.

  • No tessellation/displacement on grass - avoids heavy cost on dense foliage.

  • PerInstanceRandom ensures natural variation across the field.

  • Distance fade with PerInstanceFadeAmount reduces overdraw at far distances.

Possible Extensions for Production
  • Dynamic wind zones using Material Parameter Collection for localized gusts.

  • Interactive bending for gameplay (grass reacts to player movement).

  • Seasonal variation via global tint and AO control (spring, summer, autumn).

  • Advanced subsurface profile for more realistic scattering.

  • World-based wind waves for large-scale wind simulation.

  • Mail
  • telephone
  • LinkedIn
bottom of page