chromakeying and alpha channel::max/MSP##4

finally my patch has succeeded!! with a help from jitter website forum i was directed how i can fix my patch and achieve the transparency in 3-d space. the reason why i couldn’t get transparent plane after keying it was that i havent enabled alpha based transparency on a 3-d gl object. i first had to ensure that i am actually sending a matrix with a proper alpha channel to my videoplane, and then sending @blend_enable 1 and @depth_enable 0 on my videoplane. this is how it looks in my patch:

but apparently i am facing one more difficult problem which results from the fact that i need to turn off depth-enable in order to properly display transparency. therefore i can’t rely on automatic depth sorting and i have to handle it myself. a kind jitter forum member robtheritch explained me how to achieve it. he wrote: ” one way to do this is with gl objects @layer attribute…you use the z value of the circling gl object to change its layer attribute. this assumes the videoplane is at a z value of 0, and that the camera is in its default position and default lookat. you can encapsulate the circling object code in a poly~ and have several of these going simultaneously.” i didn’t use poly~ shape which is a 3-d object rendered by jitter but instead i incorporated my 3-d cubes i rendered out in maya and it did work within patch perfectly. here is the part of the patch which shows the layer attributes and how 3-d cube spinning is positioned in layer 1 and layer 3 while actual videoplane is @layer 2.

in order to access information on possible attributes i can use with jitter 3-d objects (OB3D) i can consult object reference window in max/MSP documentation. it is useful to get the general idea of possibilities and set rules to each jitter object i could utilise in certain situations. in patch i am using 3 attributes with my object. they are
1) @depth_enable 0 attribute — depth buffering flag (default = 1) when the flag is set, depth buffering is enabled.
2) @blend_enable 1 attribute — blending flag (default = 0) when the flag is set, blending is enabled for all rendered objects.
3) @layer attribute — object layer number (default = 0) when in automatic mode, the layer number determines the rendering order (low to high). objects in the same layer have no guarantee which will be rendered first.

finally, here is the whole body of fully functioning patch::

and some screenshots of video output::


i am very delighted with results and knowing that my patch is working fine i can move on to next step – experimenting with different shapes and 3-d objects, implementing some colour adjustment attributes as well as expanding the interactivity idea. i have already build a fully working tracking patch but it needs more tweaking. i managed to track the movement with jit.3m object and adjust sensitivity of effect applied onto 3-d objects. i must do some tests with real camera instead of built-in webcam to analyze tracking movement from far rather from close. because tracking device calculates pixels which has changed the position on the video input screen and as closer to the camera feed as better will be tracking results. even though moving object is far and doesn’t do much pixel movement in camera feed when from far, i can increase movement effectiveness by multiplying tracked values and by using new values to manipulate objects around the scene. here are some screenshots from tracking patch:

of course the patch needs general tweaking and setting best chromakeying values, as well as many tests with real green screen and new 3-d elements. i feel that main aspect has been solved and i can work on details now.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: