Render Pixel Sampler

From Terragen Documentation from Planetside Software
Jump to: navigation, search

Render Pixel Sampler

Render Pixel Sampler[edit]

The Render Pixel Sampler can be opened from Render > Quality > "Edit sampling".

The Render Pixel Sampler is a node containing the parameters for the adaptive pixel sampler. It is contained in the internal network of the Render node. It is safe to delete a Render Pixel Sampler node, but another one may be created with default settings the next time an image is rendered or you press the Edit Sampling button. You should not create additional Render Pixel Sampler nodes as this may result in unexpected behaviour.

Anti-aliasing[edit]

One of the most important settings for controlling the quality of your image—and the time it takes to render—is the Anti-aliasing (AA) parameter on the Quality tab of the renderer. This parameter is also shown in the Render Pixel Sampler. The square of the anti-aliasing number tells you the maximum number of primary rays that are traced per pixel of the image, or in other words the maximum samples per pixel. An anti-aliasing value of 3 means that up to 9 samples can be taken per pixel; a value of 8 means that some pixels may take up to 64 samples, and this is usually enough for very good images. Adaptive sampling techniques are used to avoid taking the maximum number of samples where the sampler detects that the contrast between adjacent samples is below some threshold. This can be an effective way to concentrate anti-aliasing work where it is needed most, to increase quality and reduce the render time.

Typical Anti-aliasing Values[edit]

For scenes that are primarily composed just of terrain and clouds, with few or no objects, you may be able to keep AA relatively low - such as 4 or 6 - and achieve good quality. When more objects are included, especially those with fine geometry like plant populations, it is likely you will need to use higher values like 8-12. Always use the lowest value you can as this setting directly affects the number of samples that are taken for every pixel, and can have a large impact on render time. In some cases that render time may be essentially wasted if the amount of aliasing (mostly seen as unnaturally jagged or sharp edges) in a typical render is not particularly high. As always you can test on crop renders to get a good idea of the right values in a shorter time.

Customise sampling[edit]

By default, the Anti-aliasing parameter is like a preset that controls the parameters of the adaptive pixel sampler. You don't need to know exactly how these parameters are affected by the anti-aliasing preset; we've selected good presets so that you don't need to think about it. However, if you enable Customise sampling you can precisely control the parameters of the adaptive sampler. These parameters are First sampling level and Pixel noise threshold (PNT).

First sampling level: This essentially controls how "adaptive" the anti-aliasing is, i.e. the range of possible sampling values, from the maximum number (set by the anti-aliasing value itself, e.g. 8) to the minimum number, which is some fraction of the max. The smaller fraction the minimum value is vs. the maximum, the more adaptive the AA is, and the more potential render time can be saved. However higher levels of adaptivity do have the potential to result in increased noise in some areas or to completely miss some important details in the image. When you change the first sampling level, notice how it changes the minimum number of samples per pixel in the text below the Anti-aliasing slider.

Pixel noise threshold: This allows you to control at what point the adaptive sampling system will determine that a given level of identified noise is "too much" and will thus use more samples to reduce noise in that area. More samples = smoother results but longer render time. The higher the PNT value, the more noisy the image can be before more samples are used. In other words the adaptive sampler becomes more "tolerant" of noise with higher values. An important part of this to keep in mind, however, is that the adaptive sampler can only use a maximum number of samples as specified in the main anti-aliasing value, and can only reduce samples by the fraction you set in the First Sampling Level. So you can have a relatively high PNT, but still be using too many samples if your actual AA value is high (e.g. AA 12) and/or the First Sampling Level is conservative (e.g. 1/4).

Resetting to default sampling[edit]

If you uncheck Customise sampling these two adaptive sampling parameters will be reset to the default settings for the Anti-aliasing parameter. Each AA value is like a preset that has a different set of defaults.

Technical Details[edit]

The following details apply to the Legacy adaptive sampler. The Robust adaptive sampler is more complex, but it uses many of the same fundamentals.

