Square Enix © Goodbye Kansas

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 15 Next »

Table of Contents

This page provides information on the Image Sampler rollout in the Render Settings.

Overview


In V-Ray, an image sampler refers to an algorithm for calculating a pixel's color based on the colors within and around it.

Each pixel in a rendering can have only one color. To get the color of a pixel, V-Ray calculates it based on the object's material, direct light striking the object, and indirect lighting in the scene. But within a single pixel there might be multiple colors, which may come from multiple objects whose edges intersect at the same pixel, or even difference in brightness on the same object due to changes in object shape or falloff and/or shadowing of light sources.

To determine the right color for such a pixel, V-Ray looks at (or samples) colors from different parts of the pixel itself as well as the pixels around it. This process is called image sampling. V-Ray includes two main image samplers, each with its own approach to sampling and its own parameters: Progressive and Bucket. 

 

UI Path: ||Render Settings window|| > VRay tab > Image sampler rollout

GPU-based Production engine UI


CPU Production engine UI 

 


Image courtesy of Tuna Unalan

Multiple colors within a single pixel. What color should the pixel be? 

 



What is Anti-aliasing?


One of the functions of image sampling is anti-aliasing, which is the reduction of jagged edges in a rendering. The following example shows the basic difference between an image with anti-aliasing, and one without. 

If only one sample is taken for the each of the pixels around the edge of the sphere, the choice of pixel color is limited to the dark gray at the edge of the object, or the (white) background. Using one of these colors (i.e. taking only one sample) makes the image look jagged. This is the equivalent of no anti-aliasing at all.

If two or more samples are taken in each pixel, the colors are averaged, and pixels at the edge of the object end up being a color in between the dark gray of the sphere and the background. These in-between colors make the object appear smoother in the final rendering.

 

1
24

 

 

Image Sampler


Sampler type – Specifies the image sampler type. Specific parameters for the selected type appear at the bottom of this rollout.

Progressive – Progressively samples the entire image. See the Progressive Sampler for additional parameters. 
Bucket – Takes a variable number of samples per pixel depending on the difference in the intensity of the pixels. See the Bucket Sampler section for additional parameters. 

Min Shading Rate – Controls the number of primary rays shot for AA (anti-aliasing) versus secondary rays for other effects like glossy reflections, GI, area shadows, etc. Higher values mean that less time will be spent on AA, and more effort will be put in the sampling of shading effects. This approach is especially useful with the Progressive image sampler.

Not available when using a GPU-based Production engine.

Divide Shading Subdivs – This parameter is only available when Use local subdivs is enabled in the DMC Sampler rollout. By default, V-Ray divides the number of samples for lights, materials, etc by the number of AA samples in order to achieve roughly the same quality and number of rays when changing AA settings. For example, if you have 4 AA subdivs (=16 image samples) and 8 light subdivs (=64 shadow rays), V-Ray will trace 4 (=64/16) shadow rays for each image sample. This also means that if you want to sample a particular blurry effect with more than one sample, you need to increase its subdivs (sometimes way) above those of the image sampler. However, some users (especially those coming from other render engines) might find this inconvenient. This option allows them to turn off this feature and in this case the subdivs of lights, materials etc specify the number of subdivs for each image sample, thus allowing for more precise control of the sampling for these effects. With this option disabled, the above settings of 4 AA subdivs and 8 light subdivs will trace up to 1024 (=16*64) shadow rays, although V-Ray will still try to reduce that amount depending on the Global DMC sampler settings. The author is not fond of this approach, as (in his humble opinion) it does not make setting up a scene particularly faster or simpler and may add more confusion than needed, but if that's what users want, so be it. 

The Min. shading rate parameter continues to be valid for convenience. Also not available when using a GPU-based Production engine.

If you are not sure that you need to turn off the Divide shading subdivs option, or you do not fully understand what it does, leave it in the default state.

 


 

Render mask – Enables the render mask feature. The render mask allows you to define which pixels of the image are calculated. The rest of the pixels are left intact. This feature works best with the V-Ray frame buffer and the Bucket image sampler. The following types are available:

