Skip to content
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: support clipping #27691

Merged
merged 14 commits into from
Feb 9, 2024
Merged

Conversation

aardgoose
Copy link
Contributor

Supports global and material bases clipping.

Notes:

This can be extended to support a ClippingGroup() as mentioned at:

// we might want to call this function with some ClippingGroup
// object instead of the material, once it becomes feasible
// (#8465, #8379)
clipping.setState( material, camera, useCache );

Fixes shadow handling of shadow side.

Added support for uniform arrays for vec4 only. Is this method ok or is a full set of ArrayUniform and ArrayNodeUniform classes prefered?

@aardgoose aardgoose marked this pull request as ready for review February 6, 2024 09:32
@LeviPesin
Copy link
Contributor

Added support for uniform arrays for vec4 only. Is this method ok or is a full set of ArrayUniform and ArrayNodeUniform classes prefered?

I guess we should support arbitrary types.

@aardgoose
Copy link
Contributor Author

Added support for uniform arrays for vec4 only. Is this method ok or is a full set of ArrayUniform and ArrayNodeUniform classes prefered?

I guess we should support arbitrary types.

I was wondering what method to use as opposed to which types. This approach just detects an array 'value' in the Uniform code and UniformGroups then handles arrays as part of the existing path. Or should NodeBuilder allocate a 'Vec{n}ArrayNodeUniform' etc which requires more boilerplate classes. There is an ArrayUniformNode too, but that doesn't appear to be used anywhere yet, and this works with a standard uniform() node.

@sunag sunag added this to the r162 milestone Feb 6, 2024
@sunag
Copy link
Collaborator

sunag commented Feb 6, 2024

There is an ArrayUniformNode too, but that doesn't appear to be used anywhere yet, and this works with a standard uniform() node.

ArrayUniformNode was initially implemented here ( #22497 ) but there is no related example anymore. I was also implementing array logic for floats, we will certainly help each other with that.

@sunag
Copy link
Collaborator

sunag commented Feb 8, 2024

Maybe we need to add webgpu_clipping example in puppeteer too?

@aardgoose
Copy link
Contributor Author

This now uses uniforms().

I'm not sure what is going on with the screen shot failure. The major area of difference is the bottom edge which isn't subject to clipping.

@aardgoose
Copy link
Contributor Author

We commented at the same time.
I'll exclude it from the tests.

@sunag sunag merged commit 158d8a1 into mrdoob:dev Feb 9, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants