Projection mapping or masking?

spin lud's icon

Hi, I have some Jitter visualizations to play in sync with music. Currently I am projecting them the normal way on a 16:9 projector screen.

For an upcoming event they’re designing a wall behind the stage with raised shapes representing the venue’s logo. They’ve asked me to project visuals only inside these shapes, leaving the rest of the wall blank.

I’ve never done something like this before — what could I use? I saw that it’s possible to do projection mapping in Max using jit.gl.meshwarp, but I’m not sure if it works for this scenario since I’d need to leave certain areas dark. Maybe some sort of mask should be applied? I also don’t quite understand if this is something I can prepare before the event or if it’s mapping that has to be done on site.

Do you have any suggestions on how to proceed?

Martin Olavarria's icon

Hi Spin!

Ahh Federico Foderaros meshwarp! This is an amazing tool that should grow.

If you go to the [jit.gl.meshwarp] help patch you will find a lot of options and there is a "mask mode" tab. There are some features common to video mapping that are not implemented like "blends" (edge blending or feathering) for multiple projectors but that is only necessary for more complex setups. And yes, you should test and prepare a lot, as much as you possibly can if this is the first time you do something like this, In my experience the best way to enter "running and gunning" to this kind of gigs is to have a lot of flexibility and reliable understanding of the workflow, but go for it! Cheers

Pd: Have a plan B, maybe Resolum or MadMapper, but should be super cool to try it on Max.


spin lud's icon

Hi Martin, thank you for the reply!

Yes I am already exploring meshwarp and it could be a solution, although I would like to apply the mask directly from a black/white image (white shapes where projection needs to happen, black background). I am trying to figure out what I can use, searching around I find a mention of "videoplane with tex_map 1" but I am not sure how to use it with an image. Also community on Discord suggested to use jit.gl.cornerpin, but I couldn't find an example how to apply an image mask.
Still figuring out!

Rob Ramirez's icon

since you've received a few suggestions of what to try, at this point it's probably best to either post a patch that shows what you're attempting and describe what's not working, or post some kind of diagram that describes what you need.

Martin Olavarria's icon

As Rob said sharing a patch would help.

Also if you are after an image as a custom mask check the "blend" option, if your mask is black and white a simple multiply operation between mask and content should work. You can find it in the help path, "multiple meshwarps" tab.

spin lud's icon

The solution with the blend mask is what tmhglnd suggested me on Discord and it works great!

The issue with meshwarp is that it is not possible to do curved lines and in my case I have a mask with a lot of curves, that will require a lot of control points.

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

A question I have is about the dimensions of the mask image. I have my Jitter resolution set to 1280x720, while the projector at the event would have probably a different resolution (let's say 1920x1080). In this case the mask image should match the dimensions of the projector resolution or of my Jitter world?

And in case, at the event, there are issues with the projected dimensions (for example, the image doesn’t align with the relief shapes on the wall), what’s the best way in Max to scale/adjust the size of my output? Like for example a UI tool to easily tweak the dimensions of the jit.gl.layer?

Rob Ramirez's icon

In this case the mask image should match the dimensions of the projector resolution or of my Jitter world?

There is no hard and fast answer for this. Generally you want the resolution of your imagery to match your output, but for masks it is usually OK if they don't.

It sounds like your plan is to lock res at 720p for your final composite, which will then get scaled to whatever res at output. This is a fine strategy and allows you to lock in a lot of your pipeline at that res. You should be using a jit.gl.node @capture 1 @adapt 0 @dim 1280 720 for this, and binding all scene elements to that node, then send that node's output to your jit.world for projecting, and a jit.pwindow for previewing.

If all your scene elements are 2d layers, you should decide if you want them to preserve the aspect ratio of the source (the default behavior of jit.gl.layer) , or to fill the entire canvas (@transform_reset 2). If you have other 3d elements of your scene, you should also add a jit.gl.camera to the jit.gl.node to ensure correct aspect ratio for those elements.

Rob Ramirez's icon

additionally, if you are using either jit.gl.meshwarp, or jit.gl.cornerpin, make extra sure you know how to save state in those. meshwarp has it's own mechanism for this, but also supports pattrstorage and snapshots. for jit.gl.cornerpin you can attach an autopattr @greedy 1 to expose the corner state to a pattrstorage.

The operation of cornerpin is straight forward and can be easily manipulated on site, but meshwarp is more sophisticated and therefore you should spend plenty of time familiarizing with the interface and testing out some mappings (and again, saving and recalling state) prior to your performance.

Martin Olavarria's icon

Checking [meshwarp] documentation you can find the nurb_order and curvature messages, which allows for curves, not on your grid UI but on the actual texture, so check those out with contrasting content so it is clear how it is affecting your mapping. By the way, researching this problem I noticed that the [jit.world] object has an "enable_cornerpin" option that allows for keystone which is incredibly useful, and probably allows to bypass the [jit.gl.cornerpin] part, less is better here.

Since your aspect ratio is maintained between 1280x720 and 1920x1080 if you go to full screen all should scale properly, but in any case try the dim messages to adjust dimensions. And watch out for 1920X1200 output resolution. 

If you have even a small projector at home try a simple model, even if you have to map the mask to a printout version, a digital previz system like Depence or Capture are also fantastic for this but is a whole other world of expertise.