URGENT: Masking 3D shapes

Garrett's icon

Hi

In the patch below is exactly what I want to achieve visually - a videoplane used to partially mask 3D objects without obscuring the background. Unfortunately in the patch I'm developing the sphere (used in the demo below) isn't a gridshape it's in a matrix which is rendered directly to jit.gl.renderer so I can't use depth_enable to achieve this effect.

Is there someway I can mask the matrix 3D object? I've tried:

1) using depth_enable on jit.gl.renderer - seems to not be the same effect.
2) rendering the matrix 3D object to a jit.gl.mesh first - it's looks different (is there another object I can use that will make it look the same as a direct render to jit.gl.renderer? - this would be ideal if I could get it to look the same).

Could the matrix itself be sliced to simulate the masking? At worst could I texture the videoplane, then rotate it along the x axis and scale it so it fit perfectly in front of the background?

Or is there a simpler way to do this that I've overlooked?

Max Patch
Copy patch and select New From Clipboard in Max.

thanks in advance
Garrett

Rob Ramirez's icon

you should use gl.mesh for this.
post a patch demonstrating your use of gl.mesh vs gl.render, and we might be able to offer suggestions on why they look different.

Garrett's icon

Hi Rob

Thanks for the reply. Here's a comparison patch as requested. I agree mesh is the best solution - just don't know why it looks different. Any suggestions greatly appreciated.

Max Patch
Copy patch and select New From Clipboard in Max.

thanks
Garrett

Rob Ramirez's icon

throw a jit.transpose right after p plane-to-sphere, and set the gl.mesh @color to 1 1 1 1.

the jit.transpose will handle the functionality of the gl.render @geom_rows attribute that is missing in gl.mesh.

Garrett's icon

ahhhhh fantastic yes that works. I forgot to put color in the gl statement in the example but I wasn't worried about that. So if I understand correctly rows become columns in mesh and if they are not reversed in advance it looks odd.

Thanks very much Rob.

Garrett