wave-harmonic / crest

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

Shader broken on 2022.2.4 on Metal #1105

Closed wilg closed 1 year ago

wilg commented 1 year ago

Is there an existing issue for this?

Have you checked the documentation to resolve your problem?

Current Behavior

The ocean shader flickers in all kinds of erratic ways. Works fine on 2021.3

Screenshot 2023-01-30 at 10 17 38 PM

Expected Behavior

No response

Steps To Reproduce

No response

Unity Version

2022.2.4f1

Crest Version

4.16

Render Pipeline

High Definition

Editor or Standalone

Editor (Edit Mode), Editor (Play Mode)

Environment

- OS: 13.2 (22D49)
- GPU: Apple M1 Max
- Graphics API: Metal
- Target Platform: macOS

Anything else?

No response

daleeidd commented 1 year ago

Very strange. I couldn't reproduce on Mac Mini M1. Is your graphics API set to Metal? Is it reproducible in the main example scene?

wilg commented 1 year ago

Yes, the API is Metal. Looks like it doesn't happen in the preview scene. Investigating what might be up with my busted scene...

Also noticed this when trying to reimport Crest:

Shader error in 'Hidden/Crest/Simulation/Update Shadow': undeclared identifier 'GetFullScreenTriangleVertexPosition' at Assets/Crest/Crest/Shaders/ShaderLibrary/UpdateShadow.hlsl(44) (on metal)

Compiling Subshader: 0, Pass: <Unnamed Pass 0>, Vertex program with <no keywords>
Platform defines: SHADER_API_DESKTOP UNITY_ENABLE_DETAIL_NORMALMAP UNITY_ENABLE_REFLECTION_BUFFERS UNITY_LIGHTMAP_FULL_HDR UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BLENDING UNITY_SPECCUBE_BOX_PROJECTION UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS
Disabled keywords: SHADER_API_GLES30 SHADOWS_SINGLE_CASCADE SHADOWS_SPLIT_SPHERES UNITY_ASTC_NORMALMAP_ENCODING UNITY_COLORSPACE_GAMMA UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_HARDWARE_TIER3 UNITY_LIGHTMAP_DLDR_ENCODING UNITY_LIGHTMAP_RGBM_ENCODING UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_NO_DXT5nm UNITY_NO_FULL_STANDARD_SHADER UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 UNITY_PBS_USE_BRDF3 UNITY_PRETRANSFORM_TO_DISPLAY_ORIENTATION UNITY_UNIFIED_SHADER_PRECISION_MODEL UNITY_VIRTUAL_TEXTURING
daleeidd commented 1 year ago

You can delete that file as it is for the built-in renderer.

It smells of a Unity bug. It will likely have something to do with a probe, light or camera. Or perhaps even a volume.

wilg commented 1 year ago

I found the culprit – I was using a copy of the Ocean material to tinker with some settings (I don't remember what.). Somehow that material was busted. I switched to the included material and it worked fine. Not sure what the deal is or how to figure out what the bug was!

daleeidd commented 1 year ago

No worries. I'll leave this open in case someone else has the same problem.