Disabled – The render mask is not used.
Texture – A texture map is used for the render mask. Black values in the map define pixels which are not rendered. Pixels with any other values are rendered. 
Object Set – A custom set of objects to render can be defined. 
Object IDs – Only objects with specified Object IDs will be rendered, you can list more than one by using commas to separate them.
Isolate Select – Uses Maya's Isolate Select option to only update items included in that viewport selection feature to update when (re)rendering. It is activated from the Show > Isolate select > View selected (or Ctrl+1) in the viewport menu. It works with both CPU and GPU renders in Production and IPR modes. Note: Lights cannot be isolated, they will always light the objects no matter if they are isolated in the viewport or not.

For more information, see the Render Mask example below.

Render mask clear – Available when the Render mask is enabled. When disabled, the masked region will be overlaid on top of the previous image in the VFB. This can be used for draft renders or fast shader previews provided that the camera does not move. Note: When rendering an animation, the image clearing is forced on.


AA filter – Enables AA filtering in the image. When disabled, V-Ray applies an internal 1x1 pixel box filter.

AA filter type – Specifies the filter type to be used for anti-aliasing. V-Ray supplies eight types of Anti-aliasing filters: Box, Area, Triangle, Lanczos, Sinc, CatmullRom, Gaussian and Cook Variable. Each has advantages and disadvantages, which make them useful for different tasks. V-Ray GPU supports only Box, Area, Lanczos and Gaussian filter types.

Size – Determines the size of the filter in pixels. Higher values yield blurrier results. To produce physically accurate results, the minimum value of this parameter is 1.000 and the maximum value is 20.000.  For more information, see the Anti-aliasing Filters example and the Anti-aliasing Filters and Moire Effects example below. 

 

 

 



Example: Render Mask

 

 

The original image.

 

The same image, only objects with chrome material were re-rendered.

The actual render mask image - RGB channels.

 

The actual render mask image - Alpha channel.




Isolate Select Render Mask Video

 

The following short demonstration video helps explain how the new Isolate Select Render Mask type works.

 

 

 

 




Example: Anti-aliasing Filters

 

Here is an example briefly demonstrating the effect of different anti-aliasing filters on the final result.

Note that rendering with a particular filter is not the same as rendering without a filter and then blurring the image in a post-processing program like Adobe Photoshop. Filters are applied on a sub-pixel level, over the individual sub-pixel samples. Therefore, applying the filter at render time produces a much more accurate and subtle result than applying it as a post effect. The zoomed in images below have been zoomed in and cropped 300%.

When the filtering is off, it internally applies 1x1 pixel box filter.

The Catmull-Rom filter is an edge-enhancing filter, often used for architectural visualizations. Note that edge enhancing can produce "moire" effects on detailed geometry.


 

Filtering is off.


Lanczos filter, size 2.5

 

Triangle filter

Sinc Filter, size 2.5

 

Box Filter, size 2.5

 

Area filter, size 2.5

Catmull-Rom

 

Cook Variable, size 2.5

 

Gaussian, size 2.5

 





Example: Anti-aliasing Filters and Moire Effects


This example demonstrates the effect anti-aliasing filters have on moire effects in your images. Sharpening filters may enhance moire effects, even if your image sampling rate is very high. Blurring filters reduce moire effects.

Note that moire effects are not necessarily a result of poor image sampling. In general, moire effects appear simply because the image is discretized into square pixels. As such, they are inherent to digital images. The effect can be reduced through the usage of different anti-aliasing filters, but is not completely avoidable.

The scene is very simple: a sphere with a very fine checker map applied. The images were rendered with a very high sampling rate (15 subdivs, or 225 rays/pixel). This is enough to produce quite an accurate approximation to the pixel values. Note that the image looks quite different depending on the filter:

 

No Filter

Box Filter

Area Filter, size 1.5

Area Filter, size 4.0

Triangle Filter, size 1.5

Lanczos Filter

Catmull Rom

Gaussian Filter, size 1.5

Gaussian filter, size 6.0

Drag the slider to change the filter type.

 

Progressive Sampler


The Progressive sampler renders the entire image progressively in passes, unlike the bucket method.

 

