Render Layers and Render Elements

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


Terragen Professional allows you to output Render Layers and Render Elements.


Render Layers can be useful in many ways, but here are some things they typically allow you to do:

  • Break a scene into different parts to be composited together later. These parts might include different sets of objects, or be based on clipping distances to slice the scene according to distance from the camera.
  • Render different lighting passes (with different sets of lights enabled, or shadowed and shadowless renders).
  • Render other special passes using different combinations of object, lights, shading and lighting settings from the main render.
  • Output Render Elements. These are enabled through a Render Layer.

For some of those examples you might ask "Why not just make a separate project file, or turn objects or lights on and off when you are ready to render?" When you're working on a project you probably render many times until you or your client are satisfied with the results, and you make changes to the scene as you go. If you have multiple layers in your scene, maintaining a different project file for each layer can become quite difficult, prone to human error, and tedious. Render Layers aim to simplify the process by allowing you to work in a single project file. We have tried to give you tools to control many of the things that often need to be separated into different render layers. A simple example is rendering different objects in separate layers. This is done through "object groups". Once you have set up your render layers and told each layer what objects it should render, you can continue working in one project file with all objects enabled and switch between render layers at any time.

Render Layers have the following capabilities:

  • #Object Groups. Limit objects' visibility and ability to cast shadows and other rays.
  • #Light Groups. Limit which lights are enabled.
  • Apply clipping distances.
  • Allow or disallow atmosphere/cloud to be rendered over the background (including surfaces with an alpha value of 0). It is useful to turn this off for foreground or midground layers that will later be composited over a background layer that has atmosphere. Turning this off causes the foregroud and midground objects to be rendered on a black, zero-alpha background so that atmosphere is not applied twice to the background pixels in the composite. This setting does not affect a pixel whose alpha is 1, so atmosphere is rendered as normal over the objects.
  • Shading and lighting flags. There are three parameters allow surfaces to be visible, allow atmosphere to be visible and allow shadows which allow or prevent the corresponding flag in the Render node to be enabled; in other words, these flags are only considered to be ON by the renderer if they are ON in both the render node and the render layer. Surface RGB and lighting elements are only produced if allow surfaces to be visible is ON in the Render Layer. Atmosphere RGB and lighting elements are only produced if allow atmosphere to be visible is ON in the Render Layer.
  • Override the GI settings. On the Layer Settings tab there is an option called override GI settings. When checked, a full set of GI Settings can be edited for the render layer. Currently, GI override is not respected by the 3D Preview, but it is respected by the render node for normal rendering. So that you don't accidentally edit the main render node's GI settings when they aren't affecting the current layer, the render node's GI Settings button gives notice if the settings are being overridden and opens the parameter view for the overriding GI Settings of the render layer.
  • Enable #Render Elements. These are additional images that are produced by the renderer to help with post processing or compositing of an image. Render Elements are explained later in this document.

Creating a Render Layer

Render Layers can be created by clicking the "+" menu button next to the Render Layer node field of any render node and choosing "Create new Render layer". After creating a render layer, use click the "+" button again and choose "Go to "Render Layer 01"" to open its parameter view.

You can also create Render Layer nodes directly in the Network View. They are drawn in yellow-orange. A render layer can be linked to render nodes by dragging a connection line from its output plug to the "Render Layer" plug on any render node.


Switching Between Render Layers

The "current render layer" is the render layer, if any, that is linked to the current render node (not necessarily the "master" node). It affects only that render node. You can make a render layer current by assigning it to any render node (that render node will also become the current render node because you changed one of its parameters) or by using a render node that uses the desired render layer.

Object Groups

You might want to limit the rendering to only certain objects, or exclude certain objects, or change how certain objects interact with the scene. Up to 5 groups of objects can be chosen. To create an object group, use the Network View to select one or more objects (such as planets, object readers etc.) and then group them (Ctrl-G on Windows, Command-G on Mac) or drag them into an existing node group. Double click on a group's title bar to give it a useful name. Then from the Objects tab on the Render Layer you can assign this group to one of the 5 slots.

