Difference between revisions of "Get Position in Texture"

From Terragen Documentation from Planetside Software
Jump to: navigation, search
(Get Position in Texture)
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Category:IMPORT]]
+
[[Image:drex_module_40_image_0.png|485pxpx|Get Position in Texture]]
='''Get Position in Texture'''=
+
 
 +
Provides the "Position In Texture" of the current [[Render State]]. The [[Render State]] is affected by any shaders which were called before this function is called, among other things.
 +
 
 +
The input connection is not used by this node (consistent with all [[:Get|Get nodes]]).
 +
 
 +
Position in Texture provides the 3D texture coordinates at the current point. On imported objects such as OBJs or TGOs, these coordinates are often the UV texture coordinates (where X = U, Y = V, Z = 0). On terrains these coordinates are initially set to the position on the flat planet from which the terrain was displaced, but may be updated by [[Compute Terrain]] or [[Tex Coords From XYZ]] nodes to provide fully 3D texture coordinates. [[Transform Shader]] and [[Warp Shader]] modify Position in Texture for any networks connected to their Shader inputs, and other shaders may do so.
  
[[Image:drex_module_40_image_0.png|485pxpx|Get Position in Texture]]
+
Even when texture coordinates are not clearly needed, Get Position in Texture has a couple of advantages over [[Get Position]]. First, in a typical Terragen 2 scene, Position in Texture is set by [[Compute Terrain]] or [[Tex Coords From XYZ]] to provide a consistent value between displacement contexts and colour/lighting contexts for any shaders that are computed after those nodes. Second, in order to make use of transforms from [[Transform Shader]] or [[Warp Shader]], you need to use Position in Texture.
  
Provides the "Position In Texture" of the input node as its output.
+
In contexts where Position in Texture has not been updated (e.g. displacement before Compute Terrain or Tex Coords From XYZ), [[Get Position]] may be more useful.
  
__NOTOC__
 
 
<!-- imported from file: module_40.html-->
 
<!-- imported from file: module_40.html-->
 +
 +
[[Category:Get]]

Latest revision as of 01:57, 7 October 2018

Get Position in Texture

Provides the "Position In Texture" of the current Render State. The Render State is affected by any shaders which were called before this function is called, among other things.

The input connection is not used by this node (consistent with all Get nodes).

Position in Texture provides the 3D texture coordinates at the current point. On imported objects such as OBJs or TGOs, these coordinates are often the UV texture coordinates (where X = U, Y = V, Z = 0). On terrains these coordinates are initially set to the position on the flat planet from which the terrain was displaced, but may be updated by Compute Terrain or Tex Coords From XYZ nodes to provide fully 3D texture coordinates. Transform Shader and Warp Shader modify Position in Texture for any networks connected to their Shader inputs, and other shaders may do so.

Even when texture coordinates are not clearly needed, Get Position in Texture has a couple of advantages over Get Position. First, in a typical Terragen 2 scene, Position in Texture is set by Compute Terrain or Tex Coords From XYZ to provide a consistent value between displacement contexts and colour/lighting contexts for any shaders that are computed after those nodes. Second, in order to make use of transforms from Transform Shader or Warp Shader, you need to use Position in Texture.

In contexts where Position in Texture has not been updated (e.g. displacement before Compute Terrain or Tex Coords From XYZ), Get Position may be more useful.

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.