Difference between revisions of "Transform Input Shader"

From Terragen Documentation from Planetside Software
Jump to: navigation, search
(Formatting)
(Added Visualizing Transformation section and example images.)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[File:TransformInputShader_2017-05-04.png]]
+
[[File:TransformInput_00_GUI.png|none|470px|Transform Input Shader]]
  
  
 +
__TOC__
 +
 +
== Overview ==
 
Transform Input Shader and [[Transform Merge Shader]] allow you to transform the output of other shaders by changing their texture coordinates. A transformation can translate (move), scale (resize) and rotate. It can also reset the texture coordinates to a different texture space (e.g. world space or undisplaced space). Any shaders which are upstream (via the main input connection) are affected by the Transform Input Shader, as long as those shaders are programmed to use texture coordinates. Most shaders do use texture coordinates but some exceptions are listed below. The Transform Input Shader works by modifying the texture coordinates before it evaluates the upstream shaders. The upstream shaders see modified texture coordinates and therefore any shapes or textures they produce are transformed in space.
 
Transform Input Shader and [[Transform Merge Shader]] allow you to transform the output of other shaders by changing their texture coordinates. A transformation can translate (move), scale (resize) and rotate. It can also reset the texture coordinates to a different texture space (e.g. world space or undisplaced space). Any shaders which are upstream (via the main input connection) are affected by the Transform Input Shader, as long as those shaders are programmed to use texture coordinates. Most shaders do use texture coordinates but some exceptions are listed below. The Transform Input Shader works by modifying the texture coordinates before it evaluates the upstream shaders. The upstream shaders see modified texture coordinates and therefore any shapes or textures they produce are transformed in space.
  
Line 11: Line 14:
  
  
===Exceptions===
+
'''Settings:'''
 +
 
 +
*'''Name:''' This setting allows you to apply a descriptive name to the node, which can be helpful when using multiple Transform Input shader nodes in a project.
 +
 
 +
*'''Enable:''' When checked, the node is active and the settings below will affect the surface. When unchecked, the node is ignored.
 +
 
 +
 
 +
*'''Use world space: (final position):''' When checked, the texture coordinates are reset to world space coordinates.
 +
<ul>
 +
{|
 +
|-
 +
| [[File:TransformInput_07_SphereWithUseWorldSpaceOn.jpg|none|800 px | By resetting the texture coordinates to World space coordinates the Power fractal shader is properly aligned and is no longer pinched at the top of the sphere.
 +
]]
 +
|-
 +
| [[File:TransformInput_09_CraterCity.jpg|none|800px | When you need to mask terrain features that have been warped by other shaders you may need to add a Transform input or Transform merge shader and enable Use world space.
 +
]]
 +
|}
 +
</ul>
 +
 
 +
 
 +
* '''Use undisplaced space (position in geometry):'''  When checked, the texture coordinates are reset to the undisplaced space. 
 +
 
 +
 
 +
*'''Translate: ''' When checked, all shaders upstream from this node are moved in the amount in metres and in the direction as specified by the values entered into the XYZ axis fields to the right.
 +
<ul>
 +
[[File:TransformInput_01_Translate.jpg|none|800px|Terrain features and textures moved via Translate values.  ]]
 +
</ul>
 +
 
 +
 
 +
*'''Rotate: ''' When checked, all shaders upstream from this node are rotated in degrees in the amount and direction as specified by the values entered into the XYZ axis fields to the right.
 +
<ul>
 +
[[File:TransformInput_02_Rotate.jpg|none|800 px | Terrain features and textures rotated via Rotate setting.]]
 +
</ul>
 +
 
 +
 
 +
*'''Scale: '''  When checked, all shaders upstream from this node are resized in the amount specified by the values entered into the XYZ axis fields to the right.
 +
<ul>
 +
[[File:TransformInput_03_Scale.jpg|800 px | Terrain features and textures resized via Scale values.]]
 +
</ul>
 +
 
 +
 
 +
== Visualizing Transformations ==
 +
The example images below are based on Terragen’s default Earth-sized planet.  A Simple shape shader has been set to “Polygon” Type of shape and scaled to 500 kilometers x 1,000 kilometres.  Note how the colours in the left-most images correspond; what the render camera sees and where those colors actually are located in texture space. 
 +
<ul>
 +
{|
 +
|-
 +
| [[File:TransformMerge_04_TextureCoordsRenderCamPOV.jpg|none|800px | Warping and transforming the terrain from the render camera’s point of view.]]
 +
|-
 +
| [[File:TransformMerge_05_TextureCoordsSphericalCamPOV.jpg|none|800px | Warping and transforming the terrain from the texture coordinates point of view.]]
 +
|}
 +
</ul>
 +
 
 +
 
 +
This example illustrates the effect on texture coordinates while transforming the position of the Simple shape shader along its Z axis. The further along the positive Z axis it’s moved the closer the two shapes converge in texture coordinate space until they meet in the middle. 
 +
<ul>
 +
