|
@@ -12,7 +12,7 @@ import { materialReference } from '../../nodes/accessors/MaterialReferenceNode.j
|
|
|
import { positionLocal, positionView } from '../../nodes/accessors/Position.js';
|
|
import { positionLocal, positionView } from '../../nodes/accessors/Position.js';
|
|
|
import { skinning } from '../../nodes/accessors/SkinningNode.js';
|
|
import { skinning } from '../../nodes/accessors/SkinningNode.js';
|
|
|
import { morphReference } from '../../nodes/accessors/MorphNode.js';
|
|
import { morphReference } from '../../nodes/accessors/MorphNode.js';
|
|
|
-import { mix } from '../../nodes/math/MathNode.js';
|
|
|
|
|
|
|
+import { fwidth, mix, smoothstep } from '../../nodes/math/MathNode.js';
|
|
|
import { float, vec3, vec4, bool } from '../../nodes/tsl/TSLBase.js';
|
|
import { float, vec3, vec4, bool } from '../../nodes/tsl/TSLBase.js';
|
|
|
import AONode from '../../nodes/lighting/AONode.js';
|
|
import AONode from '../../nodes/lighting/AONode.js';
|
|
|
import { lightingContext } from '../../nodes/lighting/LightingContextNode.js';
|
|
import { lightingContext } from '../../nodes/lighting/LightingContextNode.js';
|
|
@@ -843,7 +843,16 @@ class NodeMaterial extends Material {
|
|
|
|
|
|
|
|
alphaTestNode = this.alphaTestNode !== null ? float( this.alphaTestNode ) : materialAlphaTest;
|
|
alphaTestNode = this.alphaTestNode !== null ? float( this.alphaTestNode ) : materialAlphaTest;
|
|
|
|
|
|
|
|
- diffuseColor.a.lessThanEqual( alphaTestNode ).discard();
|
|
|
|
|
|
|
+ if ( this.alphaToCoverage === true ) {
|
|
|
|
|
+
|
|
|
|
|
+ diffuseColor.a = smoothstep( alphaTestNode, alphaTestNode.add( fwidth( diffuseColor.a ) ), diffuseColor.a );
|
|
|
|
|
+ diffuseColor.a.lessThanEqual( 0 ).discard();
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+
|
|
|
|
|
+ diffuseColor.a.lessThanEqual( alphaTestNode ).discard();
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -863,10 +872,6 @@ class NodeMaterial extends Material {
|
|
|
|
|
|
|
|
diffuseColor.a.assign( 1.0 );
|
|
diffuseColor.a.assign( 1.0 );
|
|
|
|
|
|
|
|
- } else if ( alphaTestNode === null ) {
|
|
|
|
|
-
|
|
|
|
|
- diffuseColor.a.lessThanEqual( 0 ).discard();
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|