Stylized Water 2 documentation

Stylized Water 2

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

6.Troubleshooting #

Console errors

Assertion failed on expression: ‘0 == m_CurrentBuiltInBindMask’ UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

This is sometimes thrown when the shader recompiles, and appears to be a bug in Unity’s Async shader compiler. Fortunately, it’s harmless.

Particle effects appear below water, regardless of position

Transparent objects in Unity are sorted by their pivot point. Since the particle surfaces do not have any depth, it’s not possible to sort them on a per-pixel basis.

To remedy this, set the “Order in layer” value on the Particle System (found in the Rendering section) to a value higher than 0. Alternatively, turn off the “Zwrite” option on the water material, found under the “Advanced” tab.

Water is visible in Scene view, but not in the Game view

On the water material, you’ll notice and error that indicates that the “Depth texture” option is disabled in your URP settings. Click the “Enable” button next to it to enable this. After which, the water will render correctly.

Water depth and intersection effect do not appear (on some objects)

Objects intersecting with the water must use a shader that writes to the depth texture, otherwise there is no way to tell how far away its pixels are in 3D space. For instance, Unlit shaders do not write to the depth buffer. 

This means sprites, unlit materials and transparent materials can’t be affected.

(Mobile) When using an orthographic camera, water appears below other objects/terrain and intersection effects aren’t visible

This issue is caused by transparency sorting, mobile devices are less accurate in this manner. To rectify this, reduce the “Far clipping plane” on your camera until it starts to clip your geometry. By default this is set to 1000 units, which is overkill for orthographic scenes. Secondly, move the camera as close to the environment as possible.

These steps reduce the rendering range for the camera and therefore increase the accuracy of sorting. After which, the water should render correctly.

Refraction also distorts objects above the water

This behavior is by design. Using the “Advanced” shading mode performs some additional calculations to largely remove these artifacts.

Translucency and sun reflection cut off

When using the Advanced shading mode, the shadow map is used to mask the translucency/sun reflection effect, so that they’re not visible in shadows.

If nothing in the camera view is rendering anything that casts a shadow, the shadow map isn’t rendered at all and turns blank. In turn, the water shader receives a “broken” shadow map. So generally, in a full environment this will not occur, but is worth mentioning.

Water shows noise artifacts when viewed from afar

This scene uses a 16k terrain, where the scene camera is 20.000 units away. At this point you’re running into precision issues. On water pixels with the skybox directly behind it, depth values become so large that artifacts start to show. In any normal situation, this won’t occur.

Yes No Suggest edit
Last updated on November 22, 2020
0 of 0 users found this section helpful
Suggest Edit