first pass at occlusion in gpurenderer
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?
@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 :-)
📦 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 |
@sunag @Mugen87 Any idea why applying the masknode to each material only works for some objects?
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.
I'm working on a
NodeHandlerto handle this with this kind of replacement, I thinkrenderer.applyOcclusion()should be replaced with something more targeted at replacement at render time.
How can I do that?
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.
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?
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.
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?
this doesn't seem to be a problem with the maskNode input as tests have shown, but if it is we can fix it.