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

Nodes: Add Post-Process MaskPassNode #29008

Closed
wants to merge 4 commits into from

Conversation

cmhhelgeson
Copy link
Contributor

@cmhhelgeson cmhhelgeson commented Jul 28, 2024

Related issue: #28962

Description

Add a strictly post-processing masking implementation to Nodes. The example contains the ability to switch between two post-processing outputs, one with regular masks and one with inverse masks.

Issues:

  1. Cannot switch back to regular post processing after switching to inverse mask post processing.
  2. Need to able to call .applyMask() on a base scene pass itself rather than applying it as a texture argument to the function.
  3. Determine whether other mask effects need to be implemented within this class.

Live Example

Copy link

github-actions bot commented Jul 28, 2024

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
684 kB (169.4 kB) 684 kB (169.4 kB) +0 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Filesize dev Filesize PR Diff
460.9 kB (111.2 kB) 460.9 kB (111.2 kB) +0 B

@sunag
Copy link
Collaborator

sunag commented Jul 29, 2024

I'm finding the amount of code for this example a bit unjustified. Could you remove the inverse mask for now, and instead of having a new MaskPassNode just add something like?

const maskPass = ( scene, camera ) => pass( scene, camera ).setMRT( mrt( { output: output.a } ) );

// ...
const sceneMask1 = maskPass( scene1, camera );
const sceneMask2 = maskPass( scene2, camera );

@Mugen87
Copy link
Collaborator

Mugen87 commented Jul 29, 2024

Definitely! I would also favor a solution without the need for a separate module like MaskPassNode.

TBH, I was never a fan of the previous API MaskPass and ClearMaskPass and how it was integrated into the composer.

@sunag sunag closed this in #29016 Jul 29, 2024
@cmhhelgeson cmhhelgeson deleted the webgpu_mask_example branch July 29, 2024 22:08
@Mugen87 Mugen87 added this to the r168 milestone Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants