[Blender] Rotoscop and matte painting in Blender

rotoscop and Matte Painting in Blender. Philippe roubal 3d-synthesiscom.

Blend file is attached for testing.

In the world of visual effects, rotoscoping, Matte Painting and Garbage painting are necessary and complementary functions. They are used each time a Cut-out in the image is necessary, todo remove a background or unwanted objects in a shot. They can save a video shot when chromakey is not posible, or not enough perfecto todo achieve the desired effect.

I have searched for a long time a god and afordable software todo do that. I had in mind todo purchase one of the most famous of them recently, but After a trial of the software in demo mode, y found it very unstable. The software has some more interesting features like automatic shape tracking, but the planar tracking method gave me por results. The point tracking method is very eficient but unfortunately doesnt export trackers todo Blender. So, y decided todo dig more in depths with Blender. I had already done few rotoscoping work with Blender, but without finding a built in solution for the Matte Painting part.

This time, y have built a setup allowing rotoscoping and Matte Painting todo be rendered in one pass, and generating a directly usable alpha mask.

In the provided blend file, you Will found 3 screens dedicated todo roto and Paint work:
-Screen 1 = rotoscoping. This screen shows on the left side the window where you Will add and animate your masks, and on the right side the window showing the ipo curve of the selected shape you are working on.

Screen 2 = roto and Paint visual control. This screen shows in the left window in real time the result of both rotoscoping and painting. The right window is the one where you Will do your Matte Painting work. With Control + up or down arrow, you can get at Will in fullscreen the window where is your mouse cursor.

Screen 3 = compositing. This screen allows you todo modify the blur level of your final mask. If do composite is enabled in the Anim panel, this node setup Will combine your roto mask and your Painted mask in one unique rendering. A black and white mask Will be rendered for each frame. You Will be able todo chek the current frame of your work at any time by hitting the f12 key. As you can se in the node compositor panel, y have used two file output nodes todo save automátically the generated alpha mask and the composite image. Just type in the Fields the Path todo the folders where you want the images todo be saved. Each time you hit f12, the result of your work on the current frame is saved (overwritten). There is an input image node in which you can load your own background for compositing.
When you Will have studied my example, you Will have todo deleete the existing curves, except the templates at the right upper corner of the rotoscoping window which are necessary todo use this setup. Then you Will have todo load your own background animation.
important : in order todo use my background video example, you Will have todo unpack the blend file : Blender menú > file > external data > unpak into files > use files in current directory (create when necessary).

A texture folder Will be created, from which Blender Will call the biplane, (*.avi) movie. This video file Will be visible in background as son as you Will have depressed the reload button (yellow arrow). It is only necessary todo hit reload in one of the Windows. When you Will launch the animation, it Will be loaded in all the Windows. The setup is quite simple:
1-the main thing is that you have todo use a Camera set todo orthographic mode. In my setup, the Camera is looking in the y direction. It is better todo look the Camera in place with a locrotscale keyframe, in order todo avoid moving it accidentally, which would result in loss of positioning of all your rotoscoping masks.
2-in the left window, you Will have todo load in background your reference movie or sequence of images. View/background image. Select use and load your media. Enable auto.

Refresh and click on the small < button todo use all the frames of your movie or sequence, or enter a number of frames (blue arrow on the second image).
rotoscoping :
3-for the masks shapes, we have the choice of Nurbs, Bézier curves, circle and plane meshes. I found easier todo start from closed shapes, so i have added a Nurbs circle and a Bézier circle instead of open curves.

It is easy todo open or close these shapes with the c key. It is easier todo work with an open shape, in order todo se only the outline of the mask. To make it closed, select the basis Shape Key in the ipo window, and then hit c with the cursor in the 3d window. You can add dots todo your curves with Control-LMB when a Dot on a tip of the curve isselected. You can use subdivide todo add dots between two selected dots.

Obviously, in Edit Mode you can apply any usual conversión todo your curves. For example, todo rotoscope a rectangular shape, it Will be useful todo convert your curve into a polygonal shape, using the poly button in the curve tools panel. On the opposite, rotoscoping an organic shape Will require rather a Bézier curve. With n key, you can get a transform properties panel for your shapes. Using auto, Vector, align or free, you can get various individual behaviour for dots when using a Bézier curve. The Vector button allows you todo make Sharp angles and the free button allows you todo move separately each handle of a Dot.

As these shapes ned a special but simple ipo curve setup, y have added the two shapes used as reference tools in the 3d view. They already have their own shape Ipos and a new ipo Will be created for each new shape made from a copy of these two shapes.

So, adding a new shape is really easy : just select the Nurbs or Bézier circle, duplicate it by shift-d and move it in the 3d view. To move a shape or dots from a shape in Edit Mode, always use g key without any axis specification. This way, as you are looking th rouge an orthographic Camera, all the shapes Will be in the same plane. Dont worry about the classical rendering artefactos due todo overlapping Faces, because only the alpha layer Will be rendered.

