Difference between revisions of "Y to Scalar"

From Terragen Documentation from Planetside Software
Jump to: navigation, search
(Updated descriptions and added example images.)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
[[Image:drex_module_104_image_0.png|485pxpx|Y to Scalar]]
+
<div style="float:right; border-style:solid; padding:20px"><categorytree mode=pages hideroot=off>Convert</categorytree></div>
  
'''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.
+
[[File:Y2Scalar_00_GUI.png|none|470px|Y to Scalar]]
  
<!-- imported from file: module_104.html-->
 
  
[[Category:Convert| ]]
+
__TOC__
 +
 
 +
 
 +
==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 Y to scalar node will output the Y 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 Y 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 Y to Scalar ==
 +
 
 +
Using the Y to scalar node you can define parallel lines, warp them into interesting shapes, then use them as masks for a multitude of things, like texturing, displacement or cloud density.
 +
 
 +
To create a bunch of rows, start by adding these three function nodes to the project.  An Y 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 Y 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 Y 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 Y 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 Y to scalar node.
 +
* Add a Sin scalar node and connect the output from the Y 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:Y2Scalar_01_NodeNetworkStep01.jpg|none|800px|Node network view with Y to scalar, Get position in texture, and Sin scalar nodes connected.]]
 +
|-
 +
| [[File:Y2Scalar_02_RenderStep01.jpg|none|800px|Render showing parallel lines along the mountain surface.]]
 +
|}
 +
 
 +
 
 +
You can scale the rows by multiplying the Y 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 Y 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:Y2Scalar_03_NodeNetworkStep02.jpg|none|800px|By multiplying the output value of the Y to scalar node, you can change the scale of the rows.]]
 +
|-
 +
| [[File:Y2Scalar_04_RenderStep03.jpg|none|800px|Render showing the effect of multiplying the Y to scalar output value by another value.]]
 +
|}
 +
 
 +
 
 +
To redistribute the straight rows into more interesting and organic looking shapes, we’ll use a Power Fractal noise pattern and a warping shader.  Unlike warping the Sin scalar pattern created with an X to Scalar or Z to scalar nodes, we need to orient the displacement to the Y axis, and we can do this with a Vector displacement shader.. 
 +
* Add a Power fractal shader, a Vector displacement shader, and a Warp input shader to the project.
 +
* Connect the output from the Power fractal shader to the Vector function of the Vector displacement shader.
 +
*Connect the output from the Vector displacement shader to the Warper parameter of the Warp input shader.
 +
* Finally, connect the output from the Warp input shader to the Surface layer’s Mask shader input.
 +
*Double click the Vector displacement shader node to open its window and set the X and Z function multiplier values to 0 and the Y function multiplier value to 1. This instructs Terragen to use only the Y axis.  Use the Final Multiplier value to control the intensity of the redistribution.  In this case, higher values will create more distortion.
 +
 
 +
{|
 +
|-
 +
|[[File:Y2Scalar_05_NodeNetworkStep03.jpg|None|800px|A Power fractal shader, Vector displacement shader, and a warping shader node are used to create more interesting and organic shapes from the straight rows.]]
 +
|-
 +
|[[File:Y2Scalar_06_RenderStep03.jpg|none|800px|Render showing the effect of warping the straight rows.]]
 +
|}
 +
 
 +
 +
Since the warping effect is already applied as a mask to the Surface layer in this example, we’ll use the Surface layer as an additional texture for the mountains.  The Surface layer shader also allows you to constrain the warping effect by altitude and slope.  We’ll insert a simple dirt layer before the existing Surface layer shader with the warped mask, and then adjust the shader’s colour values to a pleasing value.
 +
* To create the dirt layer, you can adjust the Apply high colour and Apply low colour parameters of the Base colour node, or you can add a new Surface layer to the project and adjust its Apply colour value, and even assign another Power fractal shader to its Colour function to add further detail.
 +
* Double click the Surface layer node with our mask applied to it, and set its Apply colour value to something that works well with the dirt layer, then assign another Power fractal shader to its Colour function.  You can vary the colour and scale of the Power fractal to add additional details.
 +
 
 +
{|
 +
|-
 +
|[[File:Y2Scalar_07_NodeNetworkStep04.jpg|none|800px|The mask created with the Y to scalar node network is used to add additional texture detail to the mountain landscape.]]
 +
|-
 +
| [[File:Y2Scalar_08_RenderStep04.jpg|none|800px|Render showing the effect of the mask created with the Y to scalar node network as additional texture detail to the mountain landscape.]]
 +
|}
 +
 +
 
 +
<br /n>
 +
 
 +
[[Category:Convert]]

Latest revision as of 22:29, 7 March 2022

Y 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 Y to scalar node will output the Y 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 Y 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 Y to Scalar[edit]

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

To create a bunch of rows, start by adding these three function nodes to the project. An Y 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 Y 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 Y 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 Y 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 Y to scalar node.
  • Add a Sin scalar node and connect the output from the Y 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 Y to scalar, Get position in texture, and Sin scalar nodes connected.
Render showing parallel lines along the mountain surface.


You can scale the rows by multiplying the Y 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 Y 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 Y to scalar node, you can change the scale of the rows.
Render showing the effect of multiplying the Y to scalar output value by another value.


To redistribute the straight rows into more interesting and organic looking shapes, we’ll use a Power Fractal noise pattern and a warping shader. Unlike warping the Sin scalar pattern created with an X to Scalar or Z to scalar nodes, we need to orient the displacement to the Y axis, and we can do this with a Vector displacement shader..

  • Add a Power fractal shader, a Vector displacement shader, and a Warp input shader to the project.
  • Connect the output from the Power fractal shader to the Vector function of the Vector displacement shader.
  • Connect the output from the Vector displacement shader to the Warper parameter of the Warp input shader.
  • Finally, connect the output from the Warp input shader to the Surface layer’s Mask shader input.
  • Double click the Vector displacement shader node to open its window and set the X and Z function multiplier values to 0 and the Y function multiplier value to 1. This instructs Terragen to use only the Y axis. Use the Final Multiplier value to control the intensity of the redistribution. In this case, higher values will create more distortion.
A Power fractal shader, Vector displacement shader, and a warping shader node are used to create more interesting and organic shapes from the straight rows.
Render showing the effect of warping the straight rows.


Since the warping effect is already applied as a mask to the Surface layer in this example, we’ll use the Surface layer as an additional texture for the mountains. The Surface layer shader also allows you to constrain the warping effect by altitude and slope. We’ll insert a simple dirt layer before the existing Surface layer shader with the warped mask, and then adjust the shader’s colour values to a pleasing value.

  • To create the dirt layer, you can adjust the Apply high colour and Apply low colour parameters of the Base colour node, or you can add a new Surface layer to the project and adjust its Apply colour value, and even assign another Power fractal shader to its Colour function to add further detail.
  • Double click the Surface layer node with our mask applied to it, and set its Apply colour value to something that works well with the dirt layer, then assign another Power fractal shader to its Colour function. You can vary the colour and scale of the Power fractal to add additional details.
The mask created with the Y to scalar node network is used to add additional texture detail to the mountain landscape.
Render showing the effect of the mask created with the Y to scalar node network as additional texture detail to the mountain landscape.



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.