mental ray – In the Lab

This is the first post of a new category: NVIDIA mental ray – In the Lab. We want to give peeks into research projects and features we are working on for future versions of mental ray. Here we like to talk about our GPU accelerated Ambient Occlusion solution, in short: AO GPU.

The video demonstrates three new features of AO GPU: Progressive Rendering, High Quality Anti-Aliasing and Object Instancing. It was generated using a standalone test application, using a NVIDIA Quadro K6000 GPU.

Progressive Rendering

Previously, AO GPU used a sampling mode optimized for batch rendering. This sampling scheme, based on Fibonacci numbers, converges very fast and efficiently to good results. The caveat is that you have to know the number of samples in advance, plus there are only certain sample numbers you are allowed to use (1, 2, 3, 5, 8, 13, …). If you stop rendering ‘in-between’, the image will look wrong.

Now, sometimes you are not sure how many samples are needed to achieve the desired quality. The usual solution is to perform progressive rendering, which means watching intermediate rendering results and stop the render process when quality is good enough. As you can see in the video, Fibonacci sampling is not suited for progressive rendering, intermediate images show strange wobbling shadow effects (we moved the camera to trigger a re-rendering in the application). Switching to our new progressive sampling scheme fixes the wobbling artifacts, you just see the noise disappearing over time.

This progressive sampling scheme does not converge as fast but it is well suited for ‘time-constrained’ situations, where you want to stop rendering after a certain time limit, and you are not sure what the best sample count setting would be.

High Quality Anti-Aliasing

The existing AO GPU solution used a very simple anti-aliasing scheme to filter pixel jaggies at geometric edges. Essentially, this filtering was constrained to the area of a single pixel, and every sample was equally weighted. Of course, for some scenes this simple Box filtering is not good enough. In the video, we magnified a detail of such a scene to show the problem. Look at the dark vertical gap between the doors of the cupboard; it looks staggered even with many anti-aliasing samples.

We added new filters to improve this. Anti-aliasing now samples in larger area than only a single pixel, and the samples are weighted according to a filter curve. In the video, we switch to a special Gauss filter curve with a sampling area of 3 pixels diameter, and you should see that the lines look much better now. Other available filter curves are ‘Triangle’ and ‘Gauss’.

Object Instancing

For complex scenes, memory consumption is always a concern. The model shown in the video has 21 million triangles, using about 3 GBytes of GPU memory. If we want to render more objects, then we might lose GPU acceleration, because additional models do not fit anymore into GPU memory. The current AO GPU solution will switch to CPU rendering automatically, but rendering will take much longer. If the additional objects consist of the same model, then the model can be reused in the rendering without taking much more memory. This model-replication technique is called instancing.

We implemented instancing in the AO GPU prototype to see how far we can get with this technique on a GPU. As the video shows, a million replicas are no problem.

We hope you enjoyed reading this post and watching the video.

17 thoughts on “mental ray – In the Lab

  1. Stefan says:

    Thank you for the inside! It’s exciting to see what’s going on behind the scenes 🙂 Looking forward to more In the Lab posts!

    One question: GPU AO currently seems not to be able to consider bump maps. Will this be possible in the future?

    1. nvrajko says:

      Since AO GPU does not call shaders, bump maps will not have an effect, because this is a shading effect. On the other hand, displacement mapping works perfectly fine, because it creates real surface structure.

  2. any chance of taking “cutout opacity” into account with AO GPU?
    it’s limiting not being able to see it reflected in AO, as it is the case with the “mib_amb_occlusion” shader, for example.

    1. nvrajko says:

      AO GPU generates a separate image, in parallel to the main image rendered by the mental ray core. This image (framebuffer) can then be used for compositing. At the moment, no mental ray shaders are used to render AO, so cutout opacity is not available (as well as AO seen through transparent or reflected elements). We would need to capture shading information for the AO GPU process. We have some ideas, how to do that, so stay tuned for future updates. 🙂

    1. nvrajko says:

      Right, motion blur and depth of field are not supported. Not sure how useful that would be, since AO GPU generates a separate image for compositing.

      1. Stefan says:

        I think, motion blur and dof is essential. If I have motion blur in my beauty I need motion blur in my AO, too. Otherwise it would look odd if I multiply them. Or am I wrong?

      2. Gabriel Gazzan says:

        It seems logical to me too.
        Compositing a render pass that has motion blur with an AO pass that does not, would look odd.
        Besides, the fact that the “mib_amb_occlusion” and “mib_fast_occlusion” shaders do take MB into account, seem to prove that someone before considered it useful 🙂

  3. Tri says:

    Any official announcement, as to when should we -finally- expect that kind of progressive render view in Maya ?
    So many years passed without a true and inbuilt solution.
    Now that the competition, offers it by default, it’s time MentalRay offers such essential feature as well.
    Please keep us posted

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s