Stylized Water 2 documentation

Stylized Water 2

Stylized Water 2
Author: jonathan
Version: 1.1.4
Dated: 22 Sep 2020

4.3.Planar Reflections #

By default, the water reflects the skybox and reflection probes. These are omni-directional and work great for conveying the curvature of the water (wave normals and the normal map greatly affect this). Though this is limited when looking to 1:1 reflect an object.

With planar reflections, mirror-like reflections are possible, because the scene is rendered from a mirrored perspective. Reflections will be blended with reflection probes, so you get best of both worlds. Visually, waves and normals will distort the reflection to create the illusion of a true reflection.

As the name implies, this only works for flat water surfaces (specifically, a single height).

 

Setup

To enable this:
– Go to Window->Stylized Water 2->Set up planar reflections
– (OR) Create an empty GameObject and go to Add Component->Stylized Water 2->Planar Reflection Renderer.

Next, assign any Water Objects you want the reflection to apply to, or click the “Auto-find” button to assign all water objects in the scene. If you have only one Water Object in the scene, it is automatically assigned for you.

For this to work, the water mesh(es) require to have a “Water Object” component on them

The Water Objects should always be on the “Water” layer, otherwise the water itself will be rendered into the reflection, causing an “infinity mirror” effect.

With the component selected, you’ll notice a white rectangle wrapped around the water objects. This represents the total bounds and is important information used for rendering.

If you’ve moved the affected water objects, the bounds will be outdated. You’ll noticed reflections stop rendering, when they shouldn’t. An error and quick-fix button will be displayed in this case.

Multiple instances (version v1.1.0+)

A Planar Reflection Renderer always applies to specific water objects, and will only render if any of those objects are in view. That said, it’s possible to use multiple reflection renders, each for specific water objects. For example, one renderer that’s set up for an ocean, and only reflects boats (through the culling mask), and another for an inland pond that’s set up to only render a short range.

This is achievable by simply creating multiple Planar Reflection Renderer components, and assigning only the water objects it should apply to. This is particularly necessary if water objects aren’t all on the same height level.

Limitations

  • Water objects should not be moved. The RecalculateBounds() function should be called on the Planar Reflection Renderer instance if this is done.
  • Incompatible with VR, if in use, reflections will not render.
  • Will not render for water rendered through an Overlay camera, as a means of optimization

Because the component requires a reference to Water Objects, water loaded in through a streaming system will not have planar reflections.

An idea is to add a “Group ID” dropdown to the Water Object component, so it can be assigned automatically to a Planar Reflection Renderer component having the same ID. But this concept needs to be thought out more, implemented and tested, so will likely be added in a future update if there is a demand for it.

Performance

See the Performance Guidelines section

Yes No Suggest edit
Last updated on August 5, 2021
1 of 1 users found this section helpful
Suggest Edit