Thursday, March 31, 2011

Basic CGI Compositing Tutorial Result



Here's the video of what I made. It will, in fact, look even better without shitty youtube compression. So, follow from the start if you want to make a basic composited shot like this. And to make it for a longer feature just repeat the process for each shot.

Level four

So now we're going to open up after effects. First thing you're going to do is import your clip, so go file>import>file and find your clip. Now drag that clip form the project window onto the new composition icon lower down.
This will make a new composition for you with settings that match your video. Handy!

Now we go file>import>file again, but this time find the first image in the tiff sequence you just rendered, then making sure you check the "TIFF sequence" box you click open and you should now have your rendered shot.
These are the settings you'll be importing in.
Note: If you want to have a smoother model you can do another render of just your subject matter with mental ray and put that on top. these are the settings I would use
Firstly uncheck the "use depth map shadows" on whichever lights you have creating them

Then under render settings switch to Mental Ray and switch quality to production

I would recommend doing this because it allows you independent control of your shadows and your model.

So with both sequences in there your composition should look something like this
So now we click the arrow next to the shadow layer, which should be the lower one
And then down to Opacity, which we can mess around with until the scene looks right
I put mine down to 37%

Now, depending on the footage you're using you may one to use one or two effects to make it look more like the shot you are using. If you are doing an action shot you may want to use motion blur, or if you are using particularly low quality footage you can try and add some noise to your render. The effects list is on the right
Now we're going to add the composition to the render queue. So go composition>add to render queue
Make sure you go into the "output module" menu (it will say "lossless" to begin with) and check Audio Output on.
Then click format options and change the compression type to something high quality, like Apple ProRes 422.

Then we can click "render" and take a look at what we get.

And if it all turned out OK, then mission accomplished! I'll post up what I came to.

Step the third

OK, so technically the next step is animating, but this isn't an animation tutorial so you go do what you have to. Once you've got your animation done the next thing we've got to do is get things ready to render. So this means lighting and materials. Lighting is about using your eye more than anything else, but if I go through a few of the different lights and what different things do what you should be able to figure it out for yourself.
So I usually just switch to the rendering shelf for this stage, everything we'll need is there.
The first light we're going to talk about is the ambient light, which is especially important in outdoor scenes like this one. You're usually going to want to use at least a bit of ambient light, regardless of the setting, unless you're going for a particularly moody shot. The ambient light gives a pretty even wash over everything so it'll mean you can see pretty much everything.

This is the directional light, which is really good for simulating sunlight. It doesn't have a particular source so it'll just keep going in the direction you point it forever. It's pretty simple but other lights give you a little more control.
The point light is perhaps the most versatile of them all. You could probably light most scenes using nothing but point lights. With a point the light travels in all directions away from the source.
The spot light is useful because you can be very specific about where the light you are creating goes. I find the best way of using a spot light is to look through it (panels>look through selected camera) and you can see exactly where the light will begin and end. Adjust the Penumbra angle to soften (up) or harden (down) where the light ends and dropoff does the same from where it begins.

The final light we're going to talk about is the area light, which emits light from a surface area. This is good for simulating the light that comes from a doorway or a skylight.

There are also volume lights, but they're a bit more complicated so we won't go in to those now.

Right, so for this scene I've created an ambient light and a point light. The set up looks like this
So here the point light is basically simulating the sun. Next we've got to get the colour balance and intensity right. You're going to want to tweak these settings, which you'll find in the attribute editor
So because we're using a setup of more than one light we're definately going to lower the intensity. Also the shot I'm using isn't particularly light, so I've taken the ambient all the way down to 2. Note I haven't altered the colour on the ambient. It's not necessary to do that because we can do that with the point light. You may find, however, in your scene that it is better to alter the colour somewhat in other lights. You might, for example, want to use the slider to make the light closer to grey.
These are the settings on my point light. I've taken the intensity down again. Use the boxes for emit diffuse and emit specular to control how the light reacts with more reflective surfaces. I've also changed the colour to a more orange one. It looks closer to brown here but combined with the ambient light it'll hopefuly look quite close to the light in the scene.

The next thing we're going to do is add the shadows.
So we want the shadows to come from the point light in this case. You have to think about which shadows you need or don't need in your case. The best thing to do is look at your reference and try to mimic that.
Anyway, go to the drop down bars in the attribute editor of the light you're using.
Click "Use Depth Map Shadows"

Now we can tweak a few different things. The resolution is how detailed the shadows are. If you are making something with particularly sharp lighting you'll want to put this up pretty high, but for most cases we can leave it pretty low and make up for it using the filter size to disguise it.
The filter size basically softens up your shadows. For this shot I'm going to put the filter at 3 and up the resolution to 1050. This is what my shot looks like right now close up.
Now I'd say those shadows are a little too dark for the shot we're using here, so we can go up to the shadow colour slider and lower that quite a bit here.
A little better. This part is basically about trial and error. Just keep tweaking till it looks about right.

