Difference between revisions of "Get Position"

From Terragen Documentation from Planetside Software
Jump to: navigation, search
 
Line 2: Line 2:
  
 
Provides the Position, in world space, of the current [[Render State]]. The [[Render State]] is affected by any shaders which were called before this function is called, among other things. Position is the current point on/in the surface/volume being rendered or sampled.
 
Provides the Position, in world space, of the current [[Render State]]. The [[Render State]] is affected by any shaders which were called before this function is called, among other things. Position is the current point on/in the surface/volume being rendered or sampled.
 +
 +
The input connection is not used by this node (consistent with all [[:Get|Get nodes]]).
  
 
When used in the context of displacement, for example in a function network that feeds a displacement shader, Position depends on where the node is connected with respect to other displacement shaders. This is because displacement shaders modify Position immediately.
 
When used in the context of displacement, for example in a function network that feeds a displacement shader, Position depends on where the node is connected with respect to other displacement shaders. This is because displacement shaders modify Position immediately.
Line 8: Line 10:
  
 
For many shading uses it is better to use [[Get Position in Texture]], because that often provides a value that is consistent between displacement and colour contexts.
 
For many shading uses it is better to use [[Get Position in Texture]], because that often provides a value that is consistent between displacement and colour contexts.
 
The Input connection is not used by this node.
 
  
 
<!-- imported from file: module_38.html-->
 
<!-- imported from file: module_38.html-->
  
 
[[Category:Get]]
 
[[Category:Get]]

Latest revision as of 01:56, 7 October 2018

Get Position

Provides the Position, in world space, of the current Render State. The Render State is affected by any shaders which were called before this function is called, among other things. Position is the current point on/in the surface/volume being rendered or sampled.

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

When used in the context of displacement, for example in a function network that feeds a displacement shader, Position depends on where the node is connected with respect to other displacement shaders. This is because displacement shaders modify Position immediately.

When used in the context of providing colour and lighting to a surface, for example in a function network that feeds a shader's colour or luminosity, Position is always the "final position" after all displacement. This is because all displacements are performed before any shader's colour and lighting is calculated.

For many shading uses it is better to use Get Position in Texture, because that often provides a value that is consistent between displacement and colour contexts.

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.