The advantage of this sampler is that you can see an image very quickly, and then let it refine for as long as necessary as additional passes are being computed. This is contrast to the bucket-based image samplers, where the image is not complete until the final bucket is done.

A disadvantage is that more data needs to be kept in memory, especially when working with render elements. Also, when using distributed rendering, because of the continuous refinement, frequent communication between the client machine and the render servers is required, which may reduce the CPU utilization on the render slaves. This effect can be controlled to some extent using the Ray bundle size parameter.

Avoid using the Progressive  sampler with sharpening image filters (Catmull-Rom, Mitchell-Netravali) as this may slow down the rendering - additional image samples will be required to resolve sharpening filters properly. V-Ray will print a warning in this case in the V-Ray messages window.

Min. subdivs – Controls the minimum number of samples that each pixel in the image will receive. The actual number of the samples is the square of the subdivs. Note: Not available when using a GPU-based Production engine. 

Max. subdivs – Controls the maximum number of samples that each pixel in the image will receive. The actual number of the samples is the square of the subdivs. If zero, the number of samples is not limited.

Noise threshold – The desired noise level in the image. If this is 0.0, the entire image is sampled uniformly until either the Max. subdivs value is reached or the Render time limit is reached.

Max. render time (min) – The maximum render time in minutes. When this number of minutes is reached, the renderer stops. This is the render time for the whole frame; it includes any GI prepasses like light cache, irradiance map, etc. If this is 0.0, the render is not limited in time.

Ray bundle size – Useful for distributed rendering to control the size of the chunk of work that is handed to each machine. When using distributed rendering, higher values may help to utilize CPUs on the render servers better.

 





Example: Stages of Rendering with the Progressive Sampler



 

Image after 1 pass

Image after 16 passes

Image after 64 passes

Image after 256 passes

1 pass
256 passes

 


Bucket Sampler


This sampler makes a variable number of samples per pixel based on the difference in intensity between the pixel and its neighbors.

 

 

 

This is the preferred sampler for images with lots of small details (like VRayFur for example) and/or blurry effects (DOF, motion blur, glossy reflections etc).

The diagram above shows visually the way V-Ray is placing samples when using the Bucket sampler. The black squares represent the pixels of the image while the dots represent the individual samples. In the first pass V-Ray always places the minimum number of samples determined by the Min. subdivs parameter. Then the color of the samples is compared and more are added where needed in the following passes.


 

Lock subdivs – Sets a fixed number of samples taken for each pixel.

Min subdivs – Determines the initial (minimum) number of samples taken for each pixel. You will rarely need to set this to more than 1, except if you have very thin lines that are not captured correctly, or fast moving objects if you use motion blur. The actual number of samples is the square of this number (e.g. 4 subdivs produce 16 samples per pixel).

Max subdivs – Determines the maximum number of samples for a pixel. The actual maximum number of samples is the square of this number (e.g. 4 subdivs produces a maximum of 16 samples). Note that V-Ray may take less than the maximum number of samples, if the difference in intensity of the neighboring pixels is small enough.

Threshold – The threshold that will be used to determine if a pixel needs more samples. For more information, see The Threshold Parameter example below.

 

 




Example: The Threshold Parameter


This example deals with texture anti-aliasing and the effect of the color threshold for the Bucket sampler. By default V-Ray anti-aliases everything in the image, including textures. This is especially useful for textures with small details or noisy bump maps. The Threshold parameter controls the extent to which texture anti-aliasing is performed. The effect of this parameter is most noticeable with low min rates. For the four images below, min/max rate of -3/2 was used:

 

Threshold 0.1

Threshold 1.0

Threshold 5.0

Threshold 10.0

0.1
10

 

 

Note that the edges of the object in those images are always sharp.  

If you set the Threshold to a high value, you are effectively telling V-Ray not to anti-alias textures. You can use this fact to speed up the rendering of complex materials. Note however, that this will disable anti-aliasing of V-Ray shadows, reflections etc as well.

 

Notes


  • A note on RAM usage: image samplers require substantial amount of RAM to store information about each bucket. Using large bucket sizes may take a lot of RAM.