ModelBuilder
The ModelBuilder node (NukeX and Nuke Studio only) provides an easy way to create 3D models for 2D shots. You can build a model by creating shapes and then editing them, and align models over your 2D footage by dragging vertices to their corresponding 2D location.
To be able to align models, ModelBuilder needs a tracked camera and an input image for visual reference. You can also use other 3D geometry and point clouds as a reference if you already have these for your scene.
If you don’t connect a camera, image sequence, or reference geometry, you can still create and edit 3D models, you just can’t do anything in Align mode.
Creating and editing models using ModelBuilder requires a NukeX license, but the resulting geometry can also be used in Nuke.
Inputs and Controls
Connection Type |
Connection Name |
Function |
Input |
geo |
3D geometry to use as a reference when positioning new shapes. For example, you can use the PointCloudGenerator node to create a 3D point cloud for your shot, and connect that to this input. When creating new shapes, you can then select vertices on the point cloud to automatically align the shapes with the point cloud. This gives you an approximate initial position for your shapes. |
cam |
The camera track of the scene in which you intend to use the ModelBuilder. |
|
src |
The source footage from which the camera information was obtained. |
|
tex |
An optional 2D texture that you can display as a background in the UV preview window and on the model in the 3D Viewer. |
Control (UI) |
Knob (Scripting) |
Default Value |
Function |
ModelBuilder Tab |
|||
display |
display |
wireframe |
Adjusts the display characteristics of the 3D shapes. These settings don’t affect the render output of the scene; these are for display purposes only in the 3D Viewer. • off - hides the 3D shape. • wireframe - displays only the outlines of the shape’s geometry. • solid - displays all geometry with a solid color. • solid+wireframe - displays the geometry as solid color with the shape’s geometry outlines. • textured - displays only the surface texture. • textured+wireframe - displays the wireframe plus the surface texture. |
selectable |
selectable |
enabled |
When enabled, you can make selections as normal in the Viewer. When disabled, points cannot be selected or changed. |
render |
render_mode |
textured |
Sets how the object will render. This control is independent from the display selection, but has the same settings. |
cast shadow |
cast_shadow |
enabled |
When enabled, the shape(s) can cast shadows. |
receive shadow |
receive_shadow |
enabled |
When enabled, and the geometry has a material shader attached to it, the shape(s) can receive shadows. |
Scene |
N/A |
N/A |
Shows the hierarchy of shapes and groups of shapes in the scene. To rename shapes or groups, click on them and enter a new name. To toggle the visibility of shapes or groups, click . Note that when an item is hidden, it doesn’t appear in the Viewer or renders. |
+ |
sceneAdd |
N/A |
Adds a new group to the scene. You can use groups to organize and set the visibility for shapes in the scene. |
- |
sceneDelete |
N/A |
Deletes the selected shapes and groups from the scene. |
Duplicate |
sceneCopy |
N/A |
Duplicates the selected shapes and groups in the scene. |
Distance |
shapeDistance |
10 |
Sets the default distance at which shapes are created. New shapes are positioned at this distance from the camera. There are no specific units for the Distance value. Low values position the shape close to the camera, and higher values mean further away. |
Textures | |||
Projected |
textureType |
current frame |
Sets the texture method to use: • current frame - Project the current frame onto the shape. • locked frame - Project the frame specified in the field on the right onto the shape. This can help you line up the shape against your source footage. • frame difference - Subtract the frame specified in the field on the right from the current frame and project the resulting frame onto the shape. This can help you line up the shape against your source footage. Note: This control only has an effect when display is set to textured or textured+wireframe. |
textureFrame |
N/A |
When Projected is set to locked frame, ModelBuilder always projects the texture from this frame onto the model. When Projected is set to frame difference, ModelBuilder subtracts this value from the current frame and projects the resulting frame on to the model. |
|
Preview | previewTexture | tex input |
Sets whether to display the image connected to the tex input in the UV preview window and on the 3D model: • off - Do not display the image in the UV preview or on the 3D model. • tex input - Display the image as a background in the UV preview and set it as the texture for the currently selected object in the 3D Viewer. This allows you to line up your UVs over features in the tex image and see how well the UVs work on the actual model. |
Export | |||
[bake menu] |
bakeMenu |
Selected geometry |
Sets what ModelBuilder creates when you click the Bake button: • Selected geometry - ModelBuilder creates a geometry node for the selected items in the scene. You can use this to bake out parts of the scene to set up projections by baking Projection. • Projection - ModelBuilder creates a projection at the current texture frame. This creates a Project3D node with a FrameHold node set to lock the input image and camera to the texture frame. You can then use the ApplyMaterial node to apply the projection to geometry created by baking Selected geometry. Note: The options in this menu are implemented in Python, and you can also use Python to add your own entries to the menu. For more information, see Exporting Shapes to Separate Geometry Nodes. |
Bake |
bake |
N/A |
Bakes out a feature of your model. You can choose the feature using the bake menu. This allows you to separate out parts of the scene for easier processing. |
Show Source Image |
srcDisplay |
enabled |
When enabled, the src image is displayed in the 3D Viewer whenever the Viewer is locked to the input camera. When disabled, the src image is not displayed in the 3D Viewer. |
Pass Through Geo |
passThroughGeo |
enabled |
When enabled, the geometry from the geo input appears both in the Viewer and renders. This can be useful when you want to use the geo input as a reference for building your model. For example, when creating new shapes, you can select points or vertices on the geometry to automatically align the shapes with the geometry. When disabled, ModelBuilder doesn’t output the geometry from the geo input. |
Shape Defaults Tab |
|||
Point |
|||
Create |
createPoint |
N/A |
Creates a new point in the scene. You can use points to define locators on different parts of the scene. This is the same as selecting Point from the shape creation menu in the ModelBuilder toolbar on the left hand side of the Viewer. |
Card |
|||
Create |
createCard |
N/A |
Creates a new card in the scene. This is the same as selecting Card from the shape creation menu in the ModelBuilder toolbar on the left hand side of the Viewer. |
Rows |
newCardRows |
4 |
Sets the default number of rows for new cards. |
Columns |
newCardCols |
4 |
Sets the default number of columns for new cards. |
Cube |
|||
Create |
createCube |
N/A |
Creates a new cube in the scene. This is the same as selecting Cube from the shape creation menu in the ModelBuilder toolbar on the left hand side of the Viewer. |
Rows |
newCubeRows |
1 |
Sets the default number of rows for new cubes. |
Columns |
newCubeCols |
1 |
Sets the default number of columns for new cubes. |
Slices |
newCubeSlices |
1 |
Sets the default number of slices for new cubes. |
Sphere |
|||
Create |
createSphere |
N/A |
Creates a new sphere in the scene. This is the same as selecting Sphere from the shape creation menu in the ModelBuilder toolbar on the left hand side of the Viewer. |
Rows |
newSphereRows |
20 |
Sets the default number of rows for new spheres. |
Columns |
newSphereCols |
20 |
Sets the default number of columns for new spheres. |
Cone |
|||
Create |
createCone |
N/A |
Creates a new cone in the scene. This is the same as selecting Cone from the shape creation menu in the ModelBuilder toolbar on the left hand side of the Viewer. |
Slices |
newConeSlices |
20 |
Sets the default number of slices for new cones. |
Cylinder |
|||
Create |
createCylinder |
N/A |
Creates a new cylinder in the scene. This is the same as selecting Cylinder from the shape creation menu in the ModelBuilder toolbar on the left hand side of the Viewer. |
Rows |
newCylinderRows |
2 |
Sets the default number of rows for new cylinders. |
Columns |
newCylinderCols |
20 |
Sets the default number of columns for new cylinders. |
Step-by-Step Guides
Video Tutorials
NUKE 7.0 - ModelBuilder - Alignment & Positioning from Foundry on Vimeo.
Hello everybody, and welcome to this tutorial on the new ModelBuilder node for Nuke 7.0. My name’s Jon, and in this video I’m going to show you how to create and line up geometry using the Align Mode in the ModelBuilder.
First of all, let’s take a look at the node. For the line-up, I’m going to need the match-moved Camera for the shot. Image modeling always works best if you have removed any lens distortion from your plate first, otherwise you are going to find you can’t line up your geometry at the edges of the image where it’s most distorted. In the properties panel for the ModelBuilder, you can see that you get a Scene Graph to lay out the geometry you create.
Here’s one we have already done. You can create groups, and organize geometry here. You can also delete and duplicate, and you can toggle the visibility of different parts of your scene on and off. Now, the most important thing to set in the new ModelBuilder node is this Distance parameter. This defines the size of the world you are working in, and it is easy to set. If I unlock (Ctrl/Cmd+l) from the Camera and zoom out, I can review the movement I have on the match-moved Camera. You can see that the scale is around 1 here, so I will set the distance to 10 for this shot as it is the maximum distance I need to work with. You will see that the ModelBuilder has two toolbars. On the left, you can add new shapes and you can select whether to work in an Align Mode where you line up shapes to your footage, or in Edit Mode where you modify the geometry. In the Edit Mode, you can switch between the different selection methods for the 3D Viewer. If I switch to the Align Mode, the Model Builder will lock you to the match-moved Camera. Now, all the alignment has been done in the 3D Viewer, so you need to be locked to the Camera and viewing the ModelBuilder node to bring up your image as an overlay to do your line-up. I use Ctrl/Cmd+l to quickly toggle the lock on and off. You will see on the top toolbar that you can choose whether to Align whole objects (Object Transform) or to work on individual vertices (Vertex Position). You can also configure the zoom window that is displayed to assist in the alignment.
Let’s start by adding a simple point to our scene. I select from the Shape menu and click in the Viewer to create a new shape. I now have a new point. You can see that the Alignment Mode brings up a handle for the position of the vertices in your geometry. I can pick this up and position the vertex in the image. The zoom window here allows you to review and fine-tune the vertex positions. So that’s the position in this frame, I now need to go to another frame and drag that vertex to the right location, that creates the 3D position. From just 2 frames, I am now locked down to the shot. It is always a good idea to use 3 frames at least as this is going to give you more accurate 3D locations. You can review this by flipping between the keys. You can also look at other frames and, if you need to, you can insert additional keys to correct the 3D position.
When you are aligning, you will see there are guidelines here so you can drag vertices while respecting the positions you have defined at other frames. If you need to, you can hold down Shift and drag off this guideline, but it is usually best to leave the vertex on this guideline for the best result fitting all of your keys. Here we have a point in the scene, you can see it in 3D, and you can use this as a locator to help lay out elements for the shot, for example.
So let’s do something more interesting and add a card to the front of this wall. I select Card from the Shape menu and I click to create, but now I can drag to set the right size to work with. I need to position the vertices of the card, and it’s important here to select real points in the world that you can find in several frames. So I need to pick up the corners and position them correctly, and I need to go to another frame to lock down the 3D location. I can fine-tune with the zoom window. With just two frames here, I’m locked to the shot but I’m going to add a 3rd frame just to make sure I have an accurate 3D location. So, now I have a card to work with on that wall. Often, you will find, though, that you can’t pick up nice corners to work with. The corners of this wall are obscured. One trick to remember is that you can switch to the Edit Mode and select the objects and scale them to position however you want. I can take my card and turn it into a larger wall. So that’s the basics of working with the Align Mode, you need to position vertices at several frames to lock down the 3D location.
You will see we have been working on the Object Transform here. Working with the Object Transform preserves the shape of the object whilst you are doing your line-up. You can switch to aligning individual vertices by selecting a line vertex position here. Each vertex is treated as a point and you can pick up a vertex to position it independently, so I can create the 3D location of this vertex and this allows you to generate more organic shapes to work with. The thing to be aware of though in vertex positioning is that you can get a distorted shape in 3D. Even though the vertex looks correct in the image, because it’s been moved independently, the geometry can become twisted. Wherever possible, align your Object Transform so you preserve the shape of your geometry. That will work for all the shapes in the Shape menu.
The Polygon works slightly differently. To create a Polygon, click in the image to locate the vertices, selecting specific image locations for each vertex. You can use Enter here to complete the shape creation. You then have to use Vertex Alignment so you get the correct 3D shape of your Polygon. This works very much like the original Modeler node in Nuke 6.0. I can position each vertex, but the thing to be aware of is when you switch to 3D, you can create twisted geometry. One handy trick to remember though: you can create shapes on top of existing geometry. If I create a Polygon now, I will hold down the Shift key and the cursor hits the geometry I have in the scene so that I can create the vertices directly on top of the Card. So, here I have created a Polygon without aligning the individual vertices, and my geometry is no longer twisted.
Just to finish off I would like to show you a trick you can use to line up geometry with the new PointCloudGenerator in Nuke 7.0. Let’s have a look at the point cloud for the shot. You will see it has already been labeled here for the different elements of the scene. I can go on the PointCloudGenerator and toggle the visibility off to look at different points of the point cloud. What I can do is switch to Vertex Selection, and I can view the PointCloudGenerator and select points. Then, in ModelBuilder, I can select a shape to automatically fit to the points. I can then edit and shift it around if I wish. Similarly, I can do this for the tower. I can select points on the PointCloudGenerator, then I can go back to ModelBuilder, create a Cylinder to snap to those points, and I can go in and edit. So we have quickly placed geometry to start doing our modeling for this shot.
Thank you very much for listening, and I hope you have enjoyed this tutorial.
NUKE 7.0 - ModelBuilder - Editing Geometry from Foundry on Vimeo.
Hello everyone, welcome to this tutorial on the new ModelBuilder node in Nuke 7.0. My name’s Jon, and in this video I am going to show you how to create and manipulate geometry using the Edit Mode in the ModelBuilder.
When you create a ModelBuilder you start off in Align Mode. If you hook up some footage to the src input and a match-moved Camera to the cam input, you can use the Align Mode to create geometry and line this up to your shot. There is also a geo input here, that allows you to pull in geometry with vertex normals to assist in positioning objects. Take a look at our tutorial on Alignment and Positioning to find out more about how to do this in Align Mode.
Now you can also work in Edit Mode to create geometry directly in the 3D Viewer. I can select a new shape and position on the ground plane here using a single click to create, and dragging to set the size. If you hold down the Shift key, you can also ‘hit test’ against existing geometry when creating your shapes, so I can click on the cube and place a cone. On the top toolbar you can switch between the display settings for the geometry. One thing to remember is you can switch on the headlamp in the Viewer settings (3D tab) if you want to work with a solid display. Let’s switch back to working with wireframe. Now, on the left-hand toolbar, you can see there is a shortcut menu to select between the different selection methods. If I choose Select objects, I can go and pick up my shapes and move them around using the translation handle. A good trick here is if you hold down Ctrl/Cmd+Alt, you can pick up the pivot point and move it in the scene. You can also locate it on geometry, so now I can scale up from the corner of this cube. You can also rotate that pivot point. If you hold down Ctrl/Cmd+Alt+Shift, I can rotate that pivot and now I have a new handle to translate, scale, or rotate. One thing to remember when you are working with selection is, by default, the Viewer will test for occlusions. If you want to select back faces or edges for example, you need to disable Occlusion Testing in the Viewer. Now you can go in and select through the object, so I can pick up some back edges.
Once you have some geometry to work with, you can access all the editing options through the right-click context menu. Here, you can switch through the selection methods as well as the mode you are working in and you also have a set of actions you can perform, dependent on the selection method. So, in Select vertices I can carve, extrude, and bevel. In Select edges, I can carve, extrude, bevel, and subdivide. There are also some handy shortcuts here to select edge loop and select edge ring. In Select faces, I can carve, extrude, merge, bevel, and tessellate. And, finally, in Select objects I can carve and I can also mirror. Use mirror, for example, to model symmetric objects by modeling one half first, duplicating, then mirroring.
Let’s look at an example. If I go to Select edges and select this edge, and then subdivide, I have started an Edit action. This will bring up the Editing controls in the top toolbar so I can edit the action and when I am happy, I can complete hitting Return. You can also hit Esc to cancel. So, here I have inserted symmetric vertices on the edge. Now let’s try doing a Bevel action. If I select this edge (Select edges) and then Bevel, I have now brought up the controls. I can set the roundness (round level), this controls the number of edges, and the size of the bevel. I am going to use Esc now to cancel.
Let’s have a look at carving now. If I start a Carve action, I can click on my geometry and insert additional vertices to cut out new geometry. One thing to watch out for here, is to make sure you click on your geometry rather than outside when inserting vertices, and a trick you can use is to hold down Ctrl/Cmd+Shift to automatically insert vertices as you drag over the geometry. And, as before, you can use Return to finish your Carve action or Esc to cancel.
Now, the final thing I am going to show you is in Select faces; there is a shortcut key for Extrusion. Here you can use Return to quickly Extrude a selected face, or set of faces, to quickly build up your geometry.
So, that’s the basics of geometry editing. Let’s see how we can use that to do some clean plate work for this shot. I want to build some geometry and do some projections. I have a ModelBuilder node connected to my footage and a match-moved Camera, so I want to set it up for my shot. Let’s review my Camera move. So, you can see the scale here is around 100. I will have to go in and update my far clipping plane (in the Viewer properties); let’s use 10,000 there. I also need to set the Distance parameter on the ModelBuilder node. I like to use 10 times the scale as the maximum distance I need to work with so 1,000 here.
The first thing I want to do is model a back wall, so I will use the Align Mode to place a card and lock it down to the shot. The tutorial on alignment will tell you how to do this. What we are going to do is place a few corners and then skip forwards, so we have aligned these corners and now we have a card locked to the shot, but that’s on the window pane. So, what I’m going to do is place a point as a Locator on the wall, then I am going to pick up my card on the window pane, scale it up and get it into position for the shot. Then I’m going to switch out to 3D and then move the card off from the window pane to the front of the wall. So, now I have a card on the plane of the wall to work with, I can edit this card to model the shape of the wall. The first thing I'm going to do is line up the edges of the card to the window frames. You can use Drag Select or hold down Shift to do multiple selections and you can also use Alt+Shift to remove from a selection if you need to. A handy trick here though, is to select a single edge and then use select edge loop to quickly pick up the edges so you can place them. Now, you see I don't have enough edges in the card for the window frame here, so I’m going to insert some vertices by subdividing these edges and then I will use carve to connect the new vertices together. Now I have a new edge to work with, I can pick it up and move it to the right location. And, finally, I am going to place this edge for the windowsill. To create the inset windows, I can switch to Select faces, select these faces and merge them so I can pick each one up, extrude it back, and position on the back window pane again. So now we have our inset windows, and we have the geometry we need for the back wall.
Next up, I want to create some geometry for the bed. So I first lock down my geometry using alignment, and here I am going to start with a card on the top of the bed. I position the corners and now I have a card positioned next to the wall and I can switch to edit this, to create the shape I need. I pick up that front edge and extrude it down, then I pick up the corner edge and bevel it to create a smooth shape. This gives me the surface of the bed.
Finally, I’m going to model a fan on the bed. I will use alignment to position a cube over the front face of the fan. So again, position the corners and once we have a cube, I will go in and edit, select the edges and use bevel here to create the roundness of the corners. Now we have the fan.
Now we have all the geometry, let’s see how that looks in 3D. You can select from the ModelBuilder and hit Bake (Selected geometry) to create a separate node. You can also use Bake (Projection) to create a projection group for a particular frame. Here is one I have created before, for frame 1. So what we are going to do is take our baked scene geometry, hook it up, and render it out with a ScanlineRender node.
So you can see that in just a few minutes we have aligned and edited the geometry we needed to set up projections for this shot, and we did it all inside Nuke using the ModelBuilder node. Thank you for listening and I hope you enjoyed the tutorial.