Browse Source

WebGPURenderer: Override alpha channel to 1 for opaque materials (#28646)

* override diffuse.a to opaque material

* add blending and alpha condition
Renaud Rohlinger 1 năm trước cách đây
mục cha
commit
6c8ff24fac
1 tập tin đã thay đổi với 7 bổ sung1 xóa
  1. 7 1
      examples/jsm/nodes/materials/NodeMaterial.js

+ 7 - 1
examples/jsm/nodes/materials/NodeMaterial.js

@@ -1,4 +1,4 @@
-import { Material } from 'three';
+import { Material, NormalBlending } from 'three';
 import { getNodeChildren, getCacheKey } from '../core/NodeUtils.js';
 import { attribute } from '../core/AttributeNode.js';
 import { output, diffuseColor, varyingProperty } from '../core/PropertyNode.js';
@@ -294,6 +294,12 @@ class NodeMaterial extends Material {
 
 		}
 
+		if ( this.transparent === false && this.blending === NormalBlending && this.alphaToCoverage === false ) {
+
+			diffuseColor.a.assign( 1.0 );
+
+		}
+
 	}
 
 	setupVariants( /*builder*/ ) {