-
-
Notifications
You must be signed in to change notification settings - Fork 35.6k
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: implement ClippingGroup object #28237
Conversation
685c11a
to
05303c3
Compare
05303c3
to
fc32176
Compare
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
ad9ee35
to
5ea08b1
Compare
When I read the code correctly, this PR removes Is it also possible to remove the support for |
@Mugen87 I have already removed material clipping planes in my copy. I'll push it here soon. It gets simplifies the Renderer somewhat. |
bfaed52
to
266a2ef
Compare
ClippingGroup() can now replicate the functionality of the existing API without the problems encountered with postprocessing passes etc #28838, the existing example has been updated to use this. The only clipping property now on the material object is 'alphaToCoverage' which is common to other materials. the planes used for union testing and intersection testing are accumulated separately when inherited. @sunag To retain the current behaviour where changing 'alphaToCoverage' results in a material rebuild, I have added boolean properties to the RenderObject.getMaterialCacheKey(), I don't know if this is the correct solution here? |
984a1b7
to
c4492a3
Compare
I'll check this weekend, sorry for the delay. |
The question is redundant now, fixed by a upstream PR from @Mugen87 |
Replace renderer and material clipping planes with nestable clipping groups
c4492a3
to
bcb00f9
Compare
@aardgoose Do you have the resources to rebase the PR? If not, I'm going to give it a try in the upcoming days. We really should merge the PR asap to eventually fix global clipping planes. The implementation can still be refactored after the merge if required. |
Yes, I'll take a look, then I can revisit hardware clipping which is apparently coming in WebGPU in the next chrome version. |
Great! Can't wait to have access to |
Add missing `clippingContext`.
Add default parameter to renderObject().
|
||
} | ||
|
||
} | ||
|
||
} | ||
|
||
renderObject( object, scene, camera, geometry, material, group, lightsNode, passId = null ) { | ||
renderObject( object, scene, camera, geometry, material, group, lightsNode, clippingContext = null, passId = null ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LensflareMesh
directly calls renderObject()
and can't access clippingContext
meaning it can't pass it to renderObject()
. I've fixed the resulting runtime error by defining a default parameter.
If we add clippingContext
to onBeforeRender()
, we could ensure lensflares support clipping as well. Alternatively, we could also use the "current clipping context" for nested renderings if it isn't overwritten with a parameter when calling renderObject()
.
Revert changes to build files.
Fixed #28838.
As suggested in original renderer
three.js/src/renderers/WebGLRenderer.js
Line 1777 in aedb9c7
Adds support for ClippingGroup objects. Clipping planes are additive with nested groups as demonstrated in example.