header printable version

In this tutorial we are going to look at the process of rendering in a more in depth way.

Rendering involves far more than just hitting a button and letting the computer do it's thing. As with everything else in Maya, you have a million settings to make it do what you want. Some are more apparent then others and some are more costly in terms of render time than others.

This tutorial, rather than being solely a step-by-step how to, is going to be a balance between introduction and instruction. I am going to introduce you to some concepts, some settings and some tools and then leave the work to you. For those of you who are sweating right now, don't worry. I will still give you some step by steps and screen shots for setups etc. I just won't hold your hand the whole time. You are big kids now after all aren't you?

So, our models are textured and our animation are done. Now we need to render it... Ok... Can't we just hit the button? The short answer is, um...well...yeah. The long answer is NO, ARE YOU KIDDING ME?!?!?!?

You just spent all that time working meticulous detail into your model and animation and you just want to let Maya have it and spit something out. Don't you think you owe it to yourself to at least spend a little time trying to make the render look good. After all, that is what you will be showing everyone upon completion. Possibly for your mom's fridge, your boss at work or, oh I don't know, your TEACHER?

Alright, so now you are thinking, geez... this guy just won't let up...Fine... I will just crank all of the settings to the max and THEN hit the render button. Uber Max Quality couldn't possibly be a bad thing right? Again, you can do that if you want, but then again, you will probably still be waiting for it to finish while everyone else is retiring.

Are you frustrated yet?

Don't worry, we are going to look at the important base level settings that you will need to worry about to get your renders to look nice and still have a decent render time. As a bonus for your hard work I will also show you some cool stuff that will make your renders look even better. It's okay. You can say it .I am happy that I am your teacher too. :-)

By the way, for continuity we will be using Mental Ray for the rendering in this entire tutorial.

For the first part of the tutorial we are going to look at render quality vs. efficiency. Below is a checklist of those items.

Here they are:
  1. Anti-Aliasing
  2. Raytracing
  3. Scene and Render Resolutions
Lets get started shall we!

First we need to Acquire a model to work on.

  1. 1. Download mentalRay.zip and save it to your maya projects directory
  2. 2. Unzip/Extract the mentalRay.zip file so that you have the stillLife project folder in your maya projects directory.
  3. 3. Open maya and go to file> Project> Set
  4. 4. Go to file>Open Scene and choose the stillLife_clean.ma file
  5. 5. Once the file is opened you should see the Still Life model sitting on the grid. See image below.

Next, lets do a quick render to see what we get by doing nothing to our settings.

To make sure we are rendering in Mental Ray:

1. Open your Render Settings window.
2. Click and hold on the drop down menu at the top.
3. Choose mental ray from the list.



Yuuuuuuuuuuucccccckkkkkkk!!!!!

If you don't see why I am so upset. Look again. Check out the edges where it goes from Model to background. What you are seeing is something called Aliasing.

Aliasing is the process where a grid of pixels (or our image) tries to define a diagonal line you tend to get a stepped pattern. Look at the 2 letters below.

letters

The 'A' on the left is a fully 'aliased rendering. It is kind of like trying to build a diagonal line with Lego blocks. Sure you can make it happen, but it gives you a stepped look.
The 'A' on the right has gone through a process called 'anti-aliasing'. What happens is the pixels that surround those that quickly go from Black to White are given a value of gray to help 'smooth' the transition. While there is still a clear stepping patter evident with these large letters at a low-resolution it definitely looks more smooth.

Lets look at how this is handled in Maya.

Open Maya's Render Settings. Click on the quality tab and open up the Anti-Aliasing Quality section. see image below.

antialising

Among all of these settings there are mainly 2 that you need to worry about.

1. The Max Sample Level

2. Filter

Right now the Max Sample level is set to 0. Which yields a sampling of 1 sample per pixel. What this means is that during render time when Mental Ray renders a given pixel it only samples itself to determine whether any anti-aliasing needs to be applied. Basically having this at 0 means you get a fully aliased image.

Changing the Max Sample Level to 1 will now set the sampling to 4 samples per pixel, which is better, but still pretty aliased. (see image below)

sample1

Changing the Max Sample Level to 2 will now set the sampling to 16 samples per pixel. This time it is pretty darn good, but in circumstances like this we need just a bit more. (see image below)

sample2

Finally changing the Max Sample Level to 3 will now set the sampling to 64 samples per pixel. This is about as clean as we really need to get for a rendering like this. (see image below)

sample3

I hope you noticed that your render times got longer as you increased the Max Sample Level. You need to be aware of how this number effects both your final render "look" and your final render "time."

If your render times are getting really long but you are not seeing a significant change in the quality. Do not worry about bumping your levels higher. Treat it on a case-by-case basis.

As I mentioned above the other section to look at here is the "filter."


The filter is the algorithm that is used for "how" the pixels are sampled and how smooth/sharp the final render will become.

The choices you have are 'box', 'triangle', 'gauss', 'mitchell', 'lanczos'.

