Stylized Water 2 documentation

Stylized Water 2

Stylized Water 2
Version: 1.6.2
Review

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.

Troubleshooting

Reflections are enabled, but they aren’t visible in (some) water materials

The “Curvature Mask” material parameter (Reflections tab) tends to greatly influence how much of the reflection is visible, based on the viewing angle. This is an important aspect of water reflections, that make it believable. However, when looking straight down at the water, reflections would be very minimal.

If you were to bring this value down to 0, the water practically becomes a mirror. Try doing so, then adjust the value to your liking.

(If Planar Reflections are enabled, and a Water Object is assigned to the component, you can be certain reflections are enabled).

Reflections do not appear in the Game view, or have an unusual color

Try to disable any third-party render features, to check if that makes a difference.

If so, you can keep them enabled, but you’re required to set up a separate renderer for Planar Reflections without these render features. This is outlined in the Performance Guidelines section (Renderer header).

Reflections show dark red/black spots on the reflected terrain

This was corrected in version 1.1.5 of the asset

Reflections appear mostly black

If everything in the reflection (expect scene geometry) appears black, it’s because your scene does not have a reflection probe set up. This is always the case for brand new scene.

Go to Window->Rendering->Lighting Settings and disable “Baked Global Illumination” check the “Auto generate” checkbox. Wait for the baking to finish, then disable it again. This will trigger the generation of a “global” reflection probe for the scene and will allow the water to reflect the skybox. It’s only required to do this once per scene.

Alternatively: Go to GameObject->Light->Reflection probe. Ensure the reflection probe box at least touches the water.

For more information see the Unity manual about Reflection Probes.

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 loading/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 July 30, 2023
3 of 3 users found this section helpful
Suggest Edit