For each assigned group you can say whether the objects in that group may be visible, rendered as a "holdout", or hidden. Holdouts are visible in the image as black shapes with an alpha value of 0, and are often needed so that you can composite layers together in post. Holdouts are rendered in 3D space so that objects, clouds or atmosphere in front of the holdout object are still visible. Atmosphere and clouds can be rendered as volumetric holdouts, by attaching them to a planet that is a member of an object group in "holdout" mode.

Some objects have their own parameters to change their visibility, separate from render layers. When using render layers to affect a group's visibility, the object's own visibility mode is combined with the group visibility in the Render Layer in the following ways:

Visible x Visible = Visible
Visible x Holdout = Holdout
Visible x Hidden = Hidden
Holdout x Visible = Holdout
Holdout x Holdout = Holdout
Holdout x Hidden = Hidden
Hidden x Visible = Hidden
Hidden x Holdout = Hidden
Hidden x Hidden = Hidden

The table shows that the result is the least visible of the two settings, where "Hidden" is less visible than "Holdout" and "Holdout" is less visible than "Visible".

For each group you can also say whether its objects are allowed to cast shadows and be visible to other rays using the parameter cast shadows and other rays. "Visible to other rays" means having reflections appear on other surfaces, being visible through transparent surfaces, and affecting global illumination. A group which is in "Hidden" or "Holdout" mode may still cast shadows and be visible to other reflections. Conversely, a group which is "Visible" may have its shadows disabled and made invisible to other rays.

Separate from render layers, some objects have their own parameters to enable/disable the casting of shadows and visibility to other rays. These settings are combined with the group settings in the Render Layer in the following ways:

If Render Layer group cast shadows and other rays is ON then:

  • If object visible to other rays is ON then object is visible to other rays
  • If object visible to other rays is OFF then object is NOT visible to other rays
  • If object cast shadows is ON then object casts shadows
  • If object cast shadows is OFF then object does NOT cast shadows

If Render Layer group cast shadows and other rays is OFF then:

  • Object is NOT visible to other rays, regardless of object setting
  • Object does NOT cast shadows, regardless of object setting

If no object groups are chosen, or none of the chosen groups exist, then all objects will be treated as if there were no render layer.

If any object groups are chosen and exist, options will be enabled to control how "all other objects" are rendered. Anything that is not in one of the chosen groups will be rendered according to those options, with similar combination rules to the above.

Light Groups

Light Groups allow you to limit which lights affect the rendered image. Up to 5 groups of lights can be chosen. If any light groups are chosen and exist, only the lights in those groups will be allowed to affect the rendered image. Light groups do not turn on lights that are disabled; a disabled light will not illuminate the scene regardless of render layer settings. To create a light group, use the Network View to select one or more lights (sunlights, light sources, spotlights and enviro lights), and then group them (Ctrl-G on Windows, Command-G on Mac) or drag them into an existing node group. Double click on a group's title bar to give it a useful name. Then from the Lights tab on the Render Layer you can assign this group to one of the 5 slots.

If no light groups are chosen, or none of the light groups exist, then all lights will be treated as if there were no render layer.

Enviro lights are treated as lights for the purpose of light groups. Because of that, by default, global illumination will not be rendered if you use light groups but don't have an enviro light in any of the chosen groups. Sometimes this is useful, but at other times you may want global illumination to affect each of your lighting layers. You can turn on "Always include enviro lights" to cause enviro lights to be treated as a special type of light that always affects the rendered layer as long as it is enabled.

Render Elements

Render Elements (or "extra output images") are additional images that are produced by the renderer to help with post processing or compositing of an image. Many different elements can be output by a single render/layer. For example, when you render an image you might also want a depth map (or "Z depth") along with diffuse and specular lighting elements so that you can make lighting changes to the image later in another application. The renderer can produce these elements at the same time as the main image so you only need to render the scene once to get all the elements you want.

The following Render Elements can be produced:

