Rendering Optimization Guide
- 1 Defer All Shading
- 2 Path Tracing
Defer All Shading
Defer All Shading is a newer rendering method which generally provides higher quality results on surface shading and in atmospheres, especially clouds. When properly optimized it can usually achieve equivalent or better quality than Standard renders in a similar amount of time, but it does require some settings adjustments from Standard renders to achieve optimal results.
Anti-aliasing Controls Shading Quality
One of the primary things to be aware of with Defer All Shading is that the anti-aliasing settings are now the primary determinant of surface shading quality (but not geometry density or quality). As a result you will want to be mindful to balance the AA settings for the best combination of quality and render time.
Typical Anti-aliasing Values
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 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.
Adaptive Anti-aliasing Sampling is one of the best tools available in Terragen for reducing render time while maintaining quality. Simply put, it uses evaluations of contrast and noise distribution in the image to try to focus AA samples in areas where they are needed most, while avoiding using more samples than necessary on less noisy areas. This can save a lot of render time vs. simple uniform sampling, especially when there is a big difference between how noisy or aliased some areas of the scene are (such as fine geometry in a grass object) vs other areas (such as a smooth snow shader, or a clear sky).
Robust Adaptive Sampler
Beginning in Terragen 4.3 a new "Robust Adaptive Sampler" option became available. This was further improved in Terragen 4.4. Essentially it uses new and more intelligent ways of evaluating noise levels and distributing samples to better balance render time and image quality, and avoid certain problems of the more simplistic adaptive AA algorithms used previously. It is strongly recommended that you use the Robust Adaptive Sampler option when using Defer All Shading. You can begin with the default values, but even better results can be achieved in many cases by increasing the level of adaptivity (First Sampling Level) or adjusting the Pixel Noise Threshold.
First Sampling Level
The First Sampling Level 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 due to undersampling, i.e. too few samples to resolve smooth, noise-free results. Start with the default value for Robust Adaptive at 1/64 First Samples, but 1/256 is usually a good balance between quality and render time.
Pixel Noise Threshold
The Pixel Noise Threshold (PNT) 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).
If noise is a problem in your image, generally speaking you will want to start by increase the main AA value if it is not already at 6 or above, before adjusting the PNT. In many cases the default PNT will work fairly well, however as the AA level rises you may want to adjust it to save render time in areas that are not very noisy. When you do adjust the PNT, do so in very small increments. Notice how the default values change with different AA values and use those relative values as a guide. One of the highest default PNT values of 0.15 at AA2 is, in absolute terms, not that different from the value at AA16 of 0.01875, both are mere fractions of "1.0". Yet 0.01875 is actually a much lower value in terms of how it affects the threshold for evaluating noise in the render and it will consequently have a much higher impact on render time than a value like 0.15 or even 0.05. So change the PNT values slowly in the direction you want, higher for faster renders which allow more noise, lower for longer renders with less noise, and test along the way.
Ideally what you want to do is determine the minimum AA value that will achieve the level of noise and anti-aliasing that you want on the hardest to sample areas of your scene. This can be done by using small crop renders with Max Samples enabled for First Sampling Level, and focusing on areas such as shadows or fine geometry detail that will be hardest to achieve smooth results in. Once you find a max AA value that achieves good results in these areas, you can then enable successively greater fractions of First Sampling Level and then use the Pixel Noise Threshold to adjust the balance of noise vs. render time for the rest of your image. All that being said, if you don't want to take the time or energy to test that much, the defaults are a good place to start.
Don't use high Micropoly Detail
Defer All Shading renders in a way that ultimately produces smoother and more detailed terrain shading (similar to "Defer Atmo" which makes smoother clouds). This means Micropoly Detail (MPD), Soft Shadows, and other settings can be set to lower values while still maintaining quality. This can often actually result in lower render times for equivalent quality. The default 0.5 MPD is usually sufficient when Defer All Shading is enabled. When loading older projects created prior to the introduction of Defer All Shading remember to check the MPD value as it may have been set higher to achieve high quality when this option was not yet available.
Reduce Samples for Soft Shadows
As noted, Defer All Shading results in higher quality surface shading, and this includes Soft Shadows on the terrain as well. So you can use fewer samples for Soft Shadows while still avoiding noise. Try a value of 2 when Defer All Shading is enabled, rather than the default of 9. You can test this with a crop render using Defer All Shading vs Standard rendering to ensure it is working well.
New in Terragen 4.3 is a more accurate and realistic-looking Path Tracing render method. You can find out more about it on the dedicated Path Tracing page. This can be a time-intensive rendering method and there are some specific optimizations and settings to be aware of to get the most out of your path traced renders.
Do I Need Path Tracing?
The first thing to consider is whether your scene will actually benefit enough from path tracing to justify an increase in render time. Many scenes do, but there are enough in which the difference will be relatively small that it's worth considering and testing the impact on your actual scene before committing to a full, high resolution render. Use crop renders or lower resolution tests to evaluate the potential benefits.
Path Tracing is most effective where there is a lot of geometry (e.g. imported object populations), or generally more potential for bounced light. It handles complex interactions of light bouncing better than the normal renderer. But for example in a mostly-terrain scene with a few scattered objects and a lot of direct sunlight, you're probably not going to see much benefit. If you move the sun lower in the sky to create lots of shadows, a sunset for example, then you might see more benefit. But the greatest gains will tend to be in thicker vegetation, or on more complex objects.
Path Tracing also doesn't really affect the atmosphere, its main effects are on the ground, the terrain and anything sitting on it. So don't enable it if you are hoping for some improvement in the sky. It can, however, create more realistic lighting on the ground from the sky, to some degree.
Optimizing Render Time and Quality
Path Tracing Uses Defer All Shading
Path Tracing enables "Defer All Shading". Defer All Shading is a rendering method which makes much more detailed terrain (similar to "Defer Atmo" which makes smoother clouds). This means Micropoly Detail (MPD), Soft Shadows, and other settings can be set to lower values while still maintaining quality. This can often actually result in lower render times for equivalent quality when Defer All Shading is used on its own, and good optimization for that rendering method will help minimize render time impact with full Path Tracing is used. Reference the Defer All Shading optimization section above for more specific setting recommendations and details.
Use the Robust Adaptive Sampler
The new Robust Adaptive Sampling helps a lot to reduce render time with Path Tracing in particular, while maintaining quality. You can use a value of AA8 or AA6 with Robust Adaptive and 1/64th samples as a starting point. Increasing the amount of adaptivity, i.e. the "First sampling level", will reduce render time but can add to noise. If you use AA8 you can consider 1/256, but at AA6 you might want to stick to 1/64.
Then adjust the Pixel Noise Threshold *only* to get the level of noise under control. Start with the default value and go down if you want less noise, or up if noise looks fine but render time is too long. You may find you can get away with a lower Pixel Noise Threshold. Do renders in crops to reduce time needed for checking the best values, and you should include an area of shadow in your crop for most accurate results.
Note that Robust Adaptive is improved in v4.4 vs. 4.3 so if possible use v4.4 or newer. For a more detailed discussion of Robust Adaptive Sampling and Pixel Noise Threshold, see above under Defer All Shading.
Avoid High GI Cache Values
The GI Cache Detail and Sample Quality values do have an effect with path tracing, but they only control GI contributions from the atmosphere into the path tracer, which is used for the terrain illumination. The Path Tracer essentially replaces the cache-based GI system for rendering the terrain and objects, but not for the atmosphere. So these GI settings can generally be fairly low (e.g. 2/2 or 3/3) because the atmosphere contribution is fairly diffuse in most cases, and the terrain and object lighting will be made accurate by the path tracing itself.
Put simply: you don't need high Cache Detail or Sample Quality values to get good path tracing results on your terrain.
Test and Crop
Above all you will almost certainly want to run some tests before committing to a final Path Traced render, especially one at high resolution. A Path Traced render may take several hours even on high-end hardware, so it makes sense to spend some time on shorter renders of cropped areas to help ensure that when your full render finishes, the results are what you expect and are to your liking. So select one or more crop regions that include areas of shadow, dense geometry, etc., and then test variations of the above setting recommendations to find a good balance of quality and render time. Then you can commit to a full render knowing it won't take more time than necessary. And thereafter you'll be saving render time each time you render that scene and variations of it since for the most part only dramatic changes to the scene construction will affect what the optimal values are.
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 shader is a program or set of instructions used in 3D computer graphics to determine the final surface properties of an object or image. This can include arbitrarily complex descriptions of light absorption and diffusion, texture mapping, reflection and refraction, shadowing, surface displacement and post-processing effects. In Terragen 2 shaders are used to construct and modify almost every element of a scene.
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.