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

[BREAKING] Remove StandardMaterial.sheenGlossTint #6841

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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