Skip to content

Commit

Permalink
Fix bugs related to KHR_materials_specular
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeshurun Hembd committed May 29, 2024
1 parent de8f670 commit d6db006
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/engine/Source/Scene/GltfLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -1543,9 +1543,9 @@ function loadMetallicRoughness(loader, metallicRoughnessInfo, frameState) {

function loadSpecular(loader, specularInfo, frameState) {
const {
specularFactor = Specular.DEFAULT_SPECULAR_FACTOR,
specularFactor,
specularTexture,
specularColorFactor = Specular.DEFAULT_SPECULAR_COLOR_FACTOR,
specularColorFactor,
specularColorTexture,
} = specularInfo;

Expand Down Expand Up @@ -1616,7 +1616,7 @@ function loadMaterial(loader, gltfMaterial, frameState) {
pbrSpecularGlossiness,
frameState
);
} else if (!material.unlit) {
} else {
if (defined(pbrMetallicRoughness)) {
material.metallicRoughness = loadMetallicRoughness(
loader,
Expand Down
3 changes: 2 additions & 1 deletion packages/engine/Source/Shaders/Model/MaterialStageFS.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,8 @@ void setSpecular(inout czm_modelMaterial material, in float metalness)
#ifdef HAS_SPECULAR_COLOR_TEXTURE_TRANSFORM
specularColorTexCoords = computeTextureTransform(specularColorTexCoords, u_specularColorTextureTransform);
#endif
vec3 specularColorFactor = texture(u_specularColorTexture, specularColorTexCoords).rgb;
vec3 specularColorSample = texture(u_specularColorTexture, specularColorTexCoords).rgb;
vec3 specularColorFactor = czm_srgbToLinear(specularColorSample);
#ifdef HAS_SPECULAR_COLOR_FACTOR
specularColorFactor *= u_specularColorFactor;
#endif
Expand Down

0 comments on commit d6db006

Please sign in to comment.