Box tends to be a bit sharp but a bit low quality.

Triangle is a little softer then box and a medium quality.

Gauss is the most soft of all of them and has a fairly high quality.

Mitchell is the sharpest of them all and has a high quality.

Lanczos is a balance between Gauss and Mitchell in terms of sharpness and has a high quality.

You will want to treat each render separately as to which filter to use. In some cases even the low quality one will work best. I tend to use the Mitchell filter 99% of the time.

Below is our final image Rendered with a Max Sample Level of 3 with the Mitchell filter.
sample3mitchell

While it looks WAAAAAY better than our first image, it definitely took longer to render. In our case this render time is more than fine, however, you will need to judge this on a case by case basis.

Now you know how though :-)

Milestone 'A' has been covered! We now know what anti-aliasing is and how to control it. Let's recap and see what we need to do next.
  1. Anti-Aliasingcheck
  2. Raytracing
  3. Scene and Render Resolutions
Milestone B is to look at Ray tracing. What it is and how to control it to get the best quality for the least amount of render time.
  1. To talk about raytracing we need to have a scene that actually utilizes some ray tracing features to see how our settings effect things.
    1. Open the stillLife_raytracing.ma file
    2. Once the file is opened you should see the Still Life model again sitting on the grid. This time with some shaders attached to the various pieces. See image below.

  2. raytracescene

    If we render the scene as is you will see some of the effects of having both ray tracing turned on and having shaders that respond to its effects. (see image below)

    raytrace1

  3. You should see reflections and refractions throughout the image. Lets have a look at the settings. Open your Render Settings and swing open the section titled 'Ray Tracing'.

    raysettings1

    By checking the 'Ray Tracing' box it enables ray tracing in our scene, but what is ray tracing anyway and what does it do?
    I am glad you asked... Here is a quick run-down.
    When mental ray renders a given image it has to calculate what each pixels final color should be. This process includes sampling your objects shape, shaders, textures, lights, anti-aliasing, filters etc.
    When ray tracing is enabled that pixel sampling process is calculated by literally sending a ray out from the camera at a given pixel. If that ray strikes an object in your scene and it has not yet exceeded your 'bounce limit' it will reflect off of your object. At this point it will sample for new objects to reflect, light sources and shadows. If it goes off into space the final pixel color returned will be that of the first objects properties. However, if it hits another object the new object's properties will be sampled and combined with the first objects properties giving you the final combined color of that given pixel. (See the diagram below)

  4. raytracediagram

    You are probably already seeing why just turning raytracing on causes your render times to increase. Increasing the amount of bounces that happen during various stages of raytracing only multiplies that increase in render time.

    Okay, so we know it makes things longer. The important things to know are.
    1. When to use ray tracing and when not to.
    2. How to limit your ray bounces to make sure you are maximizing your efficiency

      While we definitely saw the effects of raytracing in the image above, there are some things that just do not look right. For instance, the glass inkwell doesn't really look transparent. It's almost like it is glass that we just cannot see through.We also only see a single reflection on any given surface. Meaning we only see one set of reflections rather than as many as would be expected.

      To fix this we need to increase our reflection and refraction ray bounces in our mental ray render settings.
      1. A reflection is light that bounces off of an object and transmits onto another. (example: chrome)
      2. A refraction is light that transmits through an object onto one behind it (example: glass or water)

        We can limit each of these 'ray tracing' calculations individually in mental ray, but how do we know what to set it to.
      3. In this scene we probably do not need more than 2 or 3 reflection rays. So let's set it to 2.

        Refraction rays are directly related to transparent objects. If an object is transparent and you want a ray to transmit all the way through you need to count the amount of surfaces the ray needs to pass through and use number that is at least that large.
      4. In our case our inkWell has 4 surfaces the rays need to pass through so lets set our refraction rays to 4.
      5. The Max Trace Depth is essentially a max clipping for both reflections and refractions. In this case since we need 2 reflections and 4 refractions, our Max Trace Depth needs to be larger then 6. If we set it lower than 6, let's say 4, we would only get 2 reflection and 2 refraction rays. However, setting it to 8 won't increase the render time because the reflection and refraction rays finalize before we reach the max. Basically follow this equation.

        Max Trace Depth >= Reflections + Refractions

        raysettings2

    If we do a render now this is what you should expect to see.
    raytrace2
  5. See how the glass now correctly reflects our scene elements and refracts the background. It looks like glass.

    By accurately setting our reflection rays, refraction rays, and max trace depth we optimize the quality of our render without sacrificing much in the way of render time.

    Pretty Cool huh?


