Difference between revisions of "Warp Merge Shader"

From Terragen Documentation from Planetside Software
Jump to: navigation, search
(New page copied from the old Warp Shader page with the names changed)
 
(Noted shaders that don't work with warps)
Line 8: Line 8:
 
If you have a colour shader, colour function, scalar function or vector function that you want to use as your warper, you can turn it into displacement using a [[Displacement Shader]] or a [[Vector Displacement Shader]].
 
If you have a colour shader, colour function, scalar function or vector function that you want to use as your warper, you can turn it into displacement using a [[Displacement Shader]] or a [[Vector Displacement Shader]].
  
You may see the Warp Merge Shader and the [[Redirect Shader]] used in the same context. The reason the Warp Shader and the [[Redirect Shader]] often work well together is because the [[Redirect Shader]] allows you to construct displacement vectors which go in all directions, which can be useful for warping a 3D function such as the Power Fractal. If you just use a single fractal operating along the normal as your warper, you might not easily see its warping effect.
+
You may see the Warp Merge Shader and the [[Redirect Shader]] used in the same context. The reason the Warp Merge Shader and the [[Redirect Shader]] often work well together is because the [[Redirect Shader]] allows you to construct displacement vectors which go in all directions, which can be useful for warping a 3D function such as the Power Fractal. If you just use a single fractal operating along the normal as your warper, you might not easily see its warping effect.
 +
 
 +
See also: [[Warp Input Shader]]
 +
 
 +
Some shaders are not always affected by warp shaders, depending on their settings:
 +
 
 +
* Distribution Shader v4. If the Altitude Key is set to "Final position" then it uses world space instead of texture space, so warp shaders have no effect, although its mask may be warped.
 +
* Geog Image Map Shader. If georeferencing is enabled it uses world space instead of texture space, so warp shaders have no effect, although its mask may be warped.
 +
 
 +
Some shaders are not affected by warp shaders, although their ''masks'' may be:
 +
 
 +
* Any displacements following a 'Compute Terrain' node or 'Tex Coords from XYZ' node - these nodes reset the texture coordinates for downstream displacements
 +
* Cloud layers (Cloud Layer v2/v3 and Easy Cloud) - these are world space volumetric objects, but warps can be applied separately to their inputs
 +
* Constant Shader - produces the same output everywhere
 +
* Distance Shader - uses world space
 +
* Heightfield Shader - uses world space, although its mask may be warped
 +
* Lambert Shader - uses the same albedo everywhere
 +
* MOLA Map Shader - uses undisplaced normal to infer position on the planet, although its mask may be warped
 +
* Planet Atmosphere - this is a world space volumetric object, but warps can be applied separately to its inputs
 +
* Shadow Catcher Shader - is only affected by lighting
 +
* Twist and Shear Shader - uses world space
 +
* Visualise Normal - normals are not changed by warp shaders
 +
 
  
  

Revision as of 03:19, 5 May 2017

Warp Merge Shader

Node Description and Purpose:
The Warp Merge Shader performs a domain distortion on the shader attached to its Shader input, using the displacement vectors from the shader attached to its Warper input. It does this by offsetting the texture coordinates before they are used by the shader. This almost looks like the warper bends the final result, but it's actually bending the space before it is read by the shader. A simplistic way you can think about it is that the shapes from the warper will bend the final texture (but in the opposite direction).

When the Warp Merge Shader is asked to shade or displace a point, the following happens. First, like most other shaders in Terragen, the Warp Merge Shader calls the shader connected to its main input. The main input is not warped. Then "warper" is called to produce a displacement vector. To produce the warp effect the warper must be a displacement shader or a network of shaders producing displacement. The displacement is not applied to the surface; its vector is merely stored for the next step. Next, the texture coordinates ("position in texture") are offset by the displacement vector, and then "shader" is called. The shader now produces different results because it works with modified texture coordinates. Finally, the texture coordinates are reset so that shaders following the Warp Merge Shader will not be affected.

If you have a colour shader, colour function, scalar function or vector function that you want to use as your warper, you can turn it into displacement using a Displacement Shader or a Vector Displacement Shader.

You may see the Warp Merge Shader and the Redirect Shader used in the same context. The reason the Warp Merge Shader and the Redirect Shader often work well together is because the Redirect Shader allows you to construct displacement vectors which go in all directions, which can be useful for warping a 3D function such as the Power Fractal. If you just use a single fractal operating along the normal as your warper, you might not easily see its warping effect.

See also: Warp Input Shader

Some shaders are not always affected by warp shaders, depending on their settings:

  • Distribution Shader v4. If the Altitude Key is set to "Final position" then it uses world space instead of texture space, so warp shaders have no effect, although its mask may be warped.
  • Geog Image Map Shader. If georeferencing is enabled it uses world space instead of texture space, so warp shaders have no effect, although its mask may be warped.

Some shaders are not affected by warp shaders, although their masks may be:

  • Any displacements following a 'Compute Terrain' node or 'Tex Coords from XYZ' node - these nodes reset the texture coordinates for downstream displacements
  • Cloud layers (Cloud Layer v2/v3 and Easy Cloud) - these are world space volumetric objects, but warps can be applied separately to their inputs
  • Constant Shader - produces the same output everywhere
  • Distance Shader - uses world space
  • Heightfield Shader - uses world space, although its mask may be warped
  • Lambert Shader - uses the same albedo everywhere
  • MOLA Map Shader - uses undisplaced normal to infer position on the planet, although its mask may be warped
  • Planet Atmosphere - this is a world space volumetric object, but warps can be applied separately to its inputs
  • Shadow Catcher Shader - is only affected by lighting
  • Twist and Shear Shader - uses world space
  • Visualise Normal - normals are not changed by warp shaders


Node Type: Other Shader


Settings:

  • Warper: The shader attached to this input generates the warp or distortion which effects the node attached to the Shader input.
  • Shader: The shader attached to this input is the one which is effected by the Warper shader.

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.

Literally, to change the position of something. In graphics terminology to displace a surface is to modify its geometric (3D) structure using reference data of some kind. For example, a grayscale image might be taken as input, with black areas indicating no displacement of the surface, and white indicating maximum displacement. In Terragen 2 displacement is used to create all terrain by taking heightfield or procedural data as input and using it to displace the normally flat sphere of the planet.

Literally, to change the position of something. In graphics terminology to displace a surface is to modify its geometric (3D) structure using reference data of some kind. For example, a grayscale image might be taken as input, with black areas indicating no displacement of the surface, and white indicating maximum displacement. In Terragen 2 displacement is used to create all terrain by taking heightfield or procedural data as input and using it to displace the normally flat sphere of the planet.

A vector is a set of three scalars, normally representing X, Y and Z coordinates. It also commonly represents rotation, where the values are pitch, heading and bank.

A scalar is a single number. 1, 200.45, -45, -0.2 are all examples of scalar values.