Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small error in UnityToonBody.HLSL for editors>= 202310 #124

Open
famousclark opened this issue Aug 12, 2023 · 0 comments
Open

Small error in UnityToonBody.HLSL for editors>= 202310 #124

famousclark opened this issue Aug 12, 2023 · 0 comments

Comments

@famousclark
Copy link

Describe the bug
A small error in Unity versions >= 202310, that causes materials with the shader to go pink.
below is the error spot and the small fix. (OUTPUT_SH should be OUTPUT_SH4 if editor version is >= 202310)
Love the shader and just wanted to helpful to other users of it

Error in code

#if UNITY_VERSION >= 202310
                OUTPUT_SH(positionWS, o.normalDir.xyz, GetWorldSpaceNormalizeViewDir(positionWS), o.vertexSH);
#else
                OUTPUT_SH(o.normalDir.xyz, o.vertexSH);
#endif

#if defined(_ADDITIONAL_LIGHTS_VERTEX) ||  (VERSION_LOWER(12, 0))  
            o.fogFactorAndVertexLight = half4(fogFactor, vertexLight);
#else
            o.fogFactor = fogFactor;
#endif 

Fixed Code

#if UNITY_VERSION >= 202310
                OUTPUT_SH4(positionWS, o.normalDir.xyz, GetWorldSpaceNormalizeViewDir(positionWS), o.vertexSH);
#else
                OUTPUT_SH(o.normalDir.xyz, o.vertexSH);
#endif

#if defined(_ADDITIONAL_LIGHTS_VERTEX) ||  (VERSION_LOWER(12, 0))  
            o.fogFactorAndVertexLight = half4(fogFactor, vertexLight);
#else
            o.fogFactor = fogFactor;
#endif 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant