multi image layering

nozzl's icon

hi all,
i'd like to layer several png images.
each with different transparency level and copy mode (add, multiply, difference, darken, lighten, etc ...) like in photoshop.
i'm sure this is already been done and documented.
i can only find examples for mixing 2 sources.
thanks for your help

Rob Ramirez's icon

jit.gl.videoplane is your friend here. just have to know the proper blend of attributes, which i know is a bit daunting. take a look at the patch below, and open up your reference browser and search for "Depth Testing vs Layering" for more info.

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

nozzl's icon

cool, thanks!
playing around with jit.gl.videoplane and multiple layers of .png images.
getting already nice results.
but how can i save the content of the jit.world window to another .png or .jpeg file?
for now i make screenshots using the windows snippet tool.
would be nice to have a single "save" button with autoname function within the patcher.

Rob Ramirez's icon

you can use jit.world output_matrix to capture your scene as a matrix, and send it to a jit.matrix object. you can then call exportimage on the jit.matrix object to save it as an image file. you can use the date object with the combine object to create unique names.

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

nozzl's icon

ok, thanks. got this working now.
next thing is that jit.world won't preserve the aspect ratio of input images, although the attribute is set in inspector.
any idea about this?
thanks again

Rob Ramirez's icon

replace jit.gl.videoplane with [ jit.gl.cornerpin @preserve_aspect 1 @drawcorners 0 @blend_enable 1 ]