Stylized Water Shader
Water depth and intersection effect do not appear (on some objects)
If you’re using Forward rendering, check if your camera has the
EnableDepthBuffer script attached to it. In many cases this will fix any issues.
Objects intersecting with the water must use a shader that writes to the depth buffer, otherwise there is no way to tell where it is positioned in 3D space. For instance, Unlit shaders do not write to the depth buffer. You can download a modified Unlit shader here, which writes to the depth buffer: http://staggart.xyz/public/Unlit_ZWrite.shader
If using shaders other than Unlit shaders is not viable for your project, you can use vertex painting to paint the intersection effect instead.
Assertion failed on expression: ‘(srcInfo.GetChannelMask() & copyChannels) == copyChannels’
These errors are only thrown in the demo scene in Unit 2018.1+. This has been fixed in version 2.0.1.
Waves aren’t high enough, even with the highest “Wave height” value
In this case, your water mesh is probably be very big. If you need higher waves than the shader value allows for, increase the scale of your mesh on the Y-axis to the same effect
Waves look very pointy, triangular
This is an indication that the vertex-density/polycount of your water mesh is too low. Add subdivisions to your mesh to increase the wave fidelity.
Much like a pin-art toy; the more pins it has, the more detailed the shape becomes.
Transparency is set to 0, but water still has a faint bright color
This only applies to the Desktop shader. The transparency parameter doesn’t actually control the shader’s opacity, but rather controls the amount of visibility of the objects rendered underneath the water. This is known as a GrabPass. The water shader is built on the PBR model, so it inherits some shading properties such as fresnel, which explains the faint brightness.
This behaviour is by design, so it’s still possible to have crystal clear water, while retaining the refraction capabilities. Otherwise the water would simply turn invisible. When the “Unlit” toggle is checked, this is not an issue, since all lighting is overridden.
Refraction shows artifacts along edges
This is actually correct behavior, and is a common limitation of using a GrabPass. Essentially objects above the water are also refracted.
A way around this is to render the geometry underneath the water into a separate refraction buffer. However, the performance trade-off for such a technique is generally not worth the small visual improvement, which is why it is not implemented.
Water material looks black
If there is no Directional Light in your scene this may be the case. Most mobile setups do not use any lighting, for performance. In which case you should set the lighting method to “Unlit” in the Lighting tab.
(Mobile) After a few minutes, the water animation becomes stepped and the textures pixellated
Since some mobile devices don’t support high precision values, artifacts may occur the longer the shader runs. This greatly varies between devices. Disabling “World-space tiling” uses overall lower values, and will prevent these artifacts.
This issue is resolved completely in version 2.0.
Water surface flickers white and the intersection effects disappears
This is usually caused if there is no light source in the scene, or your scene-view has lighting switched off.
Water shows banding artifacts
Some of the shader features rely on the rendered depth buffer. If your device does not render this accurately banding artifacts will show. This appears to happen on some devices using a Mali-450MP4 GPU.
It has been fixed in version 1.24. Should it still occur, a potentially solution is to set the display buffer to 32-bit as some users reported this fixed the issue.
Objects show a pixelated white outline
This occurs when using Unity’s built-in MSAA and can be remedied by using an Anti-Aliasing image effect instead.
Surfaces looks jagged
This is due to compression of the shader textures. You can override this compression in the inspector under the “Advanced” tab.
This will impair a slightly larger memory cost as the two textures will be larger in file size.
(iOS) Black dots appear on the water
You can elevate this issue by doing taking the following steps:
- Unset the Sun object in the Lighting tab, if set
- Raise the Shadow Bias value on your Directional Light
`System.IO.File’ does not contain a definition for `WriteAllBytes’ error
The “WebPlayer” target platform does not support writing files to disk and is thus not supported. The WebPlayer functionality was officially deprecated since Unity 5.4.