-
-
Notifications
You must be signed in to change notification settings - Fork 36k
Closed
Closed
Copy link
Description
Description
Creating a regular MeshPhysicalMaterial is 10x slower in WebGPURenderer compared to WebGLRenderer. The WebGL backend shows the same slowness.
From doing a performance trace, it looks like long chains of "getNodeType" happen on every creation, even for the same material parameters. Maybe something is not/incorrectly cached?
I do understand creating a material every frame is not something one should do; nonetheless, I believe it shouldn't be 10x slower.
Reproduction steps
- Run the attached fiddle
- Switch from "WebGPU" to "WebGL"
- Note performance improves 10x
Code
const material = new THREE.MeshPhysicalMaterial({
color: new THREE.Color().setHSL(Math.random(), 0.7, 0.5),
roughness: Math.random() * 0.5 + 0.25,
metalness: Math.random() * 0.5,
transparent: true,
clearcoat: 1.0,
transmission: 1.0,
opacity: 0.8,
});
Live example
Screenshots
No response
Version
r179
Related:
bhouston and shotamatsuda