As an example, let's say you have Anti-aliasing set to 4, which gives you a maximum of 16 samples per pixel, and set First sampling level to "1/16 first samples". This gives you a minimum of 1 sample per pixel when max samples is 16. The maximum and minimum number of samples per pixel is shown just below the main Anti-aliasing parameter. The minimum samples per pixel depends on the maximum samples and the choice of First sampling level.

In the above example, first off, Terragen takes one sample per pixel. For every four pixels, it looks at the difference between the luminance of those pixels and the luminance of the average of those pixels. This is a way to estimate how much noise or contrast there is in this region. If the total difference is greater than the Pixel noise threshold, then that pixel is subdivided into four sub pixels. The process continues with the subpixels, comparing sets of four samples at a time and deciding whether to further subdivide.

The actual threshold used to decide whether to subdivide to the next level depends on the spacing between the samples in the current subdivision level compared to the size of a pixel. At deeper subdivision levels (more samples), the allowable threshold is higher (making it less likely to subdivide) because at higher subdivisions each of the samples has less contribution to the pixel result and we want to help the algorithm stop subdividing as soon as possible. (The maximum samples will never be exceeded, however.) In the same way, if the first sampling level is more coarse than 1 per pixel, the actual threshold used on the first level will be lower than the value entered.

If you choose settings that show that minimum samples per pixel are less than 1, this means that the spacing between the first samples will be larger than a pixel. If you have Anti-aliasing at 1, and the First sampling level is "1/4 first samples", this means that there will be only one first sample for every four pixels, i.e. a spacing of 2 pixels. The same would also be true of Anti-aliasing 2 with "1/16 first samples", and of Anti-aliasing 4 with "1/64 first samples". You can make the first sampling level even coarser than that. Doing this may be useful for low quality previews but is probably undesirable for final quality images.

This all makes sense if you have anti-aliasing levels that are powers of 2, e.g. 1, 2, 4, 8. These correspond to maximum samples of 1, 4, 16, 64. The spacing between samples at all levels of the adaptive process will be powers of 2. However, because Terragen's anti-aliasing levels allow you to use odd values, sometimes the samples of the first sampling level will not fall on exact pixel spacings, which is why you sometimes see strange numbers for the minimum samples per pixel.

Sometimes these odd spacings degrade image quality or introduce artifacts, especially with motion blur. However, in most static renders there are no noticeable problems, and it's quite useful to be able to choose AA levels between the powers of 2 levels. Many other adaptive ray tracers restrict their sampling to powers of 2. If this concerns you, choose anti-aliasing levels 2, 4, 8 or in extreme cases 16.

The luminance values and the differences between them are actually measured in a non-linear colour space so that dark parts of the image don't appear noisier than bright parts.

Currently the adaptive sampler only keys off luminance, rather than the individual RGB components. Samples that have different hues or saturation values but give the same "luminance" will be seen as being equal, so high amounts of noise in colour and saturation may be tolerated by the sampler. This is often OK, because human vision is also less sensitive to high frequency changes in these things. It also means that the most noise is allowed in the blue channel, and the least in the green channel, due to the weightings of these values in the luminance calculation.



More Information: Rendering Optimization Guide

Back to: Render

A single element of an image which describes values for color and/or intensity, depending on the color system which the image uses. Groups of ordered pixels together form a raster image.

A single object or device in the node network which generates or modifies data and may accept input data or create output data or both, depending on its function. Nodes usually have their own settings which control the data they create or how they modify data passing through them. Nodes are connected together in a network to perform work in a network-based user interface. In Terragen 2 nodes are connected together to describe a scene.

A parameter is an individual setting in a node parameter view which controls some aspect of the node.

A sample refers to a value or set of values at a point in time and/or space. The defining point of a sample is that it is a chosen value out of a continuous signal. In Terragen 2 it is usually a mathematical (procedural) function that is being sampled.

This is essentially the brightness of the colour. Terragen converts RGB colours to greyscale by taking the luminance of the colour.