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

Metallic & Specular shader color is black on mobile platform #594

Closed
Kushulain opened this issue Apr 11, 2023 · 1 comment
Closed

Metallic & Specular shader color is black on mobile platform #594

Kushulain opened this issue Apr 11, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@Kushulain
Copy link
Contributor

Kushulain commented Apr 11, 2023

  • Unity 2021.3.1f1
  • built in render pipeline
  • Android platform build settings
  • "ProjectSettings->Graphics->Standard Shader Quality" is set to "low".

Problem:

Metallic & Specular shader appear with a black diffuse color.

Reproduce:

  • Set "ProjectSettings->Graphics->Standard Shader Quality" to "low".
  • Test any 3D model which use metallic or specular setup gltf shader.
  • Color is black

Technical details:

When mobile platform is set in build settings, usually "Standard Shader Quality" is set to "low".
ProjectSettings->Graphics->Standard Shader Quality
It enables UNITY_NO_FULL_STANDARD_SHADER keyword, which makes ForwardSimple shader feature to be use.
So then VertexOutputBaseSimple vertForwardBaseSimple (VertexInput v) is used (glTFUnityStandardCoreForwardSimple.cginc)
But this function has a problem, it set the o.color BEFORE intialize o.color to zero.
Resulting on diffuse color looking black.

Solution:

in the function VertexOutputBaseSimple vertForwardBaseSimple (VertexInput v) inside "glTFUnityStandardCoreForwardSimple.cginc".
move the following code to the end of the function after UNITY_INITIALIZE_OUTPUT(VertexOutputBaseSimple, o);

#ifdef UNITY_COLORSPACE_GAMMA
    o.color.rgb = LinearToGammaSpace(v.color.rgb);
    o.color.a = v.color.a;
#else
    o.color = v.color;
#endif
@Kushulain Kushulain added the bug Something isn't working label Apr 11, 2023
Kushulain added a commit to Kushulain/glTFast that referenced this issue Apr 11, 2023
@Kushulain Kushulain changed the title Metallic & Specular shader color become black on mobile Metallic & Specular shader color become is on mobile platform Apr 11, 2023
@Kushulain Kushulain changed the title Metallic & Specular shader color become is on mobile platform Metallic & Specular shader color is black on mobile platform Apr 11, 2023
dmbond added a commit to dmbond/glTFast that referenced this issue Oct 27, 2023
@atteneder
Copy link
Owner

Fix released in 6.6.0

Thanks!

atteneder added a commit that referenced this issue Jun 25, 2024
…h the built-in render pipeline (#151)

* Fix builtin forward simple shader (fixes #594)
* doc: Added changelog entry.
---------

Co-authored-by: Victor Beaupuy <kushulain@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants