Closed Woody4618 closed 1 year ago
Any hint on how I can fix this myself would also be welcome :)
@Woody4618 Thanks for reporting!
I'm having a look, but compiling all shader variants is taking some time :/
@Woody4618 A similar project setup worked for me. I'd need more details:
Ideally a minimal project for reproduction, otherwise:
Thanks
Hello, thank you for investigating!
Following the documentation I added the tracked shaders to always include:
Then I also included the precompiler flag GLTFAST_BUILTIN_SHADER_GRAPH
Sadly it is still not compiling. Thanks again for your help.
Minimal project that shows the errors. Just export to WebGL GtlfTest.zip
@Woody4618 Thanks, I can reproduce. Not sure what to make of it yet. Tend to assume it's a shader graph bug.
@Woody4618 Do you get errors when explicitely build for WebGL 2.0 only (disable Auto API in the build settings)? That's what removed the error in my test right now. WebGL 2.0 has quite good support these days.
This results into the same Error for me sadly. Is there some workaround I could try? Like disable the shadow rendering in the shader graph? It seems the errors all happen in that part. Any other ideas?
I managed to fix it by copying the shader graph in the project and removing the Built-in target from the active targets.
I have a similar problem. Can't compile to WebGL and the above workaround DID work for me. So I guess I am leaving this here as more information about the problem.
Shader error in 'Shader Graphs/glTF-pbrMetallicRoughness': invalid subscript 'sh' at line 19244 (on gles3)
Compiling Subshader: 2, Pass: BuiltIn Forward, Vertex program with DIRECTIONAL LIGHTMAP_ON LIGHTPROBE_SH VERTEXLIGHT_ON _ADDITIONAL_OFF
Platform defines: SHADER_API_DESKTOP UNITY_ENABLE_DETAIL_NORMALMAP UNITY_ENABLE_REFLECTION_BUFFERS UNITY_LIGHTMAP_FULL_HDR UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_PASS_FORWARDBASE UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BLENDING UNITY_SPECCUBE_BOX_PROJECTION UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS
Disabled keywords: DIRLIGHTMAP_COMBINED DYNAMICLIGHTMAP_ON EMISSION FOG_EXP FOG_EXP2 FOG_LINEAR INSTANCING_ON LIGHTMAP_SHADOW_MIXING OCCLUSION SHADER_API_GLES30 SHADOWS_SCREEN SHADOWS_SHADOWMASK TRANSMISSION UNITY_ASTC_NORMALMAP_ENCODING UNITY_COLORSPACE_GAMMA UNITY_ENABLE_NATIVE_SHADOW_LOOKUPS 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 _ADDITIONAL_LIGHTS _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN _SCREEN_SPACE_OCCLUSION _SHADOWS_SOFT _UV_ROTATION
Unity 2021.3.4f1 Gltfast 4.8.2 Platform: WebGL API2 URP: 12.1.7
fyi: I reported it to Unity internally. Let's see.
I also think about removing experimental shader graph BiRP support. It would be cool, but it's not worth this trouble.
fyi: This was fixed in 2023 alpha and will be back-ported to 2022.2 2022.3 and 2021 LTS
From the 2023.1.0 Alpha 5 release log:
Shadergraph: Fixed a compilation bug in BiRP Target in some variants with lightmaps. (UUM-7354)
Update: Backport landed in 2021.3.11f1
Super, thank you for the Update!
Unity 2021.3.11f1 with the fix is released 🎉
'PBRDeferredFragment': cannot convert from 'struct v2f_surf' to 'struct SurfaceDescription' Compiling Subshader: 1, Pass: BuiltIn Deferred, Vertex program with DIRLIGHTMAP_COMBINED LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADOWS_SHADOWMASK _MAIN_LIGHT_SHADOWS_CASCADE _SHADOWS_SOFT Platform defines: SHADER_API_DESKTOP UNITY_ENABLE_DETAIL_NORMALMAP UNITY_ENABLE_REFLECTION_BUFFERS UNITY_LIGHTMAP_FULL_HDR UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_PASS_DEFERRED UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BLENDING UNITY_SPECCUBE_BOX_PROJECTION UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS Disabled keywords: DYNAMICLIGHTMAP_ON INSTANCING_ON LIGHTPROBE_SH SHADER_API_GLES30 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_HDR_ON 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 _EMISSIVE _GBUFFER_NORMALS_OCT _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_SCREEN _MIXED_LIGHTING_SUBTRACTIVE _OCCLUSION _TEXTURE_TRANSFORM _TRANSMISSION
'PBRDeferredFragment': cannot convert from 'struct v2f_surf' to 'struct SurfaceDescription' Compiling Subshader: 1, Pass: BuiltIn Deferred, Vertex program with DIRLIGHTMAP_COMBINED LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADOWS_SHADOWMASK _MAIN_LIGHT_SHADOWS_CASCADE _SHADOWS_SOFT Platform defines: SHADER_API_DESKTOP UNITY_ENABLE_DETAIL_NORMALMAP UNITY_ENABLE_REFLECTION_BUFFERS UNITY_LIGHTMAP_FULL_HDR UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_PASS_DEFERRED UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BLENDING UNITY_SPECCUBE_BOX_PROJECTION UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS Disabled keywords: DYNAMICLIGHTMAP_ON INSTANCING_ON LIGHTPROBE_SH SHADER_API_GLES30 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_HDR_ON 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 _EMISSIVE _GBUFFER_NORMALS_OCT _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_SCREEN _MIXED_LIGHTING_SUBTRACTIVE _OCCLUSION _TEXTURE_TRANSFORM _TRANSMISSION
I have the same problem while build the app Env: Unity-2022.3.19; windows standalone; IL2CPP
I have it on Unity 2021.3.13f1 targeting iOS.
Same issue here : Unity-2022.3.29f1 Unity Built-In RP Lighting settings were with baked with Realtime GI & Baked GI on, using progressive CPU lightmapper. This issue does not happen if baked GI is off. Shaders made with Shadergraph (multiple shaders, same issue)
Setting baked GI triggers the error and makes the output pink (invalid shader kind of pink), clearing GI data fixes the issue. Opaque shader, switching to Transparent seems to fix the issue but causes flickering. Setting the shader's renderQueue to 3000 fixes the issue but causes flickering. Lit shader, setting the shader to Unlit fixes the issue. The aformentioned flickering only happens in Play mode, the Scene mode camera doesn't have that visual glitch, I don't know if this issue also happens on build.
@ssmore101 @vitosbat @jquentin-lion @SebPautot : Thanks for reporting. However, I don't see how your issue links to the original, solved problem. In case of doubt, open new, dedicated issue please.
In case you haven't already: Let me know
@SebPautot are you using the glTFast shader graphs with the Built-in render pipeline? Because usually just regular shaders are used for built-in.
Thanks.
Describe the bug I am using unity version 2021.3.2f with URP version 12.1.6. In the editor everything works fine, but when it try to export to WebGL im getting following 3 errors:
Shader error in 'Shader Graphs/glTF-pbrMetallicRoughness': 'SAMPLE_DEPTH_TEXTURE': Too few arguments to a macro call. at /Applications/Unity/Hub/Editor/2021.3.2f1/Unity.app/Contents/CGIncludes/UnityShadowLibrary.cginc(48)
Shader error in 'Shader Graphs/glTF-pbrMetallicRoughness': undeclared identifier 'SAMPLE_DEPTH_TEXTURE_PROJ' at /Applications/Unity/Hub/Editor/2021.3.2f1/Unity.app/Contents/CGIncludes/UnityShadowLibrary.cginc(79) (on gles)
Shader error in 'Shader Graphs/glTF-pbrMetallicRoughness': invalid subscript 'vec' at /Users/jonasmac2/Documents/GitHub/solhunter/Library/PackageCache/com.unity.shadergraph@12.1.6/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Includes/ShadowCasterPass.hlsl(15) (on gles)
Files DummyTomatoForShaderVariants.glb.zip
To Reproduce Steps to reproduce the behavior:
Expected behavior The shader works in editor and WebGL export.
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
additionally (if significant for the bug):
Additional context Add any other context about the problem here.