Make NoBlending blending affect only the desired layer

Sorry, I was refactoring my code and didn’t have a visual.

I’m working on camera filters, and this is my setup:

  • I have a plane with my camera feed as a texture
  • A GLB is placed in front of the plane, that acts as the filter
  • The red that you see is the background of my <div/> that holds the renderer. (There is a material with NoBlending that lets you see thru, more than what I want tho)

I’m using the NoBlending material with the shape of a head, to occlude the rings behind my head, but it is also occluding the plan that is behind, and I don’t want to occlude the plane, just the rings.

I thought that if I rendered first the layer that has the plane, and then render the layer that has the filter it would work, but it is still occluding the plane, even tho each layer is rendered on its own.

Layer 0 = Camera Feed Plane
Layer 1 = GLB with occlusion

It seems that when I render the 2nd layer on top of the 1st one, it just deletes the pixels where there is NoBlending, instead of just placing “transparent” pixels.

As for your comment:

Also I notice you’re not setting the layer on camera?

I meant to write “camera” not “object”.

camera.layers.disable(1);
camera.layers.enable(0);
renderer.render(scene,camera);
camera.layers.disable(0);
camera.layers.enable(1);
renderer.render(scene,camera);