Difference between revisions of "X to Scalar"

From Terragen Documentation from Planetside Software
Jump to: navigation, search
(Updated descriptions and added example images.)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
[[Category:IMPORT]]
+
<div style="float:right; border-style:solid; padding:20px"><categorytree mode=pages hideroot=off>Convert</categorytree></div>
='''X to Scalar'''=
 
  
[[Image:drex_module_103_image_0.png|485pxpx|X to Scalar]]
+
[[File:X2Scalar_00_GUI.png|none|470px|X to Scalar]]
  
'''Node Description & Purpose: '''<br /> The X/Y/Z to scalar nodes all take a vector as input and output the respective vector component as a scalar. For example, the X to scalar node will output the X value of the input vector.<br /><br />'''Node Type: ''' Function<br /><br />'''Settings: '''<br /> This node has no other settings apart from the Input node.
 
  
__NOTOC__
+
__TOC__
<!-- imported from file: module_103.html-->
+
 
 +
 
 +
== Overview ==
 +
The X/Y/Z to scalar nodes all take a vector as input and output the respective vector component as a scalar. For example, the X to scalar node will output the X value of the input vector.
 +
 
 +
This node has no other settings apart from the Input node.
 +
 
 +
'''Settings:'''
 +
 
 +
*'''Name:''' This setting allows you to apply a descriptive name to the node, which can be helpful when using multiple X to scalar nodes in a project.
 +
*'''Enable:''' When checked, the node is active and the conversion operation will take place. When unchecked the values assigned to its Main Input, if any, are passed through, otherwise a value of 0 is passed through.
 +
 
 +
 
 +
==Fun with X to Scalar==
 +
 
 +
Using the X to scalar node you can define parallel lines, warp them into interesting shapes, then use them as masks for a multitude of things, like displacement or cloud density.
 +
 
 +
To create a bunch of rows, start by adding these three function nodes to the project.  An X to scalar node, a Get position in texture node, and a Sin scalar node.  You can quickly add these nodes to the project via the Quick Node Palette by pressing the Tab key, selecting the node and pressing the Enter key. 
 +
 
 +
The X to scalar node needs a vector as input, so we use a Get position in texture node to provide the texture coordinates for the point being sampled.  The X to scalar node outputs a scalar value to the Sin scalar which creates the rows.  To visualize what these three nodes are doing in the 3D Preview, apply them as a mask to a Surface layer node.
 +
* Add an X to scalar node to the project.
 +
* Add a Get position in texture node to the project and connect its output to the Main Input of the X to scalar node.
 +
* Add a Sin scalar node and connect the output from the X to scalar node to its Main input.
 +
* Add a Surface layer node and connect the output from the Sin scalar node to its Mask shader input.
 +
* Check the Surface layer’s Enable test colour parameter to easily visualize the effect of the node in the 3D Preview.
 +
 
 +
{|
 +
|-
 +
| [[File:X2Scalar_01_FunWithStep01.jpg|none|800px|Node network view with X to scalar, Get position in texture, and Sin scalar nodes connected.]]
 +
|-
 +
| [[File:X2Scalar_02_FunWithRenderStep01.jpg|none|800px|Render showing parallel lines along the surface of the planet.]]
 +
|}
 +
 
 +
 
 +
 
 +
You can scale the rows by multiplying the X to scalar value by another value. We’ll use a Constant scalar node to provide that value, and a Multiply scalar node to do the multiplication operation.
 +
* Add a Multiply scalar node to the project and connect its output to the Sin scalar node’s Main input.
 +
* Connect the output from the X to scalar node to the Main input of the Multiply scalar node.
 +
* Add a Constant scalar node and connect its output to the Multiply scalar node’s Input 2.
 +
* Double click the Constant scalar node to open its window and try some values to the Scalar input parameter to see their effect.
 +
 
 +
{|
 +
|-
 +
| [[File:X2Scalar_03_FunWithStep02.jpg|none|800px|By multiplying the output value of the X to scalar node, you can change the scale of the rows.]]
 +
|-
 +
| [[File:X2Scalar_04_FunWithRenderStep02.jpg|none|800px|Render showing the effect of multiplying the X to scalar output value by another value.]]
 +
|}
 +
 
 +
 
 +
 
 +
To warp the straight rows into more interesting shapes we’ll add a Fractal warp shader after the Sin scalar node. The Fractal warp shader has a number of parameters in which to modify the values assigned to its Main input.
 +
* Add a Fractal warp shader to the project and connect its output to the Surface layer’s Mask shader.
 +
* Connect the output from the Sin scalar node to the Main input of the Fractal warp shader.
 +
* Double click on the Fractal warp shader and enter different values into its parameters to see the effect on the straight rows.
 +
 
 +
{|
 +
|-
 +
| [[File:X2Scalar_05_FunWithStep03.jpg|None|800px|A Fractal warp shader node is used to create more interesting and organic shapes from the straight rows.]]
 +
|-
 +
|[[File:X2Scalar_06_FunWithRenderStep03.jpg|none|800px|Render showing the effect of the Fractal warp shader on the straight rows.]]
 +
|}
 +
 
 +
 
 +
 
 +
