Monday, April 25, 2011

Mental Ray Sampling cont. -- Fast Rasterizer, Shades per Pixel

In this post we'll look at some renders using the Fast Rasterizer having determined that 64 Samples per Pixel will provide a good quality render, as good as the  Minimum Maximum render sampling option set to 4 & 64.
Rendering with 1 Shade per Pixel seems to look good enough but further evaluation of some different parts of our renders will show that we need to increase the 'Shades Per Pixel" to insure the best quality.

Example 1 shows a benchmark using the Minimum Maximum method reviewed a few posts back. We've set min = 4 and max=64 as demonstrated in that post for best quality. Let's focus on the shadow created by the sign highlighted in red. Render time = 16 minutes for the full frame (864 x 486) of which this is only a small portion:

Next is an Example using Fast Rasterizer with Samples set to 64 and Shades Per Pixel set to 1. Clearly some artifacts in the shadows of the signs. These will flicker in an animation also. However, note that the render time = 2.5 min!:

Example 3 shows the result of increasing Shades Per Pixel to 4. Clearly an improvement, but careful examination will show that the shadows are still not quite as cleanly anti-aliased as example 1:

Finally, let's increase the Shades Per Pixel to 6. This will yield a render as good as the Min Max option in example 1, but the render time?.....4.3 minutes!

In summary, the Fast Rasterizer is a much faster rendering algorithm than the default Minimum Maximum option and with some tweaks can provide superb quality renderings in 1/2 to 1/4 the render time. I noted an exception to this in an earlier post. This occurs when you are rendering a frame that contains mostly a blank background or background image, for example a render intended for compositing. The Minimum Maximum sampling option discriminates about the amount of sampling to do for each pixel based on the Spatial Contrast settings. Some buckets will render very fast while others will take a long time. With an absence of 3D elements in the bucket, the renderer will blow through these buckets very quickly. The Fast Rasterizer is not so discriminating and will render all buckets with a more uniform render time, regardless of what is being rendered and hence these types of frames can take longer to render with fast rasterizer.

Next I'll show some quick examples of the parking lot stripes rendered in an animation to show how the results affect anti-aliasing "flicker".

Mental Ray Sampling cont. -- Fast Rasterizer

In this post we'll consider the same scene as the last post but we'll change the Rendering Algorithm and Sampling options to "Fast Rasterizer". This option ignores the Minimum Maximum and Spatial Quality settings and includes its own "Samples" and "Shades per pixel" settings instead.

Example 1 : This is rendered with the default settings for Fast Rasterizer, 16 samples and 1 shade per pixel.
An improvement over anything but the best settings from the Minimum Maximum option discussed earlier, however, still rather poor quality anti-aliasing. Note that this will also flicker badly in an animation. Render time for the full frame (640 x 360) =  35 sec.

Example 2: Fast Rasterizer Samples set to 36. 1 Shade per pixel. Again, a slightly better quality as expected:

 Next Example is the same as above but uses the "Mitchell" filter (4x4). Still a better render:

Finally, a Fast Rasterizer Example with Samples set to 64 and 1 Shade, using the Mitchell filter: 
Now the big news. The above example, rendered at full frame (640 x 360) and equal or better in quality than the best render with Minimum Maximum method, rendered in 45 seconds. That's half the time!
Next we'll look at the 'Shades per Pixel" option with the Fast Rasterizer.

Mental Ray Sampling cont. -- Min/Max method

This is a multi-part post continuing with findings related to Mental Ray's various "Sampling" settings in 3ds Max. The test scene (taken from a recent project) involves an exterior with a camera fly-down. Included in the scene is a parking lot with 3D stripes on a terrain surface and later, a view from near the surface of the parking lot with a few street signs casting shadows. Both the stripes and the shadows figure strongly in decisions related to the sampling settings required to create a quality rendering, both for an animation and for still shots.
First some examples to help make some decisions about utilizing the "Minimum Maximum" sampling option. The "Fast Rasterizer" and "Min Max" options are mutually exclusive with some different choices related to quality and speed of render. In a previous post I mentioned that the Fast Rasterizer method seemed a better choice for speed vs quality and the examples in these next 2 posts will bare this out with one exception which I'll note later. Before we discuss the issue with animations, lets take a look at some single frame renders. Note that all the following renders are zoomed in portions of a full frame at 640 x 360. The zoomed in region will make the differences presented more easily seen. We are interested in settings to create the final beauty shot here, not previews or test renders.

