Renderer: Add NodeMaterial rebuild debug reporting#33311
Renderer: Add NodeMaterial rebuild debug reporting#33311RenaudRohlinger wants to merge 18 commits intomrdoob:devfrom
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
d794fad to
6b4d65d
Compare
|
Do you think we can move it to the Inspector as a new tab or extension? |
|
A new tab could definitely use it yes, but I don't think the inspector should own the feature. Or maybe the same logic as the checkbox options such as forceWebGL? |
Hmm.. Why do you think that? The first impression I had was that it would be an inspection tool; a UI that would accompany any example, without needing to be recreated, would be useful. Another thing I would suggest in this regard is, let’s say you add an option in the I’ve been adding, through the inspector, this monkey patching to prevent complex debugging code from becoming incompatible with tree-shaking, a technique similar to what the WebGL Dev Extension does. |

This adds a renderer debug path to trace when a NodeMaterial needs rebuild and why. Today it can be very hard to
understand why a material suddenly rebuilds after a scene or material change, even though that rebuild is one of the
most expensive operations in the renderer.
With this change,
renderer.debugcan report the material name or type, the cache contributor that changed, and readable before/after values, including scene-driven causes such as light setup changes.A small WebGPU example is included to demonstrate the feature visually, making rebuilds much easier to track and optimize:

This contribution is funded by Spawn