So the next step is how we stop the blocked out objects from appearing in our render, but still show the shadows.
Basically you need to select all the objects that you don't want to show up. So in this case it'll be the ground plane, and the three polygon cubes that make up the billboard. Then, still under the rendering shelf from before, press the use background tool
Everything should go green. Now when you render they won't show up, but the shadows they create will.
If you want to check the shadows to be sure that they're showing up ok switch to the alpha layer renderer by pressing this button


And now we can see what the alpha layer looks like we can see what will and won't be displayed in AfterEffects. Next we're going to want to take out the image plane we've been using for reference so far. So go to window>rendering editors>hypershade
Then we go to the Cameras tab
click on the image plane (on the left here) and press backspace to delete.

So the final part of this step is to render out your shot ready for compositing.

Near the top you'll find the render settings button
Click that and we can make sure everything is set up right for this.



We're going to render in .tif files. I always have the naming conventions as "name_#.ext" with a frame padding of 3 (the frame padding indicates how long the frame number will be, so frame one with 3 frame padding will be frame 001. So your frame padding would be 4 for 1000 frames. See?)
Make sure you set your end frame so that you don't cut anything off/render too much. Set your camera too. Don't want to be rendering the wrong view. And the image size will be whatever size the footage you're working with is. Mine is 489x320 because I got my footage from youtube. Which is also why it's such good quality.
So under the Maya Software tab just put it on production quality and leave the defaults.

Now we can render! Go render>batch render
If you're having trouble here you may not have the rendering toolbar up, check that here

And come back after that's rendered for the fourth step!

Second Step

Right, the next stage is to get everything ready for the animation. We're going to want to get the camera angles just right so that we get the illusion of perspective and distance when things are moving. The easiest way to do this is with a reference point. Try and find something relatively geometric. In my shot we're going to use the sign in the background.
Make sure the Polygon shelf is selected
then select the polygon cube tool
Now, using a combination of the move and scale tool you should be able to position it in about the right position over the sign
Now, obviously we can't see through this. It's hard to match up something we can't see through.
So! Go to shading>x-ray
And now we can see a little better how we're measuring up.
Now we can start tweaking to make it just right. This is where it really helps to know the camera settings of the footage you're using, but if you don't you can just guess to get it about right.

So you're going to want to select your camera again (window>outliner>camera1) and then click on the channel editor button on the top right if it's not already there
The one on the right here
Now the only thing we're going to worry about is "Focal Length". It'll be about 35 by default. Basically the lower this is the more extreme your perspective is going to become. In my shot it doesn't need a particularly dramatic change, buy you might need to tweak it a bit more in yours. I'm going to put it at 30. Now it looks like this:
Next thing we do is block out the objects that are affected by whatever you're putting in the scene. In my scene we're going to have the character looking out over the board, so we can block that out. We'll also put in a ground plane because he'll be on the floor and casting a shadow.
So use the various polygon tools to make whatever you need and have it match up as closely as possible with what you see in the scene. It's not necessary to create what isn't affected by your object. You're going to want to model from the perspective view so as not to mess about with the camera position, so go panels>perspective>persp.
Here's what I've done:

You'll notice a couple of things with this. Firstly I've not modelled the right hand side. As I said, that's because our character isn't interacting with that object. Secondly you'll notice that it's a little rough. You don't need to worry too much about detail here. These objects aren't even going to be visible in your final shot. Also notice that I've blocked everything out on the flat. There should only be slopes and angles in the blockout when there are slopes and angles in real life, that way the shadows will all fall in the right place.

Step One!

OK, step one.
Get your movie file that you want to put your 3D animation in to. Make sure it's something that can be opened in AfterEffects, so a .mov is a safe bet.
Now we're going to put that in to maya.
So open up the file you want to use for animating. Perhaps a character or object you want to put in there.
This is what I've opened: The Moom rig
Now we're going to create a camera to use for our animating.
I'm going to use default tool shelves for everything so you won't have trouble finding anything.
So go to the bar at the top and click "create>cameras>camera"

Now, while the camera is selected we can use the move tool to position it. But it's a little easier to position the camera through the view finder, so we're going to go to the lower bar and select "panels>look through selected camera"
Now we click on the attribute editor icon at the top right

Of these three icons it is the one on the left

Now we're presented with a list of options and drop down bars. The one we're looking for first is the one labeled "movement options"
You need to make sure "Undoable Movements" is selected. That way if we accidentaly move the camera later on we can take the action back and won't have to spend forever trying to position things right again.
Next we need to go to the "Environment" section
Next to "image plane" click "Create"
On this new menu, scroll down until you get to the part that says "type". Leave that as it is for now, check the box that says "use image sequence". (the image name box will be empty for you just now)
Next click on the little folder next to the "Image Name" box. Now find the movie file you want to use for compositing.

 Now your window should look a bit like this.