浏览代码

NodeMaterial: Force unsigned float in basic output (#27915)

sunag 1 年之前
父节点
当前提交
a9c5a7dbb6
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      examples/jsm/nodes/materials/NodeMaterial.js

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

@@ -107,7 +107,11 @@ class NodeMaterial extends ShaderMaterial {
 
 			if ( clippingNode !== null ) builder.stack.add( clippingNode );
 
-			resultNode = this.setupOutput( builder, vec4( outgoingLightNode, diffuseColor.a ) );
+			// force unsigned floats - useful for RenderTargets
+
+			const basicOutput = vec4( outgoingLightNode, diffuseColor.a ).max( 0 );
+
+			resultNode = this.setupOutput( builder, basicOutput );
 
 			// OUTPUT NODE