Difference between revisions of "Glass Shader"

From Terragen Documentation from Planetside Software
Jump to: navigation, search
Line 1: Line 1:
''An imported OBJ object with the Glass Shader (default settings), rendered by the [[Path Tracing|Path Tracer]].''
''An imported OBJ object with the Glass Shader applied (default settings), rendered by the [[Path Tracing|Path Tracer]].''

Revision as of 02:10, 4 March 2020

LuYu glass.jpg

An imported OBJ object with the Glass Shader applied (default settings), rendered by the Path Tracer.

The Glass Shader is similar to the Water Shader, but it simplifies the UI by removing some water-specific features and it includes extra settings which are often needed for objects made of glass or other materials with a glass-like appearance.

The Glass Shader can render subsurface scattering (SSS) which makes it useful for a wide range of materials that have this effect. Ice, smoky glass, ceramic and skin are examples of materials which have SSS. When using SSS, the results are best when rendering with Path Tracing.

Main Tab[edit]

Glass Shader


  • Double-sided / Thin-walled: This is intended to be used on open objects that don't have a far side to close the volume. For example, if you are rendering a window that is represented by a single surface, not two, you should turn this ON. It has the name "double-sided" because it renders thin surfaces as though they are both sides of the object. It prevents refraction (it causes light to pass through the glass in a straight line) and it prevents distance-based absorption and subsurface scattering.
  • Reflectivity: The ability of the surface to reflect light at glancing angles when roughness is low. At glancing angles this proportion is also removed from the transmitted (refracted) light so that it respects laws of energy conservation. In other words, reflectivity controls the blend between reflections and refractions at glancing angles when roughness is low.
  • Reflection tint: A multiplier for the light that is reflected after reflectivity has been calculated. It does not affect the blend between reflections and transmissions, it simply changes the brightness or colour of the reflections as though there is an absorbent material on the surface.
  • Index of refraction: This is a physical property of the surface that affects how reflectivity is calculated, not just refraction. Index of refraction (IOR) affects the reflectivity at perpendicular angles or on rough surfaces. It also affects how much the light is refracted (bent) when it is transmitted into the object. IOR should be at least 1. When the IOR is 1, no reflection occurs and light is fully transmitted into the object without being refracted. The higher the IOR, the more light is reflected, the less light is transmitted and the more refraction occurs on the transmitted light. For water this should be about 1.33 and for glass it should be between 1.45 and 1.9 (usually around 1.5). IOR is rarely higher than 4.0 in real materials. However, you might want to go higher than this to simulate metals. A higher index of refraction can be used to produce higher reflectivity at perpendicular angles, but this is essentially just a cheat and is not a physically-based way to render metal.

  • Highlight intensity: A multiplier for the brightness of reflected light from direct light sources only (e.g. Sunlight, Light Source, Spotlight), not indirect reflections. In Terragen 4.4 and above, this also affects the brightness of direct light sources when they're visibly refracted through the surface. For reflections, the only correct value in a physically-based render is 1, but the specular reflection models are not perfect so it's reasonable to change this slightly.
  • Caustic intensity: In the real world, light reflecting off or refracting through shiny objects can cause caustics to form on surrounding objects. In the Glass Shader, the term "caustics" is a bit more specific. It means only those caustics that are reflection/refractions of direct light sources (e.g. the sun), and only those that land on diffuse surfaces or interact with rough reflections/refractions. "Caustic intensity" controls the brightness of the caustics that this Glass Shader projects onto other objects. Caustics are difficult to sample, so they create unwanted noise in path traced renders and flickering in anything that caches lighting. Terragen tries to improve this by only roughly approximates caustics so they are easier to sample. Despite this they can still be difficult to render well, so "Caustic intensity" lets you control their intensity or turn them off entirely.
  • Roughness / Specular roughness: The microscopic (or subpixel) roughness of the surface. This roughness causes reflections and refractions to look blurry or diffuse, and it changes the apparent size of highlights from bright sources (due to over-exposure). When rendering with the Standard Renderer the roughness only affects reflections/refractions of direct light sources such as the sun. When rendering with the Path Tracer the roughness is applied more correctly, affecting the blurriness of all kinds of reflections and refractions from the surface.

Sub-surface Tab[edit]

Glass Shader on the Sub-surface tab


  • Decay distance: Light traveling through the glass is absorbed using an exponential decay. "Decay distance" is how far (in metres) the light will travel before about 37% of its energy remains (if "Decay tint" is pure white). At twice the decay distance, only 14% of the light remains. Only 5% of the energy makes it to three times the decay distance. If "Decay tint" is anything other than pure white, light is absorbed at shorter distances than this.
  • Decay tint: An RGB multiplier for the Decay distance. Mathematically it works by multiplying the decay distance separately for the red, green and blue components of the light, but the results are much more interesting. Intuitively you might think of it as the colour of the light that reaches the decay distance, but it can produce an interesting range of hues and saturations that depend on how far the light travels. For realistic results you might want to use pale colours because they automatically become richer where the light travels further than the decay distance.


Examples of "Decay distance" and "Decay tint". "Decay tint" is set to a pale red colour, the same colour in each example.

  • Volume density
  • Volume colour
  • Volume density function
  • Volume colour function
  • Evaluate colour function volumetrically (without UVs)
  • Lighting method in Std
  • Lighting method in PT

See the Subsurface Scattering Guide.

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.