Urp Water Sandbox by madc0der - 1

Shaders & Effects

Unity URP Sandbox with prefabs from upgraded Standard Assets water shader/script and BoatAttack water system

Unknown VersionUnknown LicenseUpdated 216 days agoCreated on October 1st, 2020
Go to source

URP Water Sandbox

Water implementation for Universal Render Pipeline


Package contains two scenes with two approaches:

  1. Water migrated to URP from Standard Assets (only Reflections are migrated, no Refraction) Simple water with planar reflections

  2. Water extracted from BoatAttack project Water prefab based on WaterSystem from BoatAttack


Original Water script is not working in URP because of explicit call to Camera.Render during rendering of reflection/refraction. Current solution is splatted to following scripts:

  1. ReflectiveWaterController handle rendering of reflection by separate reflection camera which is transformed to reflection point of view. Rendering performed to RenderTexture
  2. ReflectiveWaterPlan - update shader params for each WaterPlane

Improvements comparing to standard Water

  1. It’s working with URP! 😃
  2. There is only one reflection camera, not camera-per-plane
  3. The same for RenderTexture - it’s only one in current implementation
  4. Occlusion culling is disabled by default for reflection camera (but there is option to enable it 😃
  5. Near/Far clipping planes extended for cases with large terrains (too far mesh parts is not visible above the water, but juggling on reflections)
  6. There can be multiple “Water planes” (children of ReflectiveWaterController). It can be used to hide invisible water parts with baked occlusion.


  1. More complex setup - it’s not enough to add single GameObject with Water script and FX/Water shader. But it can be grouped as prefab (as implemented in StandardAssetsReflectiveWater scene).
  2. There is bug with multiple Scene Views with reflections in Editor mode. Option Use Reflections In Editor was added to ReflectiveWaterController as workaround.

Additional notes

  1. Culling mask can be set for Reflection Camera directly, i.e. in order to reflect only SkyBox or Ground + SkyBox
  2. Refraction can be migrated by the same way as Reflection, see original Water.cs script. I’m not planning to do it because Reflection+Refraction consume a little bit more FPS w/o significant image improvement for high-speed scenes.

WaterSystem from BoatAttack

The following steps are required to create water prefab from BoatAttack:

  1. Create new Unity project from URP template
  2. Import following packages:
    • com.unity.mathematics
    • com.unity.burst
  3. Import com.verasl.water-system from BoatAttack/Packages folder
  4. Copy PlanarReflectionRenderer, WaterSettingsData, WaterSurfaceData from BoatAttack project
  5. Add PlanarReflectionRenderer as 2nd renderer of UniversalRP-HighQuality.asset (or asset for other Quality settings)

Here is official Unity description of how water can be changed (21:22): https://www.youtube.com/watch?v=Bvl9rCVbMas

Show all projects by madc0der