Milestone 'B' has been covered! We now know what raytracing is and how to control it. Let's recap and see what we need to do next.
  1. Anti-Aliasingcheck
  2. Raytracingcheck
  3. Scene and Render Resolutions


  1. The last thing we are going to look in our section on mental ray render quality vs. optimization is your various 'Scene' and 'Render' Resolutions.

    Throughout the semester I have had you rendering your images at various resolutions. Some at 853x480, others at 1920x1080, and still at 1280x720.
    What do these numbers mean and what significance do they have to requirements and optimization.

    These numbers determine the resolution of your final image. Or the amount of pixels your image will be width 'by' height. Look at the images below for a comparison.


    As you can see. The more pixels you have in the resolution the more clear an image becomes. Not only that the amount of pixels that need to be rendered increases exponentially as well.
    The left image only requires 1 (1x1) pixel to be rendered while the right image requires 10000 (100x100) pixels to be rendered. That means that the time it takes mental ray to render the left image vs. the right image will take approximately 10000 times longer to calculate.

    Now, obviously you can't simply reduce your render resolution to get faster render times all the time. More often then not you will have resolution requirements depending on your output. That may be 720x480 for wide screen NTSC, 640x480 for Standard Definition NTSC, or maybe 720p HD which is (1280x720). Further still you may need to render to various print or web resolutions.
  2. The most important thing with resolution is to know your final size requirements and render to that. If you are rendering for a final output of Standard Definition TV (640x480). It doesn't make a whole lot of sense to render to High Definition 720p (1280x720). That render would take approximately 3 times as long to render when you are just going to reduce the resolution for final output anyway.

    Wasteful Wasteful Wasteful
    Lets do a couple renders of our still life for comparison.
    1. Open the render settings and go to the common tab.
    2. Scroll down to the 'image size' section
    3. Set your width to 1280 and your height to 720
    4. Do a render and note the render time listed at the bottom of your render view once it is complete.
    5. Now lets set the width to 640 and the height to 480
    6. Do a render and again note the render time listed at the bottom of your render view once it is complete.
      SDrender21

      Here we have hard evidence of that render increase. On my computer, the HD render took 27 seconds to render and the SD render took 11 seconds to render. Pretty close to 3 times as long. Now if we have to render to HD we don't have a choice, but if we have a final output of SD then it doesn't make sense to take that 3X render hit for no reason.
      Bottom line... Know your output and render to that. Don't do more than you have to. You will likely be already cutting some quality for render time so arbitrarily increasing it for no reason makes no sense.

      Do everything for a reason!


The last thing we are going to look at are some resolutions and settings within maya that do increase quality, but to a point become pointless. This is going to be a quick sampling of these settings to watch out for.


The first thing we are going to look at is shadows.
    1. If you are using depth map shadows you may need to increase the resolution of the depth map to remove artifacts. Increasing this number will increase render times. Watch out!
      depthMap
      This is especially important when using depth map shadows with point lights. Point lights will create 6 different depth maps each (+x,-x,+y,-y,+z,-z).
    2. If you are using ray traced shadows you of course need to have raytracing turned on in the render globals. However, in your lights shadow settings you may want your shadows to be softer. You do that by increasing the light angle. However, you also need to increase the rays to avoid noisy shadows. Increasing this number also increases render time.
      rayshadows
      So balance the angle vs. rays to get the quality you want without killing your render time.
    3. The last resolution optimization I am going to mention is that of 'file textures'.
      1. Lets say you have a collection of file textures you are using in your scene. (Such as with our craps table)\
      2. Each of those file textures have a specific resolution. As you would imagine the larger the image the better it will look when used in your renders. However, just as with everything else, the price of quality is render time.
      3. The rule when determining how low a resolution a file texture can be before it pixelates is based on how much "pixel space" it takes up in the final render.
        1. Let's look at our still life scene. Let's say we have a picture we want to use on the right page of the book. How small can it be before it looks bad?
          raytrace1
        2. By this measurement as long as we do not zoom closer to this book the lowest resolution the texture for that page can be is 200x200.
        3. If our texture map we plan on using is a scan of a book that is 2000x3000 pixels. That is a bit overkill don't you think?
          Especially because that texture map has to be loaded into memory each time it needs to be accessed. That includes every time a ray hits the object that contains the map. Both reflections and refractions. Over time this pointless image resolution starts to really kill our render for no reason.
        An important thing to point out here is that you DO NOT need to measure everything all of the time in order to do texturing. However, having a general idea of how a texture is going to be used must be on your mind. If you need to speed up your renders, check your images and decrease those that can be.

        DO NOT just use large images because you can, and DO NOT just make them all small because you can. Simply keep this problem and it's effects in mind while working.
Milestone 'C' has been covered! We now know what main things should be checked to optimize our rendering quality and times.
  1. Anti-Aliasingcheck
  2. Raytracingcheck
  3. Scene and Render Resolutionscheck

    check For this tutorial you will be handing in a rendered image of this stillLife scene that has good anti-aliasing and correct reflection and refraction bounces. Basically submit the final image you get when you work through this tutorial.

    Above all I want to see good renders here.

    You must include the following settings/elements in your render
    1. Good Anti-Aliasing.
    2. Raytracing Optimization.
    3. Render your final image to 640x480.