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

Remove opacityTint internal flag #6812

Merged
merged 1 commit into from
Jul 12, 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
2 changes: 0 additions & 2 deletions src/framework/components/element/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,6 @@ class ElementComponentSystem extends ComponentSystem {
material.emissiveMap = this._defaultTexture;
material.opacityMap = this._defaultTexture;
material.opacityMapChannel = 'a';
material.opacityTint = true;
material.opacity = 0; // use non-1 opacity to compile shader correctly
slimbuck marked this conversation as resolved.
Show resolved Hide resolved
material.useLighting = false;
material.useTonemap = false;
material.useFog = false;
Expand Down
2 changes: 0 additions & 2 deletions src/framework/components/sprite/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ class SpriteComponentSystem extends ComponentSystem {
material.emissiveMap = texture;
material.opacityMap = texture;
material.opacityMapChannel = 'a';
material.opacityTint = true;
material.opacity = 0; // use non-1 opacity to compile shader correctly
material.useLighting = false;
material.useTonemap = false;
material.useFog = false;
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 @@ -184,7 +184,6 @@ class StandardMaterialOptionsBuilder {
}

_updateMinOptions(options, stdMat, pass) {
options.opacityTint = stdMat.blendType !== BLEND_NONE || stdMat.opacityShadowDither !== DITHER_NONE;

// pre-pass uses the same dither setting as forward pass, otherwise shadow dither
const isPrepass = pass === SHADER_PREPASS_VELOCITY;
Expand All @@ -209,7 +208,6 @@ class StandardMaterialOptionsBuilder {

const isPackedNormalMap = stdMat.normalMap ? (stdMat.normalMap.format === PIXELFORMAT_DXT5 || stdMat.normalMap.type === TEXTURETYPE_SWIZZLEGGGR) : false;

options.opacityTint = (stdMat.blendType !== BLEND_NONE || stdMat.alphaTest > 0 || stdMat.opacityDither !== DITHER_NONE) ? 1 : 0;
options.specularTint = specularTint ? 2 : 0;
options.specularityFactorTint = specularityFactorTint ? 1 : 0;
options.metalnessTint = (stdMat.useMetalness && stdMat.metalness < 1) ? 1 : 0;
Expand Down
7 changes: 0 additions & 7 deletions src/scene/materials/standard-material-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,6 @@ class StandardMaterialOptions {
*/
glossTint = false;

/**
* Defines if {@link StandardMaterial#opacity} constant should affect opacity value.
*
* @type {boolean}
*/
opacityTint = false;

emissiveEncoding = 'linear';

lightMapEncoding = 'linear';
Expand Down
8 changes: 1 addition & 7 deletions src/scene/shader-lib/chunks/standard/frag/opacity.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
export default /* glsl */`
#ifdef MAPFLOAT
uniform float material_opacity;
#endif

void getOpacity() {
dAlpha = 1.0;

#ifdef MAPFLOAT
dAlpha *= material_opacity;
#endif
dAlpha = material_opacity;

#ifdef MAPTEXTURE
dAlpha *= texture2DBias($SAMPLER, $UV, textureBias).$CH;
Expand Down