Basic Elements Filename
RGB tgRgb
Alpha tgAlpha
Surface RGB tgSurfRgb
Surface Alpha tgSurfAlpha
Cloud RGB tgCloudRgb
Cloud Alpha tgCloudAlpha
Atmosphere RGB tgAtmoRgb
Atmosphere Alpha tgAtmoAlpha
Lighting Elements Filename
Surface Direct (Diffuse + Specular) tgSurfDirect
Surface Indirect (GI + Reflections) tgSurfIndirect
Surface Direct Diffuse tgSurfDirectDiff
Surface Indirect Diffuse (GI) tgSurfIndirectDiff
Surface Direct Specular tgSurfDirectSpec
Surface Indirect Specular (Reflections) tgSurfIndirectSpec
Surface Emission (Luminosity) tgSurfEmit
Cloud Direct tgCloudDirect
Cloud Indirect (GI + Ambient) tgCloudIndirect
Atmosphere Direct tgAtmoDirect
Atmosphere Indirect (GI + Ambient) tgAtmoIndirect
Data Elements Filename
Surface Depth tgSurfDepth
Surface Position tgSurfPos
Surface 2D Motion Vector tgSurf2dMotion
Surface Normal tgSurfNormal
Surface Diffuse Colour (before lighting) tgSurfDiffCol
Cloud Depth tgCloudDepth
Cloud Position tgCloudPos
Cloud 2D Motion Vector tgCloud2dMotion

Layers vs. Elements

Render elements like these are sometimes called 'passes' in other 3D renderers. The term 'AOV' may also be used. Historically, elements such as these had to be produced by rendering the same scene more than once with different settings; in other words doing multiple 'passes' of the same render. We think the term 'passes' is misleading in the current context because the renderer does not need to pass over the scene more than once to produce these images, and 'passes' could be more accurately applied to render layers which do require multiple renders. To reduce ambiguity we prefer to use the terms 'render elements' and 'render layers'.

Render Elements are not to be confused with Render Layers. A single render layer may contain multiple render elements. The same type of render element may be produced from multiple render layers. So why did we choose to define elements in the Render Layer settings and not somewhere else, perhaps the render node? When using render layers you will often find that different layers need different render elements. Elements take up extra space on disk, need more memory during a render and can add to render times, so it's advisable to enable only the elements that are useful for a particular render. Therefore it's useful to be able choose a different set of elements for each layer.


Cloud elements are separate from atmosphere elements. Atmosphere elements and cloud elements mutually hold each other out, so in a compositing program the combined atmosphere and cloud can be obtained by using addition ('Plus' in Nuke, for example). This applies to all atmosphere/cloud elements including their RGB, Alpha, Direct and Indirect elements. Also note that tgCloudDepth, tgCloudPos and tgCloud2dMotion are premultiplied by tgCloudAlpha, so they too are held out by atmosphere.

All elements beginning with 'tgSurf' (except for "data" elements) are premultiplied by tgSurfAlpha, all elements beginning with 'tgCloud', are premultiplied by tgCloudAlpha and all elements beginning with 'tgAtmo' are premultiplied by tgAtmoAlpha. tgRgb is premultiplied by tgAlpha. Currently it is not possible to render unpremultiplied elements directly but in future we might add an option to do so.

IMPORTANT: Alpha channels are not embedded in any of these images. It's therefore a good idea to enable the alpha elements that correspond to any elements you use so that you can composite them.

The same render element from two different render layers (say 'tgSurfDepth' from "Render Layer 01" and the same element from "Render Layer 02") can usually be composited together in an application such as Nuke or Photoshop using the same methods you would use to composite each of the layers' RGB images. If you have the same render elements in each layer, there are two ways of combining everything together in the compositing application. Perhaps the most straightforward method is to combine all elements that belong to a render first, to produce a complete layer, then composite the layers together. That makes it easier to move your layers around in the composite. The other way is first to treat each element as a layer that needs to be composited with the same element from other layers, and then you have global control over how the merged elements are combined into the final image. You might prefer this approach if you have many elements but only a few layers and you can composite the layers fairly simply.

For more information on compositing Terragen render elements, refer to Compositing Terragen Render Elements.

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.