Video summary
Making a Water Shader in Unity with URP! (Tutorial)
Main summary
Key takeaways
Overview
This tutorial explains how to create a tropical water shader in Unity using Shader Graph with URP (Universal Render Pipeline). It guides you from a basic depth-based transparent water look toward more realism by adding normals, wave vertex displacement, and reflection/smoothness, with pointers for advanced effects.
Steps / Technological Concepts Covered
Scene Setup
- Add a Plane to represent the water.
- Use a custom plane with extra subdivisions to support vertex displacement (for waves).
Shader Graph + Material
- Create a new Shader Graph: “Create Shader PBR Graph.”
- Create a Material from the shader graph and assign it to the plane.
Depth-Based Color & Transparency (URP Depth Buffer)
Water starts “murky,” then is improved using a depth gradient derived from the camera depth texture.
- Set Surface Type = Transparent.
- Compute depth influence using the camera depth texture (depth buffer).
- Use nodes such as:
- Camera
- Screen Position (raw mode)
- Split, Multiply, Add, Subtract
- Derive a depth value in screen space and apply it to Albedo to create a gradient:
- Shallow areas (nearer the surface) → brighter / more transparent
- Deep areas (farther below) → darker / more opaque
- Add a Vector1 “strength” property (slider), clamped 0 to 2 using a Clamp node to soften the gradient blend.
- Important URP requirement: you may need to enable depth-related options in the Render Pipeline Asset settings.
Shallow vs Deep Water Coloring
- Add two color properties:
- Deep water color
- Shallow water color
- Blend them using a gradient-derived mask via a Lerp / “Lip” node (as referenced in the subtitles).
- Ensure alpha blends properly:
- Split alpha from color and connect to the Master Node Alpha.
- Set Alpha Clip Threshold = 0 to avoid cutting parts of the mesh.
Initial Realism Improvements
- Disable shadows on the water mesh so transparent regions render correctly.
Normal Mapping for Surface Detail (Waves Illusion)
- Add two normal map texture properties:
- Main Normal
- Secondary Normal
- Sample both normals, then apply:
- Tiling & Offset (tiling set to ~100 for a large plane)
- Time-based scrolling:
- First normal scroll: divide Time by 250
- Second normal scroll: divide Time by -25 (opposite direction)
- Blend normals (add) and connect to the master’s Normal input.
Shoreline Fading / Controlling Aggressiveness
- Add a normal strength control (Vector1 property).
- Use the previously created depth gradient to modulate falloff using a Lerp:
- Connect gradient to the T input of the lerp
- Connect normal strength to the B input (per subtitles)
- Result: normal detail fades near the shore to prevent overly harsh texture.
Reflection / Specular via Smoothness
- Add a Smoothness (or “smooth anis”) property and connect it to the master node.
- Increasing smoothness boosts the influence of normals on specular highlights and reflections.
Vertex Displacement Waves (Motion)
- Pass noise over UVs to drive vertex displacement:
- Create a Position (Object Space) node.
- Use Gradient Noise (scale ~20) multiplied by a displacement parameter to form a mask.
- Connect to the Vertex Position input of the master node:
- Use the green channel (Y) for displacement (as described in subtitles)
- Animate the displacement:
- Apply Tiling & Offset to the noise UVs
- Use Time / ~100 to control wave speed
- Result: the mesh displacement moves like waves traveling across the plane.
Notes on Further Expansion (Demo Reference)
- Mentions a more advanced water system in a “Boat attack” demo, including concepts like:
- caustic effects
- reflections
- underwater refraction
- multiple foam layers
- Suggests Shader Graph makes iteration faster and encourages using the linked description for advanced examples.
Main Speakers / Sources
- Video narrator / tutorial author (not explicitly named in the subtitles)
- Unity URP + Shader Graph documentation/feature set
- “Boat attack” demo (reference for advanced water features)