Skip to content

Commit

Permalink
fix (1.0, mtoon): fix alphaTest issue
Browse files Browse the repository at this point in the history
  • Loading branch information
0b5vr committed Oct 20, 2021
1 parent 6809d3d commit cb86020
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/three-vrm-materials-mtoon/src/MToonMaterial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import type { MToonMaterialParameters } from './MToonMaterialParameters';
export class MToonMaterial extends THREE.ShaderMaterial {
public uniforms: {
litFactor: THREE.IUniform<THREE.Color>;
alphaTest: THREE.IUniform<number>;
opacity: THREE.IUniform<number>;
map: THREE.IUniform<THREE.Texture | null>;
mapUvTransform: THREE.IUniform<THREE.Matrix3>;
Expand Down Expand Up @@ -431,6 +432,13 @@ export class MToonMaterial extends THREE.ShaderMaterial {
);
this._updateTextureMatrix(this.uniforms.uvAnimationMaskTexture, this.uniforms.uvAnimationMaskTextureUvTransform);

// COMPAT workaround: starting from r132, alphaTest becomes a uniform instead of preprocessor value
const threeRevision = parseInt(THREE.REVISION, 10);

if (threeRevision >= 132) {
this.uniforms.alphaTest.value = this.alphaTest;
}

this.uniformsNeedUpdate = true;
}

Expand Down

0 comments on commit cb86020

Please sign in to comment.