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

Handle the alpha component of specular-glossiness textures #9943

Merged
merged 2 commits into from
Nov 29, 2021

Conversation

ptrgags
Copy link
Contributor

@ptrgags ptrgags commented Nov 29, 2021

Fixes #9928

KHR_materials_pbrSpecularGlossiness has a diffuse texture with an alpha component. This alpha value should be used when rendering the model. See diffuseTexture in the spec

since specular glossiness takes higher priority over metallic roughness (see the table in this section of the spec), this alpha value should override anything that came before it in the shader.

the CesiumJS implementation in processPbrMaterials was not doing this. diffuse.rgb was used for PBR lighting, but diffuse.a was unused. ModelExperimental was based on that file, so it also had the same problem. Fortunately, each case required only 1 line of GLSL to fix!

@ebogo1 could you review?

@ptrgags ptrgags requested a review from ebogo1 November 29, 2021 16:26
@cesium-concierge
Copy link

Thanks for the pull request @ptrgags!

  • ✔️ Signed CLA found.
  • CHANGES.md was not updated.
    • If this change updates the public API in any way, please add a bullet point to CHANGES.md.
  • ❔ Unit tests were not updated.
    • Make sure you've updated tests to reflect your changes, added tests for any new code, and ran the code coverage tool.

Reviewers, don't forget to make sure that:

  • Cesium Viewer works.
  • Works in 2D/CV.

@ebogo1
Copy link
Contributor

ebogo1 commented Nov 29, 2021

Thanks @ptrgags! This fixes the issue for me locally both in Model and ModelExperimental. I confirmed that tests pass locally too just in case.

@ebogo1 ebogo1 merged commit 882b85c into main Nov 29, 2021
@ebogo1 ebogo1 deleted the specular-glossy-alpha branch November 29, 2021 19:43
ebogo1 added a commit that referenced this pull request Nov 29, 2021
@ebogo1
Copy link
Contributor

ebogo1 commented Nov 29, 2021

My mistake - I forgot about the CHANGES.md entry for this PR. I pushed a new entry to main in 14aa190.

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

Successfully merging this pull request may close these issues.

I load a model(gltf,glb), but the display is wrong
3 participants