[[File:TransformMerge_06_TextureCoordsSphericalCamPOV_Zaxis.jpg|none|800px | Repositioning a feature such as a Simple shape shader from the texture coordinates point of view.]]
 +
</ul>
 +
 
 +
 
 +
The orientation of the projection camera aso plays a role here, for example rotating the projection camera on its X axis 90 degrees causes the poles to be centered and along the left and right edges in frame.
 +
<ul>
 +
[[File:TransformMerge_07_TextureCoordsSphericalCamPOVRotated.jpg|none|200 px | The effect on texture space by rotating the projection camera.]]
 +
</ul>
 +
 
 +
 
 +
== Exceptions ==
  
 
Some shaders are not always affected by the Transform Input Shader or Transform Merge Shader, depending on their settings:
 
Some shaders are not always affected by the Transform Input Shader or Transform Merge Shader, depending on their settings:
Line 36: Line 104:
  
  
[[Category:Other Shader]]
+
[[Category:Transform Shader]]

Latest revision as of 23:40, 30 July 2021

Transform Input Shader


Overview[edit]

Transform Input Shader and Transform Merge Shader allow you to transform the output of other shaders by changing their texture coordinates. A transformation can translate (move), scale (resize) and rotate. It can also reset the texture coordinates to a different texture space (e.g. world space or undisplaced space). Any shaders which are upstream (via the main input connection) are affected by the Transform Input Shader, as long as those shaders are programmed to use texture coordinates. Most shaders do use texture coordinates but some exceptions are listed below. The Transform Input Shader works by modifying the texture coordinates before it evaluates the upstream shaders. The upstream shaders see modified texture coordinates and therefore any shapes or textures they produce are transformed in space.


The difference between the Transform Input Shader and the Transform Merge Shader is:

  • The Transform Input Shader transforms the shader attached to the main input (Input node) and any shaders further upstream of the main input.
  • The Transform Merge Shader transforms the shader attached to the Shader input and any shaders further upstream of that input (in other words a "side branch"). It merges the side branch with the main input, but only the side branch is transformed.


Settings:

  • Name: This setting allows you to apply a descriptive name to the node, which can be helpful when using multiple Transform Input shader nodes in a project.
  • Enable: When checked, the node is active and the settings below will affect the surface. When unchecked, the node is ignored.


  • Use world space: (final position): When checked, the texture coordinates are reset to world space coordinates.
    By resetting the texture coordinates to World space coordinates the Power fractal shader is properly aligned and is no longer pinched at the top of the sphere.
    When you need to mask terrain features that have been warped by other shaders you may need to add a Transform input or Transform merge shader and enable Use world space.


  • Use undisplaced space (position in geometry): When checked, the texture coordinates are reset to the undisplaced space.


  • Translate: When checked, all shaders upstream from this node are moved in the amount in metres and in the direction as specified by the values entered into the XYZ axis fields to the right.
    Terrain features and textures moved via Translate values.


  • Rotate: When checked, all shaders upstream from this node are rotated in degrees in the amount and direction as specified by the values entered into the XYZ axis fields to the right.
    Terrain features and textures rotated via Rotate setting.


  • Scale: When checked, all shaders upstream from this node are resized in the amount specified by the values entered into the XYZ axis fields to the right.
    Terrain features and textures resized via Scale values.


Visualizing Transformations[edit]

The example images below are based on Terragen’s default Earth-sized planet. A Simple shape shader has been set to “Polygon” Type of shape and scaled to 500 kilometers x 1,000 kilometres. Note how the colours in the left-most images correspond; what the render camera sees and where those colors actually are located in texture space.

    Warping and transforming the terrain from the render camera’s point of view.
    Warping and transforming the terrain from the texture coordinates point of view.


This example illustrates the effect on texture coordinates while transforming the position of the Simple shape shader along its Z axis. The further along the positive Z axis it’s moved the closer the two shapes converge in texture coordinate space until they meet in the middle.

    Repositioning a feature such as a Simple shape shader from the texture coordinates point of view.


The orientation of the projection camera aso plays a role here, for example rotating the projection camera on its X axis 90 degrees causes the poles to be centered and along the left and right edges in frame.

    The effect on texture space by rotating the projection camera.


Exceptions[edit]

Some shaders are not always affected by the Transform Input Shader or Transform Merge Shader, 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 the Tranform Input Shader and Transform Merge Shader have no effect, although its mask may be transformed.
  • Geog Image Map Shader. If georeferencing is enabled it uses world space instead of texture space, so the Transform Input Shader and Transform Merge Shader have no effect, although its mask may be transformed.

Some shaders are not affected by the Transform Input Shader or Transform Merge Shader, 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 transforms 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 transformed
  • Lambert Shader - uses the same albedo everywhere
  • MOLA Map Shader - uses undisplaced normal to infer position on the planet, although its mask may be transformed
  • Planet Atmosphere - this is a world space volumetric object, but transforms 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 the Tranform Input Shader or Transform Merge Shader


See also: Transform Merge 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.

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.