0
Under review
Undeclared identifier 'sceneUVs' - material turns magenta upon opening shader in shader forge
I'm using shader forge 1.38 and unity 2017.1.0f3. Some existing shaders created in a previous version of shader forge generate a console error immediately upon opening them in the latest version and the material turns magenta.
Console reads:
Shader error in 'Shader Forge/waterFog': undeclared identifier 'sceneUVs' at line 93 (on glcore)
Compiling Vertex program with DIRECTIONAL
Platform defines: UNITY_NO_DXT5nm UNITY_ENABLE_REFLECTION_BUFFERS UNITY_NO_CUBEMAP_ARRAY UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME
Customer support service by UserEcho
Do you have a screenshot on the node tree and the lighting settings?
Yeah, there are two shaders so far I've found in my project that have this issue. The one I posted the error for earlier has a lot of nodes and was hard to get it on an image. This one also has the problem but maybe will be easier to diagnose because it's smaller. This one also seems to produce two console errors which I'll paste below the image.
Console error 1:
Shader error in 'Shader Forge/shockWave': undeclared identifier 'sceneUVs' at line 123 (on glcore)
Compiling Vertex program with SHADOWS_DEPTH
Platform defines: UNITY_NO_DXT5nm UNITY_ENABLE_REFLECTION_BUFFERS UNITY_NO_CUBEMAP_ARRAY UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF1 SHADER_API_DESKTOP UNITY_HARDWARE_TIER3
Console error 2:
Shader error in 'Shader Forge/shockWave': undeclared identifier 'sceneUVs' at line 70 (on glcore)
Compiling Vertex program with DIRECTIONAL
Platform defines: UNITY_NO_DXT5nm UNITY_ENABLE_REFLECTION_BUFFERS UNITY_NO_CUBEMAP_ARRAY UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME
What happens if you change the Screen Pos mode from Tiled to Scene UVs?
There's no change. Still magenta, same console errors.
The error has something to do with the screen pos node. I was working on a new shader and got the error as soon as I used the screen pos node. It must be a bit more complicated than that because I'm using the screen pos node in other shaders that can open correctly.
It's likely because it's used in the refraction input in this case. It should work though, so it's a bug
The new shader that I was working on which broke when I attached the screen pos node that I mentioned in my last post was ultimately connected to vertex offset. Just letting you know in case it helps discover the issue.
Hi there ! same error here, dropping a Screen pos. node will make this error on my side as well. Removing the declared sceneUVs inside the shader fix the issue, but I can't have the effect I want anymore. Any workaround ?
Thanks !
After looking at the shader code, it seems that there is a recursive reference needed on the frag block, declaring new variables with some other required, but with other variables requiring variables declared after. I will try to find a way to get around by editing the shader code.
Finally I've fixed it by removing the multiplier on the sceneUVs variable declaration with Refraction (because to have refraction you would need sceneUVs from other variables), and move it up before all other variables declaration that need sceneUVs and it worked like a charm. I won't open this shader with SF anymore !