Stylized Water 2 - Dynamic Effects (Extension)
7.Performance Guidelines
Overview
The Dynamic Effects framework is quite cheap to render. You’ll typically see a similar technique in tutorials using a top-down camera rendering a specific layer. This asset uses proprietary code that allows for low-level rendering, sitting as close as possible to Unity’s native rendering. As a result, the hefty overhead normally associated with processing an additional camera is not present. This provides best in class performance.
On the receiving end, the water shader has little extra work to do. In the vertex shader, the displacement data is read and vertices are pushed upwards. On a per-pixel basis, the normal map is blended in, and a 2nd layer of Surface Foam is composited onto the water.
16-bit data is used for both Displacement and Foam. This enables foam strengths over 100% and displacement that can scale up without artefacts, as well as allowing negative displacement (eg. whirlpool effect). This does use relatively more memory, but is ultimately a design choice in favor of creative flexibility.
Quality/performance scaling
On the render feature, you’ll find several parameters exposed. These are practically all related to quality/performance scaling.
You will always have to sacrifices either quality or performance, or find a balance in between. Rendering over a large visible range, whilst retaining fine details near the camera is not realistic to expect.
You can also access these settings in C#, see the Scripting section.
Tips
Always start by determining the maximum Render Range for your project.
- For a first-person perspective, you can definitely bring this number down rather low and benefit from high detail effects (particularly ripples).
- For third-person perspectives, possibly with water capable vehicles in place, you’d benefit more from a longer render range. Detail close to the camera will be sufficient, but relatively low.
- For an airborne perspective, a long render range is needed, but small-scale details will be lost.
Mobile
It’s recommended to keep the resolution as low as possible, as this otherwise strains your available GPU bandwidth.
Disable the “Enable Normals” checkbox if:
- You aren’t using any (directional) lighting in your project, merely unlit materials (the Enable Lighting option is disabled on the water material)
- The Normals feature is disabled on the water material
- No water materials are using reflections