Difference between revisions of "Terragen 4 Global Illumination"
m |
|||
Line 53: | Line 53: | ||
* More control over the level of detail in your GI pre-pass than is possible with the GI relative detail setting, which only allows whole number values. When writing to the GI cache, you can choose a different image size to render or a different value for 'detail'. Normally, 'detail' affects many things in your rendered image, but if you render the GI cache separately then you can choose a different detail for your GI. Image size and detail both have the same effect on the detail of your GI solution as 'GI relative detail' -- they are all linear multipliers -- but you can change the detail more precisely with image size or the detail slider than you can with GI relative detail. | * More control over the level of detail in your GI pre-pass than is possible with the GI relative detail setting, which only allows whole number values. When writing to the GI cache, you can choose a different image size to render or a different value for 'detail'. Normally, 'detail' affects many things in your rendered image, but if you render the GI cache separately then you can choose a different detail for your GI. Image size and detail both have the same effect on the detail of your GI solution as 'GI relative detail' -- they are all linear multipliers -- but you can change the detail more precisely with image size or the detail slider than you can with GI relative detail. | ||
+ | '''Generating a GI cache file sequence for animation''' | ||
+ | |||
+ | # Setup the lighting how you want it, doing test renders with "No GI cache file" checked in Render GI Settings (this is the default). | ||
+ | # Switch to "Write to GI cache file" in Render GI Settings. Specify a location and filename for your GI cache file. Include a frame formatter such as '%04d' (not including quotes) somewhere in the filename. This formatter will be replaced by the frame number, so that you can render a sequence of cache files. One file will be generated for each frame that you render. | ||
+ | # Generate the GI cache files by rendering a sequence, just like you would render a sequence of images. Final images will not be rendered or saved while "Write to GI cache file" is checked. You do not have to render every frame. "Time-sparse" caches, where cache files are separate by more than one frame, are useful to allow the final images to gradually blend between GI solutions instead of flickering from frame to frame. You can either render the sequence on your computer using the "Render Sequence" button or distribute it on a render farm like you would for final images. Generating caches for an animation can be distributed across many machines because each frame generates a different GI cache file. | ||
+ | |||
+ | Using the "time-sparse" technique is simply a matter of generating fewer files using a sequence where the frame step is greater than 1. For example, you might choose to render frames 10, 20, 30, etc. by setting the step to 10. However, if you change the step, it's especially important to be aware that any old files that exist from previous renders will be deleted only if they are overwritten by your latest render. They are not automatically deleted when you start rendering a new sequence. When reading the caches for your final image pass, Terragen simply looks at whatever files exist that match the file sequence you tell it to read. | ||
+ | |||
+ | '''Rendering a final animation''' | ||
+ | |||
+ | # Switch to "Read GI cache file(s) in Render GI Settings. Specify the filename of one of the GI cache files that you generated. Any file in the sequence will do. | ||
+ | # Set blend mode to "Interpolate (for animation)". In most cases this is the best mode for animations. It is designed to work with time-sparse caches and gradually blend between sets of files according to the frame number. It will also work when there is a cache file for every frame, but in that situation it is equivalent to "Equal blend" mode except that it will blend one fewer cache files due to the nature of the interpolation algorithm. The various blend modes are explained in more detail later on this page. | ||
+ | # Choose the number of cache files to blend together to produce the GI solution for each frame. The higher this number, the higher the quality of the GI and the smaller the fluctuations will be while playing the sequence. If you have a GI cache file on every frame then it is even more important because it affects how much the GI flicker is reduced. However, higher numbers increase render time of the final images. If the GI cache files are quite large, especially if they were generated with a high GI sample quality setting, then this effect on render time may be significant. | ||
+ | # If there is too much fluctuation in the GI you have three options. A) You can slow down the fluctuations by moving some of the GI files out of the folder to make the caches even more sparse. However, if your camera is moving too rapidly you may see areas of inadequate GI coverage or reduced quality. B) Increase the "number of files to blend". Usually this will decrease fluctuations or flicker, but it may affect render times. If the camera is moving rapidly so that the extra files do not cover the region 3D space being rendered then the extra files may not even help. If all else fails you may need to re-generate GI cache files with a higher GI sample quality, but this might also increase render times for the final images. | ||
+ | |||
+ | If in doubt, a good starting point is to generate GI cache files with quality settings that work for still images you're happy with, generate every 10th GI cache file and set it to blend 3, 4 or 5 files for the final sequence. | ||
== Render GI Settings == | == Render GI Settings == |
Revision as of 10:30, 15 April 2012
Contents
Global Illumination in Computer Graphics[edit]
Global illumination is a general name for a group of algorithms used in 3D computer graphics that are meant to add more realistic lighting to 3D scenes. Such algorithms take into account not only the light which comes directly from a light source (direct illumination), but also subsequent cases in which light rays from the same source are reflected by other surfaces in the scene, whether reflective or not (indirect illumination).
Global Illumination in Terragen[edit]
Direct illumination in Terragen is the lighting coming directly from the sun or other specific light sources, but not from luminous objects. Global illumination (GI) in Terragen means the lighting from everywhere else, including indirect illumination as well as illumination caused by bright, luminous objects that aren't specifically light sources. In a Terragen scene, the intensity of GI is controlled using a single Enviro Light node.
In Terragen, GI is:
- The reason shadows are not black.
- Lighting from the sky.
- Lighting caused by light bouncing off other objects.
- Lighting caused by light emitted from glowing, luminous objects, e.g. lava, fire, bioluminescence.
- "Multiple scattering" in clouds and atmospheres. "Multiple scattering" in volumes is often thought of as a separate phenomenon from global illumination, but in fact it can be treated as a form of global illumination if the scattering is rendered as a lighting effect upon the volume. In Terragen, multiple scattering is approximated using the global illumination cache. Clouds and atmospheres will illuminate themselves in a way that simulates multiple scattering. Being part of the global illumination system, GI in volumes completely integrates with GI from surfaces. Light bouncing off or emitted from surfaces will light up clouds and atmospheres, and light scattering through clouds and atmospheres will light up surfaces.
Rendering with GI[edit]
Without GI cache files[edit]
To render an image with Global Illumination in Terragen without using GI cache files, you need the following:
- An Enviro Light in the scene, enabled, with its mode set to "Global Illumination"
- In Render GI Settings, 'GI relative detail' set to 1 or higher.
You can turn off global illumination by disabling the Enviro Light, but Terragen might still waste time on the pre-pass. To completely turn off GI, edit the Render GI settings and set 'GI relative detail' to 0. All other GI settings can be left how they are.
Performance note: Do not enable more than one Enviro Light in the scene unless you really need to. If you wish to brighten the effect of the Enviro Light, increase the 'strength' settings in a single Enviro Light. Multiple Enviro Lights can increase GI quality, but they are not the best way to do that and they increase render time unnecessarily. You can achieve a more efficient increase in quality by increasing 'GI sample quality' in Render GI Settings. This will give a higher quality in a shorter render time than would enabling multiple Enviro Lights. The only good use for more than one enabled Enviro Light is to have one Enviro Light in Global Illumination mode and another in Ambient Occlusion mode, if you want that effect. Of course you can have as many disabled Enviro Lights in your project as you like.
Normally when you render an image with Global Illumination, Terragen renders the image in two passes. A pre-pass is rendered which calculates the Global Illumination for the image and stores it in a spatial data structure called a GI cache. When you see lots of tiny dots filling the image before the real rendering begins, you're seeing the pre-pass generating the GI cache. Once the pre-pass is done, rendering of the final pass begins. Global Illumination in the final image depends on the GI cache that was generated in the pre-pass.
With GI cache files[edit]
A new feature in Terragen 2.4 (not in the Free Non-Commercial Edition) is the ability to read and write GI cache files. These allow you to write the results of the pre-pass to disk or file network and to read them back in when rendering an image. Using GI caches files is a two step process. First you render a pre-pass which calculates the Global Illumination for the image (or sequence of images), and writes the resulting GI cache to your disk or network in the form of a GI cache file (or sequence of GI cache files). After you have created those GI cache files, you can render final images using the GI in the cache files instead of recalculating the GI every time you render an image.
You don't need to use GI cache files to enjoy Global Illumination. However, GI caches have many uses, such as:
- Eliminating GI flicker in animations. To do this, read a single cache file or interpolate between cache files in a sequence.
- Matching the GI in separately rendered tiles that you want to combine into a larger image, panorama, skybox or skydome. This is achieved by reading a single cache file or blending multiple cache files rendered with different cameras.
- Rendering a GI pass (indirect illumination pass), by disabling all lights and reading the GI from a GI cache file.
- Rendering special effects using GI that was generated with different lighting or other changes to the scene, e.g. some objects added or removed. You could write to a GI cache file using the scene that generates the GI you want, then render your final image with that GI cache file.
- More control over the level of detail in your GI pre-pass than is possible with the GI relative detail setting, which only allows whole number values. When writing to the GI cache, you can choose a different image size to render or a different value for 'detail'. Normally, 'detail' affects many things in your rendered image, but if you render the GI cache separately then you can choose a different detail for your GI. Image size and detail both have the same effect on the detail of your GI solution as 'GI relative detail' -- they are all linear multipliers -- but you can change the detail more precisely with image size or the detail slider than you can with GI relative detail.
Generating a GI cache file sequence for animation
- Setup the lighting how you want it, doing test renders with "No GI cache file" checked in Render GI Settings (this is the default).
- Switch to "Write to GI cache file" in Render GI Settings. Specify a location and filename for your GI cache file. Include a frame formatter such as '%04d' (not including quotes) somewhere in the filename. This formatter will be replaced by the frame number, so that you can render a sequence of cache files. One file will be generated for each frame that you render.
- Generate the GI cache files by rendering a sequence, just like you would render a sequence of images. Final images will not be rendered or saved while "Write to GI cache file" is checked. You do not have to render every frame. "Time-sparse" caches, where cache files are separate by more than one frame, are useful to allow the final images to gradually blend between GI solutions instead of flickering from frame to frame. You can either render the sequence on your computer using the "Render Sequence" button or distribute it on a render farm like you would for final images. Generating caches for an animation can be distributed across many machines because each frame generates a different GI cache file.
Using the "time-sparse" technique is simply a matter of generating fewer files using a sequence where the frame step is greater than 1. For example, you might choose to render frames 10, 20, 30, etc. by setting the step to 10. However, if you change the step, it's especially important to be aware that any old files that exist from previous renders will be deleted only if they are overwritten by your latest render. They are not automatically deleted when you start rendering a new sequence. When reading the caches for your final image pass, Terragen simply looks at whatever files exist that match the file sequence you tell it to read.
Rendering a final animation
- Switch to "Read GI cache file(s) in Render GI Settings. Specify the filename of one of the GI cache files that you generated. Any file in the sequence will do.
- Set blend mode to "Interpolate (for animation)". In most cases this is the best mode for animations. It is designed to work with time-sparse caches and gradually blend between sets of files according to the frame number. It will also work when there is a cache file for every frame, but in that situation it is equivalent to "Equal blend" mode except that it will blend one fewer cache files due to the nature of the interpolation algorithm. The various blend modes are explained in more detail later on this page.
- Choose the number of cache files to blend together to produce the GI solution for each frame. The higher this number, the higher the quality of the GI and the smaller the fluctuations will be while playing the sequence. If you have a GI cache file on every frame then it is even more important because it affects how much the GI flicker is reduced. However, higher numbers increase render time of the final images. If the GI cache files are quite large, especially if they were generated with a high GI sample quality setting, then this effect on render time may be significant.
- If there is too much fluctuation in the GI you have three options. A) You can slow down the fluctuations by moving some of the GI files out of the folder to make the caches even more sparse. However, if your camera is moving too rapidly you may see areas of inadequate GI coverage or reduced quality. B) Increase the "number of files to blend". Usually this will decrease fluctuations or flicker, but it may affect render times. If the camera is moving rapidly so that the extra files do not cover the region 3D space being rendered then the extra files may not even help. If all else fails you may need to re-generate GI cache files with a higher GI sample quality, but this might also increase render times for the final images.
If in doubt, a good starting point is to generate GI cache files with quality settings that work for still images you're happy with, generate every 10th GI cache file and set it to blend 3, 4 or 5 files for the final sequence.
Render GI Settings[edit]
Prepass:
- GI relative detail: TBC
- GI sample quality: TBC
- GI blur radius: TBC
- Supersample prepass: TBC
GI Cache File:
- No GI cache file: Renders the image normally. A prepass generates the GI and an image pass renders the final image.
- Write to GI cache file: Renders only the prepass to generate the GI cache, then saves the GI cache to a file.
- Read GI cache file(s): Renders only the final image. GI is read from a previously generated GI cache file or GI cache files.
- Blend mode: Applies only when "Read GI cache file(s)" is selected. Blend mode can be set to one of the options below. "One file (exact filename)" reads a single cache file, but the other 3 modes work with sequences of files. If the base filename contains a number and other files in the same folder have similar names which differ only by this number, then they will be assumed to be part of the same sequence and the number will be interpreted as a frame number. The current frame number and the blend mode determine which file(s) in the sequence will be read.
- One file (exact filename): Reads only one cache file, with the filename given to the right of "Read GI cache file(s)". This can be an exact filename, or if the filename contains '%04d' (without quotes) then that string will be replaced by a 4 digit frame number representing the current frame. Different numbers of digits are supported by replacing the '4' with a different number. If the file is not found then the renderer will report an error; sequences are not detected in this mode.
- Nearest file in sequence: Beginning with the base filename (given to the right of "Read GI cache files"), this mode looks for files that belong to same sequence as the base filename. The renderer will read only one cache file, choosing the file whose frame number is nearest to the current frame number. You can choose any file in the sequence for the base filename.
- Equal blend within range: Beginning with the base filename (given to the right of "Read GI cache files"), this mode looks for files that belong to same sequence as the base filename. The renderer will try to read as many files as the "Number of files to blend" parameter below, choosing the files whose frame numbers are nearest to the current frame number. Where the GI solutions overlap in 3D space, the results are averaged together, and wherever there are gaps in one file's solution (e.g. outside the camera's view) the other files can fill in data. You can choose any file in the sequence for the base filename.
- Interpolate (for animation): This is simillar to "Equal blend within range" except that the files are weighted differently depending on the current frame number, to produce steady blends during animations. This mode becomes useful if your caches are 'sparse' in time. 'Sparse caches' are sequences of GI cache files where not every frame has a cache file. For example you might have a GI cache file on frames 10, 20, 30, and so on. If you do this, and you set the blend mode to "Interpolate (for animation)", a smooth blend will occur between the different sets of GI caches that are selected over the course of an animation. The more frames between cache files, the more gradual the blend will be. "Number of files to blend" should be set to 2 or more to allow the blending to work.
- Number of files to blend: TBC
Advanced:
- GI prepass padding: TBC
Image Pass:
GI surface details: TBC
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 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.
A parameter is an individual setting in a node parameter view which controls some aspect of the node.