Rendering Wireframes in Maya for Compositing with After Effects
In today's tutorial, Crystal Leal walks us through how to render out a wireframe version of a model using either Mental Ray or Maya's own Vector Renderer. Once rendered, the sequences are then composited together in After Effects and rendered out to video. This technique is perfect to use when putting together turntable animations for your portfolio!
Open up your Maya file with your model. You will first set your project. Go to File > Project > Set. In the Browse for Folder window find the location of the project file you have created. The example project folder is named “Wireframe Example.”
If you do not yet have a project set go to File > Project > New.
Name the project. Under location choose where the project will be saved. Press the Use Defaults button so that it will create the default file structure for the project. Save your Maya files in the scenes folder, texture files in the source images folder, and rendered sequences will be saved into the images folder.
Set up a camera to render from if you do not have one already. Go to Create > Camera > Camera. Creating and setting up a camera will allow you to render your wireframe and any other render passes at the same position.
Rename the camera. Where it says “camera1” replace it with the new name. For example “RenderCam.”
Set the viewport to the new camera. In the panel menu to go Panel > Perspective > New camera name (RenderCam).
Set up the render settings before adjusting the camera. Go to Window > Rendering Editors > Render Settings.
In the Render Settings window you want to be in the Common Tab. The main setting you want to set up before setting up your camera placement is the Image size and what you are rendering with.
The rest of the settings will need to be set if you are rendering a whole sequence. Under width and height you want to set the size of the image. Under file name create a name the file. For example “wireframe” if that is what is being rendered. Image format can be changed to several formats. In this case use Targa which will keep the alpha information. Under Frame/Animation ext. you will set it to name.#.ext. The files will then be named “wireframe.(frame number).tga. Frame range will be how long your animated sequence will be. If you are rendering a second worth of animation at 30fps you will be rendering from frame 1 to 30. Under Renderable Camera change this to the camera you want to render from. In this case change it to “RenderCam.”
Under the Quality tab you set the quality to production when rendering your final images. Quality can be set to a lower quality when doing test renders.
Select your camera through the panel menu by selecting the panel with the RenderCam set from earlier. In that panel menu to go View > Select Camera. On the right Channel menu you should see that you have your camera selected.
Position your camera to frame up you model.
To make sure your model does not go outside the renderable area you can turn on the resolution gate by going to the panel menu > View > Camera Settings > Resolution Gate. You will now have a outline in your viewport which will show the area that will be rendered.
Setting up Mental Ray Wireframes
(You do not have to set up both renderers. Choose which one you prefer. Skip to step 20 to set up Vector wire frames.)
Open up the Hypershade window by going to Window > Rendering Editors > Hypershade.
In the Hypershade window create a Use Background shader located on the bottom of the surfaces menu on the left. It will create a new shader node which will appear in the Materials tab. Select the new shader and double click or prese Ctrl + A to open its Attributes.
Change the name of the shader in the useBackground input to “MentalRayWireframe.” Set the following attributes and then close the window :
- Specular: black
- Reflectivity: 0
- Reflection Limit: 0
- Shadow Mask: 0.
Open up the Hypershade again. Go to window > Rendering editors > Hypershade. Select the MentalrayWireframe shader. At the top of the Hypershade press the input and output button. In the Work area tab below the Materials you will see the shader connected to a node named “useBackground1SG.” Select the useBackground1SG node. Double click of press Ctrl + A to open up its attribute window.
In the Attribute Editor switch to the useBackground1SG tab at the top. Open the mental ray menu. In the Contours menu check on Enable Contour Rendering. Under width you can change the value depending on the desired thickness of the wire frame. A smaller value will be a thinner wireframe. A value of .5 is good. Close the window.
Open up the Render Settings. Go to Window > Rendering Editors > Render Settings. In the Render Setting window Set Render using to Mental Ray. Open the Features tab. In the Contours menu check on Enable Contour Rendering. Raise the Oversample to 3 or 4 which will give a cleaner wireframe render. Open the Draw by properties menu set and check on Around all poly faces.
If the Mental Ray option does not appear in the drop down menu in the Set render option go to Window > Settings/Preferences > Plug-in Manger. In the Plug-in Manager window scroll down till you find the Mayatomr.mll and check loaded. The same can be done for the Vector render seen as VectorRender.mll.
You can set up a new render layer to keep the original shaders applied to the model. Switch the display option to the Render option. Select all of the objects you are going to render wireframes for and press the button on the far right with the blue sphere. There will be a new layer created. You can double click on the name of the layer and rename it to describe what is going to be rendered with that layer. For example “wireframe” or “wireframeRender.”
Select the wireframe layer. It should then be highlighted. Open the Hypershade window. Window > Rendering Editors > Hypershade. Select all the objects in the layer through the view port or right click on the layer itself and choose select objects in layer. Once they are selected locate the Mental Ray Wireframe shader created earlier and MMB drag over the objects or right click and choose assign material to selection.
With the wireframe render layer still highlighted render the image by going to to Render menu set > Render > Render Current Frame or press the render button highlighted in the menu bar.
You should get a wireframe that looks like the following. Make sure you do not have any subdivision smoothing on your objects.
Save your image. To save a single image in the Render View window go to File > Save image.
Name your file and change the file type to .tga (Targa) to keep the alpha information.
To render and save an animated sequence such as a turn table make sure you have set up your render settings as I went over in step 6. Set your frame range to the desired frames. Go to Render > Batch Render.
Make sure you have your render layer turned on to render. Here the wireframe layer is going to render in the batch render and the masterLayer is turned off and will not render which can be seen by the red x. To turn layers on and off press the button with the blue cube and sphere.
Vector Wireframe Set up
(Skip to step 25 if using Mental Ray wireframe set up to move onto After Effects.)
To set up the Vector wireframe set up your scene the same as was done in steps 1 through 9. Open up the Render settings. Go to Window > Rendering Editors > Render Settings.
In the Render Settings Window change Render using to Maya Vector. If it does not show up in the pull down menu load the plug-in as shown in step 15. Set the following attributes :
- Uncheck Fill Objects.
- Check Include Edges. Edge style: Outlines.Edge color: white.
Before you render harden the edges of your model. Select all of your objects > go to the Polygons Menu set > Normals > Harden Edge.
To render a single frame go to the render menu set > Render > Render Current Frame. To render a sequence go to the Render > Batch render and make sure you have set up your render settings shown in step 6.
In the Render View if you are saving a single image go to File > Save image. Name the file, choose the location, and change the file format to .tga to save the alpha information.
Bringing images into After Effects
Open After Effects. Create a composition. Composition > New Composition.
Set the properties for your composition. Composition name will be the name of the composition project. Set the width and height to the size you want for you final product. There are a list of preset sizes in the Preset pull down menu. Here the width and height are set to match the image size rendered from Maya. Frame rate is set to the same frame rate rendered out of Maya. Duration will be the time you have in the composition time line. In the example I have a sequence of 30 images which is only a second worth of time so 5 seconds is enough to work with. If you have several clips you want to adjust the duration accordingly. Press the OK button to close the window.
In the top right corner in the project tab you should now see the new composition.
Import image(s) or image sequences. Go to File > Import > Multiple File or File. If you have multiple rendered sequences use Multiple file for a quicker import.
Find the location of your images or image sequence. To import an image sequence select just the first image of the sequence and make sure the Targa sequence option is checked at the bottom of the window. Press the open button.
A pop up window like the following will appear. Press the Okay button. If you are importing multiple sequences it will take you back to the Import files window. Once you are done importing files press the Done button.
In the upper left corner under the project tab you should now see the imported images or image sequences
Pull the sequences into you composition. In the project tab in the upper left corner select the image sequences. Ctrl click to select multiple images or sequences. Left mouse button drag the imported files onto the composition. You should then see the sequences appear inside the composition at the bottom of the screen and in the viewport.
Reorganize the layers. Pull the wireframe sequence on top of the color sequence by selecting the layer and dragging it above the top of the color layer.
Change the blending mode of the wireframe layer to Screen. Select the wireframe layer > Right mouse button click > Blending Mode > Screen.
Since the color geometry is rendered out smooth and the wireframes are rendered unsmoothed you will start to see where some of the wireframes will protrude further out.
To fix this you can use the alpha channel of the color renders (targa images) as the alpha for the wireframe renders. Select the wireframe layer > Effect > Channel > Set Matte.
The Effects Control tab will open which is next to the project tab. Set Take Matte From Layer to the color sequence layer. Use For Matte should be set to Alpha Channel. The excess wireframe will then be cleaned up to match the color render.
Adjust the opacity. Open the wireframe attributes by pressing the triangle > open the transform attributes > opacity. You can change the value by typing in the number or left mouse button dragging over the number left or right.
Animate the opacity over time. If you have an animation where you only want the wireframe to show up at a certain time you can set key frame on the opacity or any other attribute by pressing the stop watch button icon next to the attribute.
Choose the point in which you want the key frame by placing the slider at a certain point in the time line and set the value of the attribute. Press the stop watch icon. Once you do so you will get a dimond shaped key frame visible in the time line. You can also move the keyframes by selecting and dragging the dimond icons to the desired position. Each change in the value of the opacity and position of the slider will create a new keyframe. To delete a keyframe select the diamond node and press delete. If the stop watch icon is pressed again it will delete all keyframes for that attribute.
Check the animation of the opacity by moving the slider along the timeline.
Once you have set up all of your sequences, attributes, and animation you can set the sequence to render a movie file. Scale the render area bar to include the image sequences by left mouse dragging the right end of the bar to match with the end of the image sequence(s). If there are no images for the rest of the four seconds it will render a blank video so make sure to adjust the rendered section. This bar can be moved to different areas and cover as much or as little of the sequence as desired. If you are doing a test of a specific area you can adjust it to cover a specific section to render.
Set up a video file render. Go to composition > Make Movie.
The Render Queue tab will open at the bottom of the screen. Here there are several options you can set: Render Settings, Output Module, and Output to. To open the menus click on the blue text.
Set the render settings. Quality should be set to best and resolution to full when doing a final render. If you are doing test renders you can set these to a lower quality and size.
Open output model settings. Format menu is where you choose the file type. Here Quicktime Movie is the chosen file type. Once the file type is chosen you will have format options according to the file type where you can set the compression.
Open output to settings. In the output to window you will choose where you want to save your file.
Press the render button. It will then show you a progress bar which will disappear when the rendering of the file is complete. You can now open it up and take a look at what we've created!