You can put your shapes on several layers, and make them appear or disappear at Will by changing their layer at specified frames, using a layer keyframe. This method can be also useful if you have todo sepárate more than two levels in your compositing. This case occurs very often : one character in foreground, a wall with a window behind him, and a background sen th rouge the window. You Will have todo make a rotoscoping pass todo Cut out the character, and a second pass with the window mask only. This Will allow todo change the wall texture as well as the background image.

You can give diferent materiales todo your shapes, and so diferent colors todo help you manage them. As curves materiales cant be set todo transparent with ajustable alpha in the 3d view, you can use regular flat meshes if you want your masks todo appear semi-transparent. They Will be animated using shape keys, like curves. Dont forget at rendering time todo set their alpha todo 1, otherwise you Will get a grey shape instead of a full white one.
4-the main diference with softwares dedicated todo rotoscoping is that you Will have todo add manually a new shape key for each frame on which you Will have todo edit a mask. If you want todo edit a key, you Will also have todo click on the key number in the ipo panel before editing. This Will make sure that you are really editing the right keyframe.

Do not forget todo come back todo object mode After editing a curve, because the changes are validated at this moment. In the curve and surface panel, the relative keys button must be disabled. This Will allow the system todo use the basis ipo curve (red slope) on which the shape animation is based. Subsurf levels can be applied todo regular meshes if neded.
mate painting :
5-pléase enable the image properties panel of the right window, and a los enable the image Paint tools panel. Select the draw button and choose erase alpha (Green Arrow) in the blending method field. You Will se the effect of your brush in grey color in the left window, but it is not easy todo draw in the right window looking at he left window.

Dont worry, and enable the draw image with alpha button in the menú bar of the right window. This button is the one with two facing black triangles on a white Dot, which is just beside the button with the Pencil icon (in the blue circle on the image below). Now, when you draw with «erase alpha», your Pencil behave like an eraser and you can se the chessboard on the background of the image. If you want todo undo your drawing, just select add alpha instead of erase alpha, and your brush Will fill-in the previously erased áreas.

Note that you are not really erasing your image, but only playing on the alpha layer which allows you todo decide which part of the image is transparent or not.

I noticed that Control + z has a peculiar behaviour when painting on several frames. It works on the current frame and also on each new frame, but if you come back todo a previous frame, you Will se that it doesnt work. In fact it does in your back, but you are cancelling your job done on the last layer on which you were painting. On new frames, it Will work again. So be careful with Control + z.

I have a los noticed that the sensitivity todo pressure enabled by the 4 small p buttons, very useful when using a graphic tablet is unfortunately lost when you render your image in render window. According todo informacións received from the BugTracker, this could be a Windows bug, so people working with other os may not have this problem.

Anyway, there is an alternative method allowing todo get both the tablet pressure and the real time visual control in the left window. It gives better result on a fast computer (you may get a segmented drawing on a Slow one):
Use full screen rendering. Once you mask controlled, hit escape key : you come back in the right window where you Paint. It is important todo not render while working in fullscreen, because the escape key Will bring you back in the Paint window, but this window Will display the composited image instead of the one on which you were painting, and you Will have todo re-select the right background media in the menú.
With graphic tablets with customizable buttons, it is handy todo programa some buttons : escape, f12, Alt (move the image with the Pen), and Control + up or down arrow (full screen).

You can go forward and backward th rouge your movie or sequence of image, using the keyboard keys or the timeline buttons and cursor, but you must be warned that all the modifications you do are only temporary written in live memory, until you Will render your animated mask. So, be careful and work on small sequences at a time and render as often as posible.

A very important warning : never click on the reload button of the background or image properties panel, because all the Paint work you have done before rendering Will be lost.

Obviously, the reload button has no effect on the work done in rotoscoping. Do not use the save image característica in the image menú of the image editor, because if you have used a sequence of images, you could write on your original medía.

Thanks todo the file output nodes added in the node compositor, your work is automátically saved each time you hit f12 or the render button, but you can also save manually one more copy of your mask by use the save rendered image (f3) característica in the file menú of Blender todo save individual rendered images.
compositing :
6-a simple setup has ben done in the node compositor todo merge the rotoscoping masks made from closed curves and the alpha mask Painted by hand.

As you can se, an image (Pink Sky) has ben added, allowing the background todo be replaced. The combined alpha mask and the fully composited image are saved separately each time you render.

The basic setup used todo combine the rotoscoping shapes and the drawing on the alpha layer:

The actual setup used in the ready todo use blend file provided with the tutorial:

I hope that this tutorial and setup Will be understandable and useful. Fel free todo tell me if you noticed errors, missing informacións or if you have found a better bien of doing this kind of work.

Thank you for reading.

Philippe roubal.
3d-synthesiscom.
.

Miniaturas adjuntas
Rotoscop and matte painting in Blender-rotoscoping-and-matte-painting-in-blender_img_0.jpg   Rotoscop and matte painting in Blender-rotoscoping-and-matte-painting-in-blender_img_1.jpg   Rotoscop and matte painting in Blender-rotoscoping-and-matte-painting-in-blender_img_2.jpg   Rotoscop and matte painting in Blender-rotoscoping-and-matte-painting-in-blender_img_3.jpg  
Archivos adjuntados

Ver más sobre el tema y los comentarios en el foro