Example 1 shows a render with the Minimum Maximum method set to 1 and 16 respectively. No pixel will be sampled less than once. A decent setting but as the render shows, the parking lot stripes barely even show up, so this is not a viable option for a quality render and so not worth discussing further. (Note that 3ds max considers this to be a "High" quality setting).

Example 2: So what happens if we increase the Minimum to 4. Notice that it's an improvement, but some of the stripes either don't show up or show up poorly:
Example 3: Well, what if we increse just the Maximum option (1 and 64 repsectively). Again, missing or poor quality stripes:

Example 4: If we use 4 and 64 for min and max respectively we'll get an acceptible rendering:

All of the above renders used the "Box" filter set to 1 x 1. Render time for the full frame of the last sample at 4 and 64, min & max, was 1:33. As a comparison, here is the same render with the "Mitchell" filter set to 4x4 which provides a slightly better anti-aliasing computation at the cost of a little more render time (1:53):

In the next post we'll look at the same scene and views with the Fast Rasterizer.

Friday, March 11, 2011

Mental Ray Sky Portals

Although the use of the sky portals is a nice and recommended workflow for getting outside skylight into your interiors, it seems the Soft Shadow quality and Shadow Samples can be a killer for render times if you have a bunch of these in your scene. My latest scene required 16 of these, and that was with a lot of overlap on the exterior walls to minimize the number of Portals. Likewise, if I remember correctly, the Sky Portals render black from the backside if you are veiwing an exterior with the sky portals active (think of a transition from exterior to interior where the interior is lit primarily by these sky portals). I could be mistaken about this and need to double check the scenario in which I saw it. However, in scenes with large amounts of windows in a lot of different places, I used a workaround, creating Plane objects that mimic the sky portals but have a self illumiated Arch and Design Material assigned. Place these planes just inside the window and uncheck "Visible to Camera" in their properties. Tweak the Illumination settings to your liking. Although they don't cast shadows, their illumination seems to render much faster and gets that "outside" light look into your interiors.

Mental Ray Sampling

Having spent some more time with the sampling settings (will be posting images soon) I wouldn't attempt a final render with Min/ Max set to anything lower than 4 and 64. Actually 4 and 256 is my recommendation for minimum "safe" quality to avoid flickering pixels in small details. However, using Fast Rasterizer in the same scene with Samples set to 64 (or even as low as 25 or 36) can yield equivilent results at much lower render times. Definitely worth testing as you approach final render time estimates in projects.

Mental Ray and Forest Pack Pro

Noting that it seems "Fast Rasterizer" is generally a speed improvement for a lot of Mental Ray render scenes, it does not work with Forest Pack Pro, even with some adjustments to the settings and Forest Material. Of course you are warned when trying to render with settings other then those recommended by Forest. Still, a little tweaking and testing with different settings or non-conventional workflows can often lead to a better understanding of the conventional process.  So disabling "Scanline" and hence the Fast Rasterizer is required for the Forest Pack trees to render correctly with the Forest Material.
Although replacing the Forest Material with a conventional 'Standard" Material works, the render times do increase. Obviously the Forest Material shader is optimized by itoo for Mental Ray and works very well.
In addition, testing with Mental Ray Proxies vs the Forest Pack's Planes (using the same forest but the proxies as 'Custom Objects") shows that the Planes render faster. Surprise there.
Obviously Forest still suffers from the dreaded Top view scenario, but I have a few ideas for workarounds that I'll be testing.

Monday, March 7, 2011

More to come soon on Mental Ray Sampling settings

Will be posting some images and hopefully short clips to show the results of the different sampling settings I'm obsessed with right now. Support for how to use these settings correctly is woefully lacking, but their impact on your render times and image quality is dramatic.

UVW Unwrap and texture maps

I did not kow that the UVW Unwrap Modifier retains the images it uses in its editor as maps that are used in the scene, even when you've assigned a different material to the object. So again, any map that was used in the UVW Unwrap editor stills shows up in the Materials Editor as being used in the scene, even when its Material has been removed. You have to collapse the object to get rid of the map in the scene. Something new everyday...

Friday, March 4, 2011

Mental Ray Sampling

The fast rasterizer seems to work better and faster than the "min/max" and 'spatial contrast" method for fine details. Not sure how this will work in a large scene with full frames though. More testing needed to determine that.