Difference between revisions of "Tex Coords From XYZ"

From Terragen Documentation from Planetside Software
Jump to: navigation, search
(Enhanced description for node and added example image.)
(Updated overview and replaced example images.)
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
 
The Tex Coords from XYZ node generates world space texture coordinates for the shader or function nodes assigned its Main Input.   
 
The Tex Coords from XYZ node generates world space texture coordinates for the shader or function nodes assigned its Main Input.   
  
That is, it returns the current altitude of a given sample point which more than likely has been modified by displacements, such as a Power fractal shader, from its original position on the planet’s smooth surface.
+
Historically, this node was first written to compute texture coordinates, and later as the need for surface normals became apparent the Compute Normal node was written.  Finally, the Compute Terrain node combines the functionality of the Tex Coords from XYZ node and the Compute Normal node into one node.
  
Without this information, certain shaders within Terragen such as the Surface Layer shader, might not have the correct altitude values at render time.  Click here for more information about an item’s render state.
+
[[File:TexCoordXYZ_02_Nodes.png|800px|The Tex Coords from XYZ node returns world texture space coordinates.  The Compute Normal returns surface normals, and the Compute Terrain node does both.]]
  
Taking the default Terragen project for example, if displacements occur after the Compute terrain node in the Terrain group then it’s possible that a Surface Layer shader providing colour information for the terrain might not have the correct altitudes to apply colour or constraints.
+
 
 +
It’s important to understand that in order for displacements and textures to be in sync and aligned, there should only exist one calculated solution within a given branch of the node network.  This is why the Terrain Group ends with a Compute Terrain node in the default Terragen project before moving onto the Shaders Group.  This workflow ensures that every shader will have consistent knowledge of the texture coordinates to work with.  However, if your workflow doesn’t require normals to be known, such as using Redirect shaders and Vector displacement, then the Texture Coords from XYZ may be a faster solution than the Compute Terrain node because it only calculates texture coordinates.
 +
 
 +
{|
 +
|-
 +
| [[File:TexCoordXYZ_03_Comparision_Altitude.jpg|800px|When the Tex Coord from XYZ node or the Compute Terrain node is enabled, surface shaders have access to the displacement altitudes.]]
 +
|-
 +
|[[File:TexCoordXYZ_06_Comparision_Slope.jpg|800px|When the Tex Coord from XYZ node is enabled (and there is no Compute Terrain node), surface shaders do not have have access to the displacement altitudes because the surface normals have not been calculated.]]
 +
|-
 +
| [[File:TexCoordXYZ_10_ComputeTerrainOn.jpg|800px|Some shaders, such as the Surface Layer, have Slope Key and Altitude Key settings which allow you to access the Final position of the surface and not just the last Compute Terrain or Tex Coords from XYZ nodes within the node network branch.]]
 +
|}
 +
 
 +
 
 +
Therefore, having a Tex Coords from XYZ and a Compute Terrain node in the same branch of a pipeline is not recommended.  Multiple Tex Coordinates from XYZ and/or Compute Terrain nodes can exist in a project provided they’re not being used by the same node network branch.  For example, a Compute terrain node with a Patch Size of 200 could exist and be used for populations only, while another Compute terrain node with a Patch Size of 20 is connected from the Terrain group (displacements) to the Shader group (texturing).
 +
 
 +
[[File:TexCoordXYZ_08_ComputeTerrainOn.jpg|800px|In this example, the forest population uses the Compute Terrain node with a Patch Size of 200 and not the Tex Coords from XYZ in order to access the terrain’s slope information.]]
 +
 
 +
 
 +
Certain workflows may also benefit by having the major surface displacement nodes positioned prior to the Compute Terrain node, and having the smaller, secondary displacements, such as a Strata and Outcrop shader occur after the Compute Terrain node.
  
  
Line 18: Line 36:
  
 
*'''Enable: '''When checked, the node is active and the current world space texture coordinates will be calculated for the shader or function nodes assigned to the Main input.  This includes all nodes upstream from the assigned shader node.
 
*'''Enable: '''When checked, the node is active and the current world space texture coordinates will be calculated for the shader or function nodes assigned to the Main input.  This includes all nodes upstream from the assigned shader node.
</ul>
 
 
 
[[File:TexCoordXYZ_01_Example.jpg|none|800px|Workflow showing a displaced terrain with and without using a Tex Coord From XYZ node.]]
 
  
 
</br>
 
</br>

Latest revision as of 23:41, 29 June 2021

Tex Coords From XYZ


Overview[edit]

The Tex Coords from XYZ node generates world space texture coordinates for the shader or function nodes assigned its Main Input.

Historically, this node was first written to compute texture coordinates, and later as the need for surface normals became apparent the Compute Normal node was written. Finally, the Compute Terrain node combines the functionality of the Tex Coords from XYZ node and the Compute Normal node into one node.

The Tex Coords from XYZ node returns world texture space coordinates.  The Compute Normal returns surface normals, and the Compute Terrain node does both.


It’s important to understand that in order for displacements and textures to be in sync and aligned, there should only exist one calculated solution within a given branch of the node network. This is why the Terrain Group ends with a Compute Terrain node in the default Terragen project before moving onto the Shaders Group. This workflow ensures that every shader will have consistent knowledge of the texture coordinates to work with. However, if your workflow doesn’t require normals to be known, such as using Redirect shaders and Vector displacement, then the Texture Coords from XYZ may be a faster solution than the Compute Terrain node because it only calculates texture coordinates.

When the Tex Coord from XYZ node or the Compute Terrain node is enabled, surface shaders have access to the displacement altitudes.
When the Tex Coord from XYZ node is enabled (and there is no Compute Terrain node), surface shaders do not have have access to the displacement altitudes because the surface normals have not been calculated.
Some shaders, such as the Surface Layer, have Slope Key and Altitude Key settings which allow you to access the Final position of the surface and not just the last Compute Terrain or Tex Coords from XYZ nodes within the node network branch.


Therefore, having a Tex Coords from XYZ and a Compute Terrain node in the same branch of a pipeline is not recommended. Multiple Tex Coordinates from XYZ and/or Compute Terrain nodes can exist in a project provided they’re not being used by the same node network branch. For example, a Compute terrain node with a Patch Size of 200 could exist and be used for populations only, while another Compute terrain node with a Patch Size of 20 is connected from the Terrain group (displacements) to the Shader group (texturing).

In this example, the forest population uses the Compute Terrain node with a Patch Size of 200 and not the Tex Coords from XYZ in order to access the terrain’s slope information.


Certain workflows may also benefit by having the major surface displacement nodes positioned prior to the Compute Terrain node, and having the smaller, secondary displacements, such as a Strata and Outcrop shader occur after the Compute Terrain node.


Settings:

    • Name: This setting allows you to apply a descriptive name to the node, which can be helpful when using multiple Tex Coords from XYZ shader nodes in a project.
    • Enable: When checked, the node is active and the current world space texture coordinates will be calculated for the shader or function nodes assigned to the Main input. This includes all nodes upstream from the assigned shader node.

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.

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.