URP Water Sandbox
Water implementation for Universal Render Pipeline
Package contains two scenes with two approaches:
Water migrated to URP from Standard Assets (only Reflections are migrated, no Refraction)
Water extracted from BoatAttack project
Original Water script is not working in URP because of explicit call to
rendering of reflection/refraction.
Current solution is splatted to following scripts:
ReflectiveWaterControllerhandle rendering of reflection by separate reflection camera which is transformed to reflection point of view. Rendering performed to
ReflectiveWaterPlan- update shader params for each WaterPlane
Improvements comparing to standard Water
- It’s working with URP! 😃
- There is only one reflection camera, not camera-per-plane
- The same for RenderTexture - it’s only one in current implementation
- Occlusion culling is disabled by default for reflection camera (but there is option to enable it 😃
- Near/Far clipping planes extended for cases with large terrains (too far mesh parts is not visible above the water, but juggling on reflections)
- There can be multiple “Water planes” (children of
ReflectiveWaterController). It can be used to hide invisible water parts with baked occlusion.
- More complex setup - it’s not enough to add single
FX/Watershader. But it can be grouped as prefab (as implemented in
- There is bug with multiple Scene Views with reflections in Editor mode.
Use Reflections In Editorwas added to
- Culling mask can be set for Reflection Camera directly, i.e. in order to reflect only SkyBox or Ground + SkyBox
- Refraction can be migrated by the same way as Reflection, see original
Water.csscript. 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:
- Create new Unity project from URP template
- Import following packages:
WaterSurfaceDatafrom BoatAttack project
PlanarReflectionRendereras 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