Browse Source

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

sunag 1 year ago
parent
commit
a9c5a7dbb6
1 changed files with 5 additions and 1 deletions
  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