wave-harmonic / crest

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

Some shader incompatibility with URP 10 #667

Closed fi4sk0 closed 3 years ago

fi4sk0 commented 4 years ago

Describe the bug Crest doesn't compile with URP 10

Screenshots / video n/a

Log

Shader error in 'Crest/Ocean URP': l-value specifies const object at Assets/Crest/Crest/Shaders/OceanReflection.hlsl(92) (on metal)
Shader error in 'Crest/Framework': invalid subscript 'NormalTS' at Test/Library/PackageCache/com.unity.render-pipelines.universal@10.0.0-preview.26/Editor/ShaderGraph/Includes/PBRForwardPass.hlsl(10) (on metal)
Shader error in 'Crest/Framework': invalid subscript 'Position' at Test/Library/PackageCache/com.unity.render-pipelines.universal@10.0.0-preview.26/Editor/ShaderGraph/Includes/Varyings.hlsl(19) (on metal)

Versions Crest URP 4.5 URP 10.0.0-preview.26 which ships with Editor 2020.2.0b6

To Reproduce Create a new URP project from Unity Hub with Editor 2020.2.0b6 and import 4.5 from the package manager

Platform Tested on macOS 10.15.6 (but probably not related to that)

Hardware (probably not related to hardware)

Additional context n/a

daleeidd commented 4 years ago

Thanks. This is just the shader graph shader. It can be deleted if you don't use it. We cannot fully support preview packages.

But this will be an upcoming issue that is worth talking about. Unity did tell me that there is some upcoming changes to shader graph which breaks our generated shader.

daleeidd commented 3 years ago

Sorry... just realised that is incorrect. The first error is indeed for the handwritten shader. Will have it fixed for next release.

In the OceanReflection.hlsl file, change the following lines:

BRDFData brdfData;
// TODO pull in code for specular highlight
InitializeBRDFData(0.0, 0.0, 1.0, smoothness, 1.0, brdfData);

to the following:

half alpha = 1.0;
BRDFData brdfData;
// TODO pull in code for specular highlight
InitializeBRDFData(0.0, 0.0, 1.0, smoothness, alpha, brdfData);

Fix will be out for Crest 4.7. Should also have the shader graph shader fixed.

daleeidd commented 3 years ago

4.7 is out so this one can be closed.