first pass at occlusion in gpurenderer by cabanier · Pull Request #31207 · mrdoob/three.js · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

first pass at occlusion in gpurenderer #31207

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

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

cabanier
Copy link
Contributor

This implements per pixel occlusion by updating the shader of each renderer object.

@sunag , even though I apply the masknode to each element in the scene, it seems to apply only to some of the elements in the scene. If I recreate the material with masknode (instead of just assigning the node), it seems to work.

Am I doing something wrong?

@cabanier
Copy link
Contributor Author

@mrdoob instead of copying the depth like we did previously, we now depth text for each render pixel.
I'm hoping to use the view/projection matrices in effect of the capture of the depth texture for better occlusion alignment. I have not figured out how to do that yet :-)

Copy link

github-actions bot commented May 30, 2025

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 337.4
78.67
337.4
78.67
+0 B
+0 B
WebGPU 553.64
153.44
555.1
153.85
+1.46 kB
+411 B
WebGPU Nodes 552.99
153.28
554.45
153.69
+1.46 kB
+411 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 468.59
113.32
468.59
113.32
+0 B
+0 B
WebGPU 628.59
170.16
630.03
170.55
+1.44 kB
+396 B
WebGPU Nodes 583.45
159.5
584.88
159.9
+1.44 kB
+397 B

@cabanier
Copy link
Contributor Author

cabanier commented Jun 2, 2025

@sunag @Mugen87 Any idea why applying the masknode to each material only works for some objects?

@sunag
Copy link
Collaborator

sunag commented Jun 2, 2025

I'm working on a NodeHandler to handle this with this kind of replacement, I think renderer.applyOcclusion() should be replaced with something more targeted at replacement at render time.

@cabanier
Copy link
Contributor Author

cabanier commented Jun 2, 2025

I'm working on a NodeHandler to handle this with this kind of replacement, I think renderer.applyOcclusion() should be replaced with something more targeted at replacement at render time.

How can I do that?

@sunag
Copy link
Collaborator

sunag commented Jun 4, 2025

How can I do that?

I'm developing this new feature.

Have you tried replacing for testes your code renderer.xr.applyOcclusion() with?

scene.traverse( ( object ) => {

	if ( object.material ) {

		object.material.maskNode = false;

	}

} );

It seems to disappear(apply) all objects.

@cabanier
Copy link
Contributor Author

cabanier commented Jun 4, 2025

Have you tried replacing for testes your code renderer.xr.applyOcclusion() with?

scene.traverse( ( object ) => {

	if ( object.material ) {

		object.material.maskNode = false;

	}

} );

It seems to disappear(apply) all objects.

Isn't that expected? Or are you saying that the current code disappears all objects?

@sunag
Copy link
Collaborator

sunag commented Jun 4, 2025

Isn't that expected? Or are you saying that the current code disappears all objects?

Yes, works as expected, just answering the previous question about: masknode only works for some objects. The problem is probably related to something else.

@cabanier
Copy link
Contributor Author

Isn't that expected? Or are you saying that the current code disappears all objects?

Yes, works as expected, just answering the previous question about: masknode only works for some objects. The problem is probably related to something else.

was this problem fixed or do I need to open an issue?

@sunag
Copy link
Collaborator

sunag commented Jun 25, 2025

this doesn't seem to be a problem with the maskNode input as tests have shown, but if it is we can fix it.

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.

2 participants

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.