Now we can use this not only as a mask, but to displace the surface of the planet as well.  With the Surface layer shader you can control the height of the displacement and constrain it by altitude and slope.
 +
* Connect the output of the Fractal warp shader to the Surface layer’s Displacement input.
 +
* Double click the Surface layer node to open its window and under the Displacement tab increase the Displacement multiplier value to see its effect.
 +
* Under the Altitude constraints tab, check the Limit maximum altitude checkbox and modify the Maximum altitude parameter to see its effect.
 +
 
 +
{|
 +
|-
 +
| [[File:X2Scalar_07_FunWithStep04.jpg|none|800px|The Fractal warp shader can also define the location of where displacements may take place.]]
 +
|-
 +
| [[File:X2Scalar_08_FunWithStep04.jpg|none|800px|Render showing the effect of the Fractal warp shader as a mask for surface displacement.]]
 +
|}
 +
 
 +
 
 +
<br /n>
 +
 
 +
 
 +
[[Category:Convert]]

Latest revision as of 05:25, 5 March 2022

X to Scalar



Overview[edit]

The X/Y/Z to scalar nodes all take a vector as input and output the respective vector component as a scalar. For example, the X to scalar node will output the X value of the input vector.

This node has no other settings apart from the Input node.

Settings:

  • Name: This setting allows you to apply a descriptive name to the node, which can be helpful when using multiple X to scalar nodes in a project.
  • Enable: When checked, the node is active and the conversion operation will take place. When unchecked the values assigned to its Main Input, if any, are passed through, otherwise a value of 0 is passed through.


Fun with X to Scalar[edit]

Using the X to scalar node you can define parallel lines, warp them into interesting shapes, then use them as masks for a multitude of things, like displacement or cloud density.

To create a bunch of rows, start by adding these three function nodes to the project. An X to scalar node, a Get position in texture node, and a Sin scalar node. You can quickly add these nodes to the project via the Quick Node Palette by pressing the Tab key, selecting the node and pressing the Enter key.

The X to scalar node needs a vector as input, so we use a Get position in texture node to provide the texture coordinates for the point being sampled. The X to scalar node outputs a scalar value to the Sin scalar which creates the rows. To visualize what these three nodes are doing in the 3D Preview, apply them as a mask to a Surface layer node.

  • Add an X to scalar node to the project.
  • Add a Get position in texture node to the project and connect its output to the Main Input of the X to scalar node.
  • Add a Sin scalar node and connect the output from the X to scalar node to its Main input.
  • Add a Surface layer node and connect the output from the Sin scalar node to its Mask shader input.
  • Check the Surface layer’s Enable test colour parameter to easily visualize the effect of the node in the 3D Preview.
Node network view with X to scalar, Get position in texture, and Sin scalar nodes connected.
Render showing parallel lines along the surface of the planet.


You can scale the rows by multiplying the X to scalar value by another value. We’ll use a Constant scalar node to provide that value, and a Multiply scalar node to do the multiplication operation.

  • Add a Multiply scalar node to the project and connect its output to the Sin scalar node’s Main input.
  • Connect the output from the X to scalar node to the Main input of the Multiply scalar node.
  • Add a Constant scalar node and connect its output to the Multiply scalar node’s Input 2.
  • Double click the Constant scalar node to open its window and try some values to the Scalar input parameter to see their effect.
By multiplying the output value of the X to scalar node, you can change the scale of the rows.
Render showing the effect of multiplying the X to scalar output value by another value.


To warp the straight rows into more interesting shapes we’ll add a Fractal warp shader after the Sin scalar node. The Fractal warp shader has a number of parameters in which to modify the values assigned to its Main input.

  • Add a Fractal warp shader to the project and connect its output to the Surface layer’s Mask shader.
  • Connect the output from the Sin scalar node to the Main input of the Fractal warp shader.
  • Double click on the Fractal warp shader and enter different values into its parameters to see the effect on the straight rows.
A Fractal warp shader node is used to create more interesting and organic shapes from the straight rows.
Render showing the effect of the Fractal warp shader on the straight rows.


Now we can use this not only as a mask, but to displace the surface of the planet as well. With the Surface layer shader you can control the height of the displacement and constrain it by altitude and slope.

  • Connect the output of the Fractal warp shader to the Surface layer’s Displacement input.
  • Double click the Surface layer node to open its window and under the Displacement tab increase the Displacement multiplier value to see its effect.
  • Under the Altitude constraints tab, check the Limit maximum altitude checkbox and modify the Maximum altitude parameter to see its effect.
The Fractal warp shader can also define the location of where displacements may take place.
Render showing the effect of the Fractal warp shader as a mask for surface displacement.



A scalar is a single number. 1, 200.45, -45, -0.2 are all examples of scalar values.

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

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 parameter is an individual setting in a node parameter view which controls some aspect of the node.

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.