wave-harmonic / crest

A class-leading water system implemented in Unity
MIT License
3.4k stars 475 forks source link

Enable Shader API causes artifacts #1146

Open Revmatek opened 3 months ago

Revmatek commented 3 months ago

Is there an existing issue for this?

Have you checked the documentation to resolve your problem?

Current Behavior

When you tick "Enable Shader API" in the main scene, line artifacts can be seen on the horizon underwater through the fog. Sometimes this requires moving the camera around a bit.

Expected Behavior

Enabling the Shader API should not create artifacts.

Steps To Reproduce

1) Open Main.unity 2) Play 3) Go underwater 4) Turn on the shader api 5) Observer artifacts on the horizon (sometimes you have to move the camera around to see them)

image

Unity Version

2021.3.26

Crest Version

4.19

Render Pipeline

Built-In

Editor or Standalone

Editor (Edit Mode), Editor (Play Mode), Standalone

Environment

No response

Anything else?

This issue may be related to: https://github.com/wave-harmonic/crest/issues/1145

daleeidd commented 3 months ago

Looks like this is affected by MSAA. Do you have MSAA enabled?

Revmatek commented 3 months ago

Looks like this is affected by MSAA. Do you have MSAA enabled?

I am not using MSAA currently. However enabling it and enabling the shader API also does not trigger artifacts in my environment. I only saw that in the main scene at the last minute so I have not really investigated.

daleeidd commented 3 months ago

MSAA is active for the Main scene and disabling it removes it. The scene view does not support MSAA so will not exhibit the issue. And MSAA can be difficult to enable sometimes.

Revmatek commented 3 months ago

MSAA is active for the Main scene and disabling it removes it. The scene view does not support MSAA so will not exhibit the issue. And MSAA can be difficult to enable sometimes.

That sounds accurate to me. I am using separate anti-aliasing so it is a non issue. MSAA causes problems with other things that are not related to the ocean shader as well, though I don't remember specific examples. To confirm though, it does happen at runtime, and the artifact line will move as you adjust Depth Fog Density Factor, but only with Enable Shader API on.