can you achieve transparency in 3D environment?

kavi's icon

hello, i am a first year digital media student and have just introduced myself to max/MSP. i am working on project right now for my uni assignment and i am trying to create chromakeyed plane in 3D space with 3D cubes spinning around it. i have tried so many things and still it doesn't work as needed and i really need some help and professional advice.

aim::
achieve this sort of effect in max/MSP
http://www.vimeo.com/9757459

---
+ use live green screen video feed
+chromakey it
+import it in scene with 3D elements around it
+track the movement of person from live feed and apply these values to trigger 3D elements.

----
i managed to apply live feed onto a plane as a live texture and import it in 3D space along with the cubes
i also managed to sort out tracking and applying in on movement of 3D cubes
every time i was doing chromakeying the keyed areas appeared as black on my 3D plane. i have to get rid of those black areas and make them transparent. i don't know how to achieve that!

the only problem i am facing is getting my videoplane transparent in 3-d space.
i have explained the process and supported it with patches i was working on in my blog here:
http://kavi9999.wordpress.com

i am very confused and apparently there isn't a teacher in my department who can help me to sort my problem. i have read many forums and tutorials, maybe i am looking in wrong direction, please open my eyes!

--i need to know how to achieve transparency on 3-d plane and apply transparency on green areas.

thanks,
kavi

kavi's icon

here is screenshot of one of the patches i was working on:

284.Picture_2.png
png
kavi's icon

i might be doing wrong thing by chromakeying it, all i want to achieve is just body appearing in that plane without black areas which are keyed.
cheers!

Rob Ramirez's icon

well, sounds like you have two problems to sort out.

the first is to enable alpha based transparency on a textured 3d gl object.
this can be achieved by first ensuring that you are actually sending a matrix with a proper alpha channel to your videoplane, and then setting @blend_enable 1 and @depth_enable 0 on your videoplane.

the second, more difficult problem, results from the fact that you need to turn off depth_enable in order to properly display transparency. therefore you can't rely on automatic depth sorting and you have to handle it yourself.

one way to do this is with gl objects @layer attribute.
here is a very simplistic example, but should get you started.
you use the z value of the circling gl object to change it's layer attribute. this assumes the videoplane is at a z value of 0, and that the camera is in it's default position and default lookat.

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

you could encapsulate the circling object code in a poly~ and have several of these going simultaneously.

kavi's icon

hi, robtherich!!!
thank You for replying and directions, i will get straight on this one, thanks a million!
/

kavi's icon

IT WORKS!!
thanks to your explanation and example patch i am nearly there, bit more tweaking and i should be sorted. i will post my final crit results here, thank you soo much, i do appreciate your help>>>>

/