Is resetting the z-buffer possible, for zany multiple masking effects?


Using full_3d and test_3d is quite intuitive once it clicks. Can we have a reset_3d option too, to clear the depth buffer?

I’d like to use more than one mask - first one masking one set of 3D objects, the second one masking a different set. It’d make for some incredibly cool effects: you could have two portals next to each other, and depending on which you were looking through, the objects behind could be different:

You could do that ole’ portal cube thing; a glass 3D cube in front of you, but depending on which side you’re looking through, it’s a different world inside. Or walk around an object and see different overlays as your view changes.

The way things seem to work: object order in the hierarchy is the order things are rendered in, but the fact 3D objects can be occluded by nearer objects even though they were rendered afterwards suggests there’s a depth / z-buffer being used to keep track of pixel depths.

Can we have a way to reset that please? Then we could have

  • group_a
    — group_a_Square_mask [full_3d]
    — some_3D_stuff [test_3d]
  • a_big_old_plane [reset_3d] <<<< wooo
  • group b
    — group_b_Square_mask [full_3d]
    — some_different_3D_stuff [test_3d]

Once group_a is rendered, we can throw out the depth data so far and just render group_b to the buffer in the same way. Obviously there’s the danger that if we don’t set up our masks correctly the result may not look right - regardless of where the objects in group_b are in 3D space, they’ll get drawn over the top of group_a - but even that could make for interesting overlay effects if done right.

I thought this may be possible already by dropping an overlay layer in between my groups, but it doesn’t seem to work. Or maybe I tried it wrong.

Thoughts? I may not be understanding what’s going on behind the scenes, but if this is possible it would be incredibly powerful…


Found it. This is the kind of thing we could do - the classic “impossible cube” thing: - the first 30 seconds shows it off


So what you want to make is something like The Merge Cube?



Nope - as cool as that is, it’s already very doable with Zap. I’m after something more esoteric/flexible, a way to have groups of 3D objects in my scene masked by group, really. So multiple objects can occupy the same 3D space, but you only see the ones not occluded by a particular mask.

At the moment, any full_3d object in the scene writes to a depth buffer, so if an object later in the hierarchy but behind something already rendered can be occluded/masked properly. It means the order of 3D objects in the hierarchy - the order they get processed and rendered - doesn’t force you to put them (and keep them) in the order they appear visually.

Just want a way to add something to the hierarchy to clear that depth buffer after some of the objects have been rendered, so I can then render - well, “render” to the depth buffer invisibly - a new mask. After that I can have more 3D objects but they’ll now only be occlusion-tested by the new mask and not the old.

I think I’m making this sound too complicated - and I’m basing all this on supposition about how Zap works behind the scenes. It’s the way rendering engines like this work, but that doesn’t mean Zap has that level of control.

If we can reset the buffer we can do all manner of wonderful new things though; it opens a new world of compositing, really


If such functionality exist, I am not aware of. However, I think you could achieve a similar result by adding masks to your scene and moving their nodes in the hierarchy at runtime to change the masking effect.


Thanks marks - I’ve posted a request in the Feature Request forum.

At the moment, even if you reorder nodes at runtime, you can’t ever have multiple masks working on different sets of objects - once the first one’s rendered to the depthBuffer there’s no way to stop it occluding everything that follows in the render order. We can flag a layer to neither test nor fill the depthBuffer, test but not fill, or test and fill - we need a way to fill but not test… that’s the missing layerMode. Fingers crossed … ¯\_(ツ)_/¯