[SOLVED] PlayCanvas stencil buffer

Hi there!

I’ve a question about the stencil buffer in general. PC provides a good excample but i would have to extend it.

The stencil buffer should act like a portal and an 3d object needs to move out of it. So the thing is, that a stencil buffer only maskes / renders 3d objects / elements whithin its space or lets say simplified: behind it / if its covered. So right now when they move in front of the masking object / plane, they’re not rendered (which makes sense).

Now i searching for a solution / idea to render it, when it comes (basically is in front) of the masking object but also should not visible if youre having a side perspective on the 3d element moving though. Ive attached an image to make this more clear.

Here is the goal how it should behave (i tried to visualize it 3dimensional. red is behind the portal, green is in front of it, yellow is the portal surface):
goal

  • if behind / inside / covered by the “portal” (red area) the 3d object should be masked (which is working)
  • when in front of the “portal” (green area) it should be rendered normally.
  • the pink dotted line represents the movement of the 3d object

Here is how it behaves at the moment:
current behaviour

  • right now it is only rendered inside the “portal” (red area)
  • if moving it out the “portal” it isnt rendered, which makes sense (green area)

Thanks for your ideas / inputs!

Found a workaround to achieve the result i need - thx anyway :slight_smile:

1 Like