roto-splines with blender compositor

Hello Everyone,

I was wondering if it’s possible to mask things out in the compositor using splines? I can’t find a single doc that covers that topic, so I’m guessing it’s just not possible?

stefan andersson

Hmm, I saw a video last night, and they were using nodes and masks, I’m not sure it will exactly fit your needs but it might give you an idea.
I warn you though its over 30 min (its WELL worth it though, just plan ahead):

Follow the link in the first post :slight_smile: GL

not really since he is making 3D objects as masks. I think this image below shows what I mean

what I would like to have is what is known in Shake as “roto splines”.

stefan andersson

It seems to be the same thing.
I’m not sure about how shake does it, but in Flame the rotosplines are in 3D space.
Same can be done in blender,( …but without any automatic tracking…)
Still very useful…

I’m sorry…I can’t really see how this is the same. What I need to do is to mask off a portion of a 3D rendered image.

1.) you have a turtle that should be standing behind a rock (live footage)
2.) you composite your turtle on top of the live footage, and then mask out the part which is the rock.

creating 3D geometry as a mask is not really an option as you would not have the same level of detail as you would when you are creating a “normal mask” as you would be able to do in for example Photoshop, Gimp, Shake, etc.
In Flame and Shake (if I use those to as an example) you can also have a subcurve which controls the feather of the spline.

Now, anyone have an example or a page which shows this?? Or is it just not possible in blender at this point?

stefan andersson

is this what you are looking for?

you have two scenes, one for the turtle doing his thing, and another for the masks that hide the part of the turtle behind the rock. Essentially, you are using the mask to say which part of which video stream (rock or turtle) to put on top of the other. Use the alphachannel of the mask layer to feed the alphaover node. Where the mask is alpha 1, the rock video is used; where the mask is not exist, the alpha is 0 so the turtle is uesd. Where the turtle stream is alpha 0 (the blue background), use the rock video.

You will have to rotoscope the spline, using IPO curves most likely, to match the camera movement (the apparent movement of the rock). Hope this helps!

But yes, what you want to do is very doable in Blender.

downloading and will check it tomorrow. Thanks for the link!

stefan andersson

i had an idea today: you can do video-painting in blender.
so why not paint those areas that have to be masked pink (or any other color), make a matte out of that (difference key) and use that as your mask? i have just tested it today and it seems to work. i copied my video footage and used the copy as painting background. in the node-setup i used that painted video as mask, and the original as - well as the original obviously :slight_smile:
i guess this method works pretty good, but i see a few problems: it seems that there is no eraser-tool in the image painting so it is not so easy to change things afterwards as it would be with curve-masks or splines. mesh- /curve-masks are probably better if you need straight lines masked out. so it would be great to have a dedicated mask-tool in the compositor. however, for a quick and easy preview this method should be pretty good

here’s the node setup

i am not very experienced with nodes and compositing, so i would be glad to hear what you guys think about that.

hey guys! i just discovered, that there IS an eraser tool in the image editor! and even better: you can directly paint AND ERASE an alpha channel! so no need for ugly pink mattes! i think this is a pretty straightforward way of quickly masking things out. :cool: what do you think?

well, theres still the disadvantage, that longer movies would require lots of tweaking, but then again - shape keys and IPO have to be tweaked as well.

After some research and looking at papasmurfs video I can only sum it up to that it’s not currently ‘doable’ in the way that I was hoping for. Though I wouldn’t be surprised if we will see such a function in Blender soon.
As Blender matures and also getting new features for each release I can see that it will develop to a mature compositing tool as well. I for one is really impressed of what they have done in the last year.

stefan andersson

It’s doable, however it’s not very flexible. The way you would go about creating the mask would still require using 3D geometry. This is the general process I use:

  • Place the camera on the z-axis, positioned above the grid and pointing down (with the default camera ALT+R, ALT+G, G > Z and then move to suit).
  • Switch the camera to Ortho
  • Set your video as the background image (make sure your render size and framerate match the video’s)
  • From the camera view you can add Bezier curves to create your masks
  • Adjust the materials and world settings so the curves are shadeless white and the background is flat black
  • Animate your mask if necessary (this is where the limitation lies… at this point your animation tools are limited. You can use shape keys, but you only get a limited number of them and it’s kind of a kludgey way to animate a mask. You can also use hooks on control points in the curve and animate them, but this doesn’t give you really good control of the Bezier handles)
  • Render your mask
  • Use it in whatever compositing scenario you desire

So it’s entirely doable, it just requires a little bit of setup and there are limitations when it comes to animating the mask. Granted, it’s not ideal, but at the same time, Blender is a 3D suite, not a full compositor.

anybody tried this one?
it automaticly creates masks, which can be exported as b/w-bmps and then be used in blenders compositor. i think i looks quite promising.

The problem as it is now is flexibility, creating 3D geometry of importing masks isn’t really what you want to do. Its time consuming and not very intuitive. But my guess would be that this will be implemented in Blender some time soon… or later…

stefan andersson

what is the license on Claxa? Softpedia lists it as freeware but the install warns of copyrights? I would like to try it if its free…

I don’t get it. I’m regularly doing this stuff on a Flint (the SD version of Flame) at my work and have started doing it in Blender as well.
As far as I can see, you have EXACTLY the same level of detail with your masks. Blender does have Bezier splines, you know, and they’re animatable. You don’t HAVE to use 3D geometry (although it can be useful).
The only thing missing is that subcurve feathering feature, and tracking. You can fudge the subcurve thing using a UV map for the alpha of your mask, and as for tracking, well, that IS a shortfall, (but to be fair, Blender as a compositor is a relatively new idea, and I understand tracking is quite a complex thing to achieve)

You don’t even have to prerender things (although it’s generally a good idea). You can set up 2 cameras; one for your 3D scene and one for masking, and just control what goes where with render layers. Then you just comp it all together with nodes.

Plus, as has been pointed out, you can paint mattes in Blender, just like in Flame.