-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebGPURenderer: Introduce NodeMaterialObserver
and updates
#29386
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
I'm still trying to familiarize myself with the deeper workings of the API rather than just adding onto it, but is the monitor meant to simply just analyze whether the node material's properties match the data returned by getXData calls, then setting the needsRefresh flag as needed based on the result of that query? Then, within the main render loop, the nodes and bindings are only ( according to my guess) only updated in 3 scenarios
|
@cmhhelgeson Yes, your analysis is correct :) |
If setupMonitor let's us manipulate the monitor's properties, would it make sense to have one of setupMonitor's arguments be a list of properties that are either included or excluded in the needsRefresh call, essentially making those properties static even if the program itself is not? Or would that not really provide any meaningful performance benefits given the small list of properties? Or maybe it would make sense to add to a monitor's refreshUniforms property as a program is being created so a monitor only deals with uniforms relevant to its sample? Perhaps it doesn't matter either way, since the monitor already seems to ignore properties that aren't there. |
The large list will be ignored in the frame cycle, leaving only the properties present in the material, so we wouldn't need to add many functions here. I think interesting add refreshUniform as a property of the NodeMaterialMonitor, that way users could edit it. The idea of setupMonitor() is to encourage users to extend the NodeMaterialMonitor class and do their own specific optimization. |
This is the first time we have improved performance for many common objects without refraction, as we already had better performance in refraction, now without using special native WebGPU features. |
NodeMaterialMonitor
and updates
|
/cc @0b5vr |
NodeMaterialMonitor
and updatesNodeMaterialObserver
and updates
Or even |
What do you think of In my head material optimizer would enter the compilation process, shaders, etc. The main objective of the class would be to check data changes and release the update of nodes and bindings. |
Some others options could be |
I think NodeMaterialObserver is good. Updater suggests a class that's performing more robust modifications on the materials. |
Awesome!! By the way, @sunag this PR seems to break the WebGL version of |
…29386) * Introduce NodeMaterialMonitor * Update VelocityNode.js * updates * Update webgpu_performance_renderbundle.html * Update Lights.js * updates * rename NodeMaterialMonitor -> NodeMaterialObserver * Update NodeMaterials.js
…29386) * Introduce NodeMaterialMonitor * Update VelocityNode.js * updates * Update webgpu_performance_renderbundle.html * Update Lights.js * updates * rename NodeMaterialMonitor -> NodeMaterialObserver * Update NodeMaterials.js
Related issue: #29077 (comment), #29299
NodeMaterialObserver
is responsible for checking if there are any changes in the materials, and if so, moving forward with the process of updating the nodes and bindings at the GPU level.NodeMaterialObserver
is an intermediate component between node updates that can be extended or manipulated usingNodeMaterial.setupObserver()
.List
NodeMaterialObserver
renderGroup
renderGroup
renderGroup
updateBeforeNodes
andupdateAfterNodes
Lights.js
chainArray
tone mapping exposure
torenderGroup
Performance
webgpu_performance_renderbundle
webgpu_performance
mesh.static = true
+ non-string initial cacheKey in RenderObject - maybe we can some hash algorithm like crc32/64 for comparison in the rendering cycle - not available in this PRmesh.static = true
r168
~299fps