Warp Input Shader

From Terragen Documentation from Planetside Software
Revision as of 03:13, 5 May 2017 by Matt (talk | contribs) (New page adapted from the deprecated Warp Shader page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Node Description and Purpose:
The Warp Input Shader performs a domain distortion on any shaders which are upstream (via its main input connection), 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 input shaders. 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 Input Shader is asked to shade or displace a point, the following happens. First, the shader attached to 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 the main input shaders are called. The main input shaders now produce different results because they work with modified texture coordinates. Finally, the texture coordinates are reset so that shaders following the Warp Input 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 Input Shader and the Redirect Shader used in the same context. The reason the Warp Input 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.


Node Type: Other Shader


Settings:

  • Warper: The shader attached to this input generates the warp or distortion which affects the main input.

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 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.

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.