Path tracing, sampler settings and noise reduction tips - prman-pixar/RenderManForBlender GitHub Wiki

Introduction

PRMan's RIS mode uses a sophisticated brute force path tracer to render a 2D image from a 3D scene. While it is much easier to produce high quality images compared to PRMan's historic REYES mode, RIS is often noticeably slower to render due to the high computational requirements for path tracing. However, there are a number of settings that can be tweaked to optimize the rendering process, so it helps to understand what those settings do and how they affect the results.

WARNING: Dry and boring technical discussion below......

Ray Types

There are several different types of rays used in PRMan depending on what part of the tracing process is being acted on.

  • Camera rays: These are the initial rays sent out from the camera plane into the 3D space. When you set the min/max number of samples you are controlling how many of these rays will be fired, per pixel, in order to generate the image. They are one of the most important ray types as they determine how well detail is resolved in the final image, especially when motion blur or defocus effects are used. They are also the most computationally expensive ray type.
  • Indirect rays: These are the rays that are generated once a camera ray hits an object. They are then responsible for tracing the light path through the remainder of it's bounces.
  • Light/BXDF rays: When a camera or indirect ray hits a surface, an indirect ray(s) is fired off based on the surface characteristics. In addition, a second ray(s) will be sent out directly towards a known light source (such as an area lamp). This ray(s) determines if (and how) that light source directly affects the surface.
  • Diffuse, Specular, Subsurface, Refractive rays: These are specific indirect rays that can be fired from a surface. Exactly which ray is used depends on material settings as well as sampling options.

Noise

Image noise is an unfortunate side effect of the path tracing process. It occurs when a pixel isn't sampled enough times to account for every possible light path that might affect it. Sampling every path for every pixel to get a perfectly noise free image is pretty much impossible, so the goal is to reduce the noise to a level where it isn't objectionable. Of course, what is considered objectionable will vary with what the project goals are. For instance, film based projects may not mind a little image noise, as it mimics film grain. Animation, on the other hand, usually requires noise free images, which can be achieved with PRMan's built in denoiser.
There are several different sources of noise, and each one can be reduced using certain parameters in the sampler settings. The following parameter examples use the PxrPathTracer integrator.

  • Aliasing noise, DoF noise and motion blur noise: This noise is caused by an insufficient number of camera rays being traced.
  • Diffuse/Specular/Refraction/Subsurface indirect noise: This noise is caused by insufficient indirect rays being fired for a particular surface type. this noise is most noticeable in shadowed or indirectly lit areas.
  • Specular highlight/Shadow edge noise: This noise is caused by insufficient light/BXDF samples.

Note: The workflow below is geared towards faster rendering of a still image. For animations it is best to leave all path settings at 1 and use the pixel variance setting to reduce noise.

Reducing Noise

The simplest and most direct way of reducing noise is to increase the max samples parameter to an extremely large value (like 1024 or 2048) and use the 'variance' setting to enable adaptive sampling. This is not ideal and can lead to long render times if abused. Camera rays are the most expensive ray to generate, but they themselves are not responsible for many of the noise sources in a scene, so the goal should be to keep the max sample parameter as low as possible and use the indirect and light/BXDF sample parameters to reduce most of the noise.

Take the following images:





Both are pretty much noise free, but the second one rendered a full minute faster than the first. A sample workflow for achieving this time reduction is as follows:

  • Switch to the Default integrator, this removes all shadows and indirect lighting. Set the 'variance' control to '0' so adaptive rendering is disabled.
  • Render a section of the scene that features high detail, displacement and/or motion blur/DoF. Look at the image. Is the detail aliased (i.e. looks like a staircase rather than a smooth line)? Is the motion trail noisy? If so increase the max samples parameter in powers of two (1, 2, 4, 8, 16, 32, etc) until the noise resolves to an acceptable level.

    Examples:

    32 max samples:


    64 max samples:

    At 64 samples the motion blur has lost it's speckled appearance. This should be an acceptable detail level for the camera rays.
  • Switch to the DirecLighting Integrator, this adds shadows and specular reflection but not indirect lighting. Update the 'maxSamples' parameter to the number you settled on from the last step.
  • Render a portion of the scene that contains shadow edges or specular highlights. Are they noisy? If so increase both the 'numLightSamples' and 'numBxdfSamples' parameters in powers of two until both clean up. While you can set the light/BXDF parameters to different numbers, often this will create additional noise rather than clean it up. For all intents the numbers should always be the same.<br.
    Examples:

    1 bxdf/light sample:


    4 bxdf/light samples:

    At 4 bxdf/light samples the shadow edge is clean enough to continue.
  • Switch over to the PxrPathTracer and update the 'maxSamples' 'numLightSamples' and 'numBxdfSamples' to the same numbers you had set in the DirectLighting integrator.
  • Render again and this time look at any indirectly lit areas. If there is noise you should raise the 'numIndirectSamples' parameter in powers of two until this noise is reduced to an acceptable level.

    Examples:

    1 indirect sample:


    4 indirect samples:

    In this case we can see that even 4 indirect samples isn't quite enough to get rid of the bounce light noise. Raising it to 8 should be enough.
  • After your ray counts are set, you can re-enable adaptive rendering by setting the variance to the appropriate level. This will likely save rendering time in areas of the image that are flat and with little detail.

While this method of rendering doesn't lead to much (if any) time reduction in simple scenes like a Cornell Box, once you start adding in heavy displacement, geometry, motion blur and DoF the benefits in render time can be significant.

⚠️ **GitHub.com Fallback** ⚠️