Reflective Shader

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



Overview[edit]

This shader provides a reflectivity effect for surfaces, which can simulate wet, smooth, and otherwise shiny surfaces. The Reflective shader is primarily intended to follow non-reflective shaders or function nodes in the workflow, such as the Surface layer shader (see Usage section). In the example images below, we compare each of the shader’s settings using Terragen’s standard renderer and the newer Path tracer renderer.

Settings:

    • Enable: When checked, the node is active and the settings below will affect the surface. When unchecked, the node is ignored.

Main Tab[edit]

Main Tab


    • 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.
      Standard renderer with range of Reflectivity values and colours.
      Path tracer with range of Reflectivity values and colours.


    • Reflection tint: This setting is 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.
      Standard renderer with range of reflection values and colours.
      Path tracer with range of reflection values and colours.


    • Index of refraction: Index of refraction (IOR) is a property of real world materials which affects light refracted into it from another medium. Despite its name it also affects the amount of light reflected off the surface for a given angle; in other words it changes the reflectivity curve which is calculated using the Fresnel equations. In the Reflective Shader the IOR setting must be >= 1. When IOR is exactly 1 there is no reflection. When IOR is greater than 1 some amount of reflection occurs, and the higher the IOR the more visible the reflections. For any IOR > 1, the reflectivity approaches 100% at glancing angles where light travels parallel to the surface (although this can be changed with the Reflectivity setting and roughness also makes it appear to be less). At any other angle the amount of reflection is reduced, calculated from the IOR. The IOR of water is usually around 1.33, depending on conditions, and most types of glass are between 1.4 and 1.9. 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.
      Standard renderer with range of IOR values.
      Standard renderer with range of IOR values.


    • Specular highlights: This popup has 4 options for choosing the method of calculating the specular highlights.
      Specular highlight methods.
      • Beckmann TG 2 is available for legacy and backwards compatibility with projects created in older vesions of Terragen. This option is not as physically correct as the others. When roughness is high it overestimates reflections of environment/indirect light (ignores self shadowing) and underestimates reflections of direct lights.
      • Beckmann TG 4.5 uses the Beckmann microfacet distribution like Beckmann TG 2 but has some improvements to make it more physically correct. Reflected energy is more consistent between direct light and environment/indirect light. It also uses a fast approximation of multiple scattering when roughness is high, which reflects more light according to base colour (for metals) and Fresnel settings (for both metals and non-metals). This has the effect of increasing colour saturation in metals when roughness is high. For direct lights it uses a shadowing-masking function that produces a "rounder" falloff when roughness is high.
      • GGX uses the GGX microfacet distribution and shadowing-masking function. This produces a longer tail to highlights and more closely resembles a diffuse reflection when roughness is high. This makes it more predictable when using roughness or glossiness maps. Our implementation of GGX also uses a fast approximation of multiple scattering when roughness is high, which reflects more light according to base colour (for metals) and Fresnel settings (for both metals and non-metals). This has the effect of increasing colour saturation in metals when roughness is high. GGX is the default option for new projects, but existing projects will load with their own model for backwards compatibility.
      Standard renderer with range of Specular highlight values.
      Path tracer with range of Specular highlight values.


    • Highlight intensity: This setting is 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.
      Standard renderer with range of Highlight intensity values.
      Path tracer with a range of Highlight intensity values.


    • Caustic intensity: In the real world, light reflecting off or refracting through shiny objects can cause caustics to form on surrounding objects. In the Reflective 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 Reflective 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 approximating 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.
      Path tracer with range of Caustic intensity values.
      Path tracer with range of Caustic intensity values.


    • 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.
      Standard renderer with range of Specular roughness values.
      Standard renderer with range of Specular roughness values.


    • Roughness function: The shader or function nodes assigned to this setting are multiplied by the “Specular roughness” value above which allow you to adjust or break up the intensity of the specular highlight. Note that negative results are clamped to 0.
      Standard renderer with Power fractal assigned as Roughness function.
      Path tracer with Power fractal assigned as Roughness function.


    • Ray traced reflections: This setting only applies to the Standard renderer, and is ignored when using the Path tracer. When checked, reflections are ray traced for the surface to accurately reflect the scene. When unchecked, the GI cache is used to approximate the indirect reflections, which is very blurry.
      Ray traced reflections checked.
      Ray traced reflections unchecked.


    • Reflection softness: This setting only applies to the Standard renderer, and is ignored when using the Path tracer. Together with the “Number of samples” setting on the Quality tab, this setting controls the blurriness of the reflections. The default value of “0” results in sharp reflections and uses only one sample regardless of the number of samples chosen. Although the slider allows for a large range of values, the recommended range is between 0.0 to 0.1.
      Standard renderer with Reflection softness values at 0, 0.05 and 0.1


Quality Tab[edit]

Quality Tab


    • Number of samples: This setting controls the quality of the soft reflections, which occur when the “Reflection softness” value is greater than “0”. The default value is “4” and raising it will take additional samples leading to a smoother blurred result, at the cost of longer render times.
      Standard renderer with Number of sample values at 4, 16, 32 and 64.


    Usage[edit]

    The most common usage of the Reflective shader, as shown in the example images below, is to apply it downstream from a Surface shader or function nodes that does not have reflective settings.

      Constant shader
      Reflective shader applied after Constant shader in workflow.
      Reflective shader applied after Constant shader in workflow.


      Lambert shader
      Reflective shader applied after Lambert shader in workflow.
      Reflective shader applied after Lambert shader in workflow.


      Surface layer shader
      Reflective shader applied after Surface layer shader in workflow.
      Reflective shader applied after Surface layer shader in workflow.


      Power fractal shader
      Reflective shader applied after Power fractal in the workflow and using a Power fractal as a mask to define the reflective areas of the surface.
      Reflective shader applied after Power fractal in the workflow and using a Power fractal as a mask to define the reflective areas of the surface.


      Terrain with Reflective shader
      Path tracer render of terrain without Reflective shader.
      Path tracer with Reflective shader at default settings.
      Path tracer with Reflective shader.  Reflectivity = 0.16, IOR = 2.0, Specular highlight model = GGX, Specular roughness = 0.16.


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.