Skip to content

Commit

Permalink
[BREAKING] Remove StandardMaterial.sheenGlossTint (#6841)
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>
  • Loading branch information
mvaligursky and Martin Valigursky authored Jul 23, 2024
1 parent 0ab8933 commit b69b776
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 21 deletions.
8 changes: 3 additions & 5 deletions src/framework/parsers/glb-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -1041,11 +1041,9 @@ const extensionSheen = (data, material, textures) => {
material.sheenEncoding = 'srgb';
extractTextureTransform(data.sheenColorTexture, material, ['sheen']);
}
if (data.hasOwnProperty('sheenRoughnessFactor')) {
material.sheenGloss = data.sheenRoughnessFactor;
} else {
material.sheenGloss = 0.0;
}

material.sheenGloss = data.hasOwnProperty('sheenRoughnessFactor') ? data.sheenRoughnessFactor : 0.0;

if (data.hasOwnProperty('sheenRoughnessTexture')) {
material.sheenGlossMap = textures[data.sheenRoughnessTexture.index];
material.sheenGlossMapChannel = 'a';
Expand Down
2 changes: 0 additions & 2 deletions src/scene/materials/standard-material-options-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,6 @@ class StandardMaterialOptionsBuilder {

options.iridescenceTint = stdMat.iridescence !== 1.0 ? 1 : 0;

options.sheenGlossTint = 1;

options.glossInvert = stdMat.glossInvert;
options.sheenGlossInvert = stdMat.sheenGlossInvert;
options.clearCoatGlossInvert = stdMat.clearCoatGlossInvert;
Expand Down
1 change: 0 additions & 1 deletion src/scene/materials/standard-material-parameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ const standardMaterialParameterTypes = {
sheen: 'rgb',
..._textureParameter('sheen'),
sheenGloss: 'number',
sheenGlossTint: 'boolean',
sheenGlossInvert: 'boolean',
..._textureParameter('sheenGloss'),

Expand Down
7 changes: 1 addition & 6 deletions src/scene/materials/standard-material.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,6 @@ const _tempColor = new Color();
* This color value is a single value between 0 and 1.
* @property {boolean} sheenGlossInvert Invert the sheen gloss component (default is false).
* Enabling this flag results in material treating the sheen gloss members as roughness.
* @property {boolean} sheenGlossTint Multiply sheen glossiness map and/or sheen glossiness vertex
* value by the scalar sheen glossiness value.
* @property {Texture|null} sheenGlossMap The sheen glossiness microstructure color map of the
* material (default is null).
* @property {number} sheenGlossMapUv Sheen map UV channel.
Expand Down Expand Up @@ -720,10 +718,7 @@ class StandardMaterial extends Material {
}

this._setParameter('material_sheen', getUniform('sheen'));

if (!this.sheenGlossMap || this.sheenGlossTint) {
this._setParameter('material_sheenGloss', this.sheenGloss);
}
this._setParameter('material_sheenGloss', this.sheenGloss);

this._setParameter('material_refractionIndex', this.refractionIndex);
} else {
Expand Down
8 changes: 1 addition & 7 deletions src/scene/shader-lib/chunks/standard/frag/sheenGloss.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
export default /* glsl */`
#ifdef MAPFLOAT
uniform float material_sheenGloss;
#endif
void getSheenGlossiness() {
float sheenGlossiness = 1.0;
#ifdef MAPFLOAT
sheenGlossiness *= material_sheenGloss;
#endif
float sheenGlossiness = material_sheenGloss;
#ifdef MAPTEXTURE
sheenGlossiness *= texture2DBias($SAMPLER, $UV, textureBias).$CH;
Expand Down

0 comments on commit b69b776

Please sign in to comment.