浏览代码

WebGPURenderer: `MeshPhysicalNodeMaterial` - Fix `clearcoatRoughness` (#28507)

* MeshPhysicalNodeMaterial: Fix clearcoatRoughness

* update screenshot
sunag 1 年之前
父节点
当前提交
4c6d0c47a7

+ 1 - 1
examples/jsm/nodes/functions/PhysicalLightingModel.js

@@ -331,7 +331,7 @@ const IBLSheenBRDF = tslFn( ( { normal, viewDir, roughness } ) => {
 } );
 } );
 
 
 const clearcoatF0 = vec3( 0.04 );
 const clearcoatF0 = vec3( 0.04 );
-const clearcoatF90 = vec3( 1 );
+const clearcoatF90 = float( 1 );
 
 
 //
 //
 
 

+ 2 - 1
examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js

@@ -3,6 +3,7 @@ import { transformedClearcoatNormalView } from '../accessors/NormalNode.js';
 import { clearcoat, clearcoatRoughness, sheen, sheenRoughness, iridescence, iridescenceIOR, iridescenceThickness, specularColor, specularF90, diffuseColor, metalness, roughness, anisotropy, alphaT, anisotropyT, anisotropyB, ior, transmission, thickness, attenuationDistance, attenuationColor, dispersion } from '../core/PropertyNode.js';
 import { clearcoat, clearcoatRoughness, sheen, sheenRoughness, iridescence, iridescenceIOR, iridescenceThickness, specularColor, specularF90, diffuseColor, metalness, roughness, anisotropy, alphaT, anisotropyT, anisotropyB, ior, transmission, thickness, attenuationDistance, attenuationColor, dispersion } from '../core/PropertyNode.js';
 import { materialClearcoat, materialClearcoatRoughness, materialClearcoatNormal, materialSheen, materialSheenRoughness, materialIridescence, materialIridescenceIOR, materialIridescenceThickness, materialSpecularIntensity, materialSpecularColor, materialAnisotropy, materialIOR, materialTransmission, materialThickness, materialAttenuationDistance, materialAttenuationColor, materialDispersion } from '../accessors/MaterialNode.js';
 import { materialClearcoat, materialClearcoatRoughness, materialClearcoatNormal, materialSheen, materialSheenRoughness, materialIridescence, materialIridescenceIOR, materialIridescenceThickness, materialSpecularIntensity, materialSpecularColor, materialAnisotropy, materialIOR, materialTransmission, materialThickness, materialAttenuationDistance, materialAttenuationColor, materialDispersion } from '../accessors/MaterialNode.js';
 import { float, vec2, vec3, If } from '../shadernode/ShaderNode.js';
 import { float, vec2, vec3, If } from '../shadernode/ShaderNode.js';
+import getRoughness from '../functions/material/getRoughness.js';
 import { TBNViewMatrix } from '../accessors/AccessorsUtils.js';
 import { TBNViewMatrix } from '../accessors/AccessorsUtils.js';
 import PhysicalLightingModel from '../functions/PhysicalLightingModel.js';
 import PhysicalLightingModel from '../functions/PhysicalLightingModel.js';
 import MeshStandardNodeMaterial from './MeshStandardNodeMaterial.js';
 import MeshStandardNodeMaterial from './MeshStandardNodeMaterial.js';
@@ -112,7 +113,7 @@ class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial {
 			const clearcoatRoughnessNode = this.clearcoatRoughnessNode ? float( this.clearcoatRoughnessNode ) : materialClearcoatRoughness;
 			const clearcoatRoughnessNode = this.clearcoatRoughnessNode ? float( this.clearcoatRoughnessNode ) : materialClearcoatRoughness;
 
 
 			clearcoat.assign( clearcoatNode );
 			clearcoat.assign( clearcoatNode );
-			clearcoatRoughness.assign( clearcoatRoughnessNode );
+			clearcoatRoughness.assign( getRoughness( { roughness: clearcoatRoughnessNode } ) );
 
 
 		}
 		}
 
 

二进制
examples/screenshots/webgpu_clearcoat.jpg


+ 0 - 9
examples/webgpu_clearcoat.html

@@ -24,7 +24,6 @@
 
 
 			import * as THREE from 'three';
 			import * as THREE from 'three';
 
 
-			import WebGPU from 'three/addons/capabilities/WebGPU.js';
 			import WebGPURenderer from 'three/addons/renderers/webgpu/WebGPURenderer.js';
 			import WebGPURenderer from 'three/addons/renderers/webgpu/WebGPURenderer.js';
 
 
 			import Stats from 'three/addons/libs/stats.module.js';
 			import Stats from 'three/addons/libs/stats.module.js';
@@ -45,14 +44,6 @@
 
 
 			function init() {
 			function init() {
 
 
-				if ( WebGPU.isAvailable() === false ) {
-
-					document.body.appendChild( WebGPU.getErrorMessage() );
-
-					throw new Error( 'No WebGPU support' );
-
-				}
-
 				container = document.createElement( 'div' );
 				container = document.createElement( 'div' );
 				document.body.appendChild( container );
 				document.body.appendChild( container );