Difference between revisions of "Sin Scalar"

From Terragen Documentation from Planetside Software
Jump to: navigation, search
(Updated descriptions and added example images.)
 
Line 1: Line 1:
[[Image:drex_module_122_image_0.png|485pxpx|Sin Scalar]]
+
<div style="float:right; border-style:solid; padding:20px"><categorytree mode=pages hideroot=off>Trig</categorytree></div>
  
'''Node Description & Purpose: '''<br /> These nodes output the cosine, sine or tangent of the Input scalar. If you are using these functions for trigonomic calculations, rather than just for creating a wave shape or similar, you need to be aware that they expect Input values in radians rather than degrees. You can use the [[Degrees to Radians Scalar|Degrees to radians scalar node]] for the conversion.<br /><br />'''Node Type: ''' Function<br /><br />'''Settings: '''<br /> These nodes have no other settings apart from the Input node.
+
[[File:SinScalar_00_GUI.png|none|470px|Sin Scalar]]
  
<!-- imported from file: module_122.html-->
+
 
 +
__TOC__
 +
 
 +
 
 +
==Overview==
 +
These nodes output the cosine, sine or tangent of the Input scalar. If you are using these functions for trigonomic calculations, rather than just for creating a wave shape or similar, you need to be aware that they expect Input values in radians rather than degrees. You can use the Degrees to radians scalar node for the conversion.
 +
 
 +
These nodes have 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 Sin Scalar nodes in a project.
 +
*'''Enable:''' When checked, the node is active, and when unchecked the node is ignored.
 +
 
 +
<br /n>
 +
 
 +
== Fun with Sin Scalar==
 +
One way in which to use the Sin scalar function node is to create repeating lines or concentric circles.  Masks can be applied to break up the repetition, and the results can be warped into non-linear or non-concentric patterns. 
 +
 
 +
 
 +
The following examples illustrate the Sin scalar function displacing a surface.
 +
 
 +
 
 +
We’ll begin by adding a Displacement shader and a Sin scalar node to the project.  The Sin scalar node needs  data to work with, so we’ll add a Get Position in texture node so it can use the texture coordinates of the planet. 
 +
 
 +
*Starting with the default project, '''left-click''' in the Node Network pane and '''drag''' a selection box around the “Simple shape shader”, “Fractal terrain”, and “Fractal warp shader” nodes, then press the “'''delete'''” key on your keyboard to delete them.
 +
*Press the tab key or “'''N'''” key to open the Quick Node Palette window.
 +
* Start typing the words “'''Displacement shader'''” and the closest match in the Node list will be highlighted.
 +
* With “Displacement shader” highlighted, press the enter key to add it to the project.
 +
* Drag a connection line from the “'''Output'''” of the Displacement shader node to the ”'''Main input'''” of the Compute Terrain node.
 +
* Add a “'''Sin scalar'''” node and a “'''Get position in texture'''” node to the project in the same manner.
 +
* Drag a connection line from the “'''Output'''” of the Get position in texture node to the ”'''Main input'''” of the Sin scalar node.
 +
* Drag a connection line from the “'''Output'''” of the Sin scalar node to the ”'''Function'''” input of the Displacement shader.
 +
 
 +
 +
{|
 +
|-
 +
| [[File:SinScalar_01_FunWith_Circ_Step01.jpg|none|800px|Node Network view step 01.]]
 +
|-
 +
| [[File:SinScalar_02_FunWIth_Circ_Render_Step01.jpg|none|800px|Render step 01.]]
 +
|}
 +
 
 +
 +
In the images above, you can see that already the Sin scalar node has created concentric rings about the origin of the project.  You can increase or decrease the number of rings by multiplying the output from the Get position in texture node.  Larger values increase the number of rings, while smaller values decrease them.
 +
 +
* Add a “'''Multiply scalar'''” node and a “'''Constant scalar'''” node to the project.
 +
* Drag a connection line from the “'''Output'''” of the Get position in texture node to the “'''Main input'''” of the Multiply scalar node.
 +
* Drag a connection line from the “'''Output'''” of the Multiply scalar node to the “'''Main input'''” of the Sin scalar node.
 +
* Drag a connection line from the “'''Output'''" of the Constant scalar node to the “'''Input 2'''” of the Multiply scalar node.
 +
* Double-click on the Constant shader node to open its dialog window.
 +
* Set “'''Scalar'''” to “'''2'''”, to increase the number of rings, or “'''0.5'''” to decrease them.
 +
{|
 +
|-
 +
| [[File:SinScalar_03_FunWIth_Nodes_Step02.jpg|none|800px|Node Network view Step 02. ]]
 +
|}
 +
 
 +
{|
 +
|-
 +
| [[File:SinScalar_04_FunWith_Circ_Step02_A.jpg|none|400px|Render Step 02.  Scalar value set to 2.0.]] || [[File:SinScalar_05_FunWith_Circ_Step02_B.jpg|none|400px|Render Step 02.  Scalar value set to 0.5.]]
 +
|}
 +
 
 +
 
 +
You can also change the profile or curvature of the rings using functions like Bias scalar or Gain scalar.  These can be used to accentuate the high or low areas of the rings, and when used on terrain features such as a mountain, they can accentuate the rim of a mountain top or its foothills.
 +
 +
* Add a “'''Bias scalar'''” node and another “'''Constant scalar'''” node to the project.
 +
* Drag a connection line from the “'''Output'''” of the Sin scalar node to the “'''Main input'''” of the Bias scalar node.
 +
* Drag a connection line from the “'''Output'''” of the Bias scalar node to the “'''Function'''” input of the Displacement shader.
 +
* Drag a connection line from the “'''Output'''” of the second Constant scalar node to the “'''Bias'''” input of the Bias scalar node.
 +
* Double-click on the second Constant scalar node to open its dialog window.
 +
* Set the “'''Scalar'''” value to “'''0.2'''”.  Try other values to see how the curvature of the rings change.  Recommended values are 0.2 to 0.8.
 +
 
 +
{|
 +
|-
 +
| [[File:SinScalar_06_FunWith_Nodes_Step03.jpg|none|800px|Node Network view Step 03.]]
 +
|}
 +
 
 +
{|
 +
|-
 +
| [[File:SinScalar_07_FunWith_Circ_Step03_A.jpg|none|400px|Render Step 02.  Scalar value set to 0.8.]] ||[[File:SinScalar_08_FunWith_Circ_Step03_B.jpg|none|400px|Render Step 02.  Scalar value set to 0.2.]]
 +
|}
 +
 
 +
 
 +
You can break up the concentric ring pattern by multiplying them by other function nodes such as Perlin and Voronoi noise patterns.  These noise patterns require texture coordinate data which can be supplied by the Get position in texture node already in the project, and they have additional inputs for scale and seed value.
 +
 
 +
* Add another “'''Multiply scalar'''” node to the project.
 +
* Drag a connection line from the “'''Output'''” of the Bias scalar node to the “'''Main input'''” of the Multiply scalar node.
 +
* Drag a connection line from the “'''Output'''” of the Multiply scalar node to the “'''Function'''” input of the Displacement shader.
 +
* Add a “'''Voronoi 3D diff scalar'''” node to the project.
 +
* Drag a connection line from the “'''Output'''” of the Voronoi 3D diff scalar node to the “'''Input 2'''” of the second Multiply scalar node.
 +
* Either drag a connection line from the “'''Output'''” of the existing Get position in texture node to the “'''Main input'''” of the Voronoi 3D diff scalar node, or add another Get position in texture node to the project and connect its output to the Main input of the Voronoi 3D diff scalar node. 
 +
* Add another “'''Constant scalar'''” node to the project. This will control the size of the Voronoi noise pattern.
 +
* Drag a connection line from the “'''Output'''” of the Constant scalar node to the “'''Scale'''” input of the Voronoi 3D diff scalar node.
 +
* Double-click on the Constant scalar node to open its dialog window.
 +
* Set “'''Scalar'''” to “'''2'''”, or any other value you desire for the size of the noise pattern.
 +
* If you like, you can add another Constant scalar node to the project to control the Seed value of the noise pattern.  By changing the value assigned to the Seed parameter you change the noise pattern.
 +
 
 +
{|
 +
|-
 +
| [[File:SinScalar_09_FunWIth_Nodes_Step04.jpg|none|800px|Node Network view Step 04.]]
 +
|-
 +
| [[File:SinScalar_10_FunWith_Circ_Step04.jpg|none|800px|Render Step 04.]]
 +
|}
 +
 
 +
 +
By warping the rings you can distort the concentric ring pattern and create interesting, organic, and more natural looking forms.
 +
 +
* Add a “'''Fractal warp shader'''” to the project.
 +
* Drag a connection line from the “'''Output'''” of the Fractal warp shader to the “'''Function'''” input of the Displacement shader.
 +
* Drag a connection line from the “'''Output'''” of the Multiply scalar node to the “'''Main input'''” of the Fractal warp shader.
 +
* Double-click on the Fractal warp shader node to open its dialog window.
 +
* Experiment with the Fractal warp shader parameters and see how they warp the concentric circles into new shapes.
 +
{|
 +
|-
 +
| [[File:SinScalar_11_Nodes_Step05.jpg|none|800px|Node Network view Step 06.]]
 +
|-
 +
| [[File:SinScalar_12_FunWith_Circ_Step 05.jpg|none|800px|Render Step 05.]]
 +
|}
 +
 
 +
 +
We can follow a similar procedure for creating parallel rows.  Instead of directly connecting the Get position in texture node to the Sin scalar node we can insert a node to isolate one of the axis. 
 +
 +
* Start with a new project, deleting the same three nodes in the Terrain group we did in the first step above.
 +
* Add a “'''Displacement shader'''" node, “'''Get position in texture'''” node, a “'''Sin scalar'''” node, and a “'''X to scalar'''” node to the project and connect them together as indicated in the image below.
 +
{|
 +
|-
 +
| [[File:SinScalar_13_FunWith_Nodes_Step01_Rows.jpg|none|800px|Node Network view Step 01 - rows.]]
 +
|-
 +
| [[File:SinScalar_14_FunWith_Rows_Step01.jpg|none|800px|Render Step 01 - rows.]]
 +
|}
 +
 
 +
 +
Just like with the example using concentric rings, we can control the number of rows by multiplying the texture coordinate data before it gets to the Sin scalar node.
 +
 +
* Add a “'''Multiply scalar'''” node and a “'''Constant scalar'''” node to the project.
 +
* Drag a connection line from the “'''Output'''” of the X to scalar node to the “'''Main input'''” of the Multiply scalar node.
 +
* Drag a connection line from the “'''Output'''” of the Multiply scalar node to the “'''Main input'''” of the Sin scalar node.
 +
* Drag a connection line from the “'''Output'''” of the Constant scalar node to the “'''Input 2'''” of the Multiply scalar node.
 +
* Double-click on the Constant shader node to open its dialog window.
 +
* Set “'''Scalar'''” to “'''2'''”, to increase the number of rings, or “'''0.5'''” to decrease them.
 +
{|
 +
|-
 +
| [[File:SinScalar_15_FunWith_Nodes_Step02_Rows.jpg|none|800px|Node Network view Step 02 - rows.]]
 +
|}
 +
 +
{|
 +
|-
 +
| [[File:SinScalar_16_FunWith_Rows_Step02.jpg|none|400px|Render Step 02 - rows.  Scalar value set to 2.0.]] || [[File:SinScalar_17_FunWith_Rows_Step02.jpg|none|400px|Render Step 02 - rows.  Scalar value set to 0.5.]]
 +
|}
 +
 
 +
 +
The profile or curvature of the rows can be manipulated in precisely the same way as with the concentric rings.
 +
 
 +
* Add a “'''Bias scalar'''” node and another “'''Constant scalar'''” node to the project, and connect them as indicated in the image below.
 +
 
 +
{|
 +
|-
 +
| [[File:SinScalar_18_FunWith_Nodes_Step03.jpg|none|800px|Node Network view Step 03 - rows.]]
 +
|}
 +
 
 +
{|
 +
|-
 +
| [[File:SinScalar_19_FunWith_Rows_Step03.jpg|none|400px|Render Step 03 - rows.  Scalar value set to 0.8.]] || [[File:SinScalar_20_FunWith_Rows_Step03.jpg|none|400px|Render Step 03 - rows.  Scalar value set to 0.2.]]
 +
|}
 +
 
 +
 +
The parallel rows can be broken up by multiplying them with other function nodes, like Perlin noise and Voronoi noise.
 +
 +
* Add a “'''Multiply scalar'''” node, a “'''Voronoi 3D diff scalar'''” node, another “'''Get position in texture'''” node, and a “'''Constant scalar'''” node to the project, and connect them as indicated in the image below.
 +
{|
 +
|-
 +
| [[File:SinScalar_21_FunWith_Nodes_Step04.jpg|none|800px|Node Network view step 04 - rows.]]
 +
|-
 +
| [[File:SinScalar_22_FunWith_Rows_Step04.jpg|none|800px|Render Step 04 - rows. ]]
 +
|}
 +
 +
 +
Finally, the broken up parallel rows can be warped, just as we did with the concentric rings.
 +
 +
* Add a “'''Fractal warp shader'''” node to the project and connect it as indicated in the image below.
 +
{|
 +
|-
 +
|[[File:SinScalar_23_FunWith_Rows_Step05.jpg|none|800px|Node Network view of Step 05 - rows.]]
 +
|-
 +
| [[File:SinScalar_24_FunWith_Rows_Step05.jpg|none|800px|Render Step 05 - rows.]]
 +
|}
 +
 
 +
 
 +
 
 +
<br /n>
  
 
[[Category:Trig]]
 
[[Category:Trig]]

Latest revision as of 03:17, 12 April 2022

Sin Scalar



Overview[edit]

These nodes output the cosine, sine or tangent of the Input scalar. If you are using these functions for trigonomic calculations, rather than just for creating a wave shape or similar, you need to be aware that they expect Input values in radians rather than degrees. You can use the Degrees to radians scalar node for the conversion.

These nodes have 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 Sin Scalar nodes in a project.
  • Enable: When checked, the node is active, and when unchecked the node is ignored.


Fun with Sin Scalar[edit]

One way in which to use the Sin scalar function node is to create repeating lines or concentric circles. Masks can be applied to break up the repetition, and the results can be warped into non-linear or non-concentric patterns.


The following examples illustrate the Sin scalar function displacing a surface.


We’ll begin by adding a Displacement shader and a Sin scalar node to the project. The Sin scalar node needs data to work with, so we’ll add a Get Position in texture node so it can use the texture coordinates of the planet.

  • Starting with the default project, left-click in the Node Network pane and drag a selection box around the “Simple shape shader”, “Fractal terrain”, and “Fractal warp shader” nodes, then press the “delete” key on your keyboard to delete them.
  • Press the tab key or “N” key to open the Quick Node Palette window.
  • Start typing the words “Displacement shader” and the closest match in the Node list will be highlighted.
  • With “Displacement shader” highlighted, press the enter key to add it to the project.
  • Drag a connection line from the “Output” of the Displacement shader node to the ”Main input” of the Compute Terrain node.
  • Add a “Sin scalar” node and a “Get position in texture” node to the project in the same manner.
  • Drag a connection line from the “Output” of the Get position in texture node to the ”Main input” of the Sin scalar node.
  • Drag a connection line from the “Output” of the Sin scalar node to the ”Function” input of the Displacement shader.


Node Network view step 01.
Render step 01.


In the images above, you can see that already the Sin scalar node has created concentric rings about the origin of the project. You can increase or decrease the number of rings by multiplying the output from the Get position in texture node. Larger values increase the number of rings, while smaller values decrease them.

  • Add a “Multiply scalar” node and a “Constant scalar” node to the project.
  • Drag a connection line from the “Output” of the Get position in texture node to the “Main input” of the Multiply scalar node.
  • Drag a connection line from the “Output” of the Multiply scalar node to the “Main input” of the Sin scalar node.
  • Drag a connection line from the “Output" of the Constant scalar node to the “Input 2” of the Multiply scalar node.
  • Double-click on the Constant shader node to open its dialog window.
  • Set “Scalar” to “2”, to increase the number of rings, or “0.5” to decrease them.
Node Network view Step 02.
Render Step 02.  Scalar value set to 2.0.
Render Step 02.  Scalar value set to 0.5.


You can also change the profile or curvature of the rings using functions like Bias scalar or Gain scalar. These can be used to accentuate the high or low areas of the rings, and when used on terrain features such as a mountain, they can accentuate the rim of a mountain top or its foothills.

  • Add a “Bias scalar” node and another “Constant scalar” node to the project.
  • Drag a connection line from the “Output” of the Sin scalar node to the “Main input” of the Bias scalar node.
  • Drag a connection line from the “Output” of the Bias scalar node to the “Function” input of the Displacement shader.
  • Drag a connection line from the “Output” of the second Constant scalar node to the “Bias” input of the Bias scalar node.
  • Double-click on the second Constant scalar node to open its dialog window.
  • Set the “Scalar” value to “0.2”. Try other values to see how the curvature of the rings change. Recommended values are 0.2 to 0.8.
Node Network view Step 03.
Render Step 02.  Scalar value set to 0.8.
Render Step 02.  Scalar value set to 0.2.


You can break up the concentric ring pattern by multiplying them by other function nodes such as Perlin and Voronoi noise patterns. These noise patterns require texture coordinate data which can be supplied by the Get position in texture node already in the project, and they have additional inputs for scale and seed value.

  • Add another “Multiply scalar” node to the project.
  • Drag a connection line from the “Output” of the Bias scalar node to the “Main input” of the Multiply scalar node.
  • Drag a connection line from the “Output” of the Multiply scalar node to the “Function” input of the Displacement shader.
  • Add a “Voronoi 3D diff scalar” node to the project.
  • Drag a connection line from the “Output” of the Voronoi 3D diff scalar node to the “Input 2” of the second Multiply scalar node.
  • Either drag a connection line from the “Output” of the existing Get position in texture node to the “Main input” of the Voronoi 3D diff scalar node, or add another Get position in texture node to the project and connect its output to the Main input of the Voronoi 3D diff scalar node.
  • Add another “Constant scalar” node to the project. This will control the size of the Voronoi noise pattern.
  • Drag a connection line from the “Output” of the Constant scalar node to the “Scale” input of the Voronoi 3D diff scalar node.
  • Double-click on the Constant scalar node to open its dialog window.
  • Set “Scalar” to “2”, or any other value you desire for the size of the noise pattern.
  • If you like, you can add another Constant scalar node to the project to control the Seed value of the noise pattern. By changing the value assigned to the Seed parameter you change the noise pattern.
Node Network view Step 04.
Render Step 04.


By warping the rings you can distort the concentric ring pattern and create interesting, organic, and more natural looking forms.

  • Add a “Fractal warp shader” to the project.
  • Drag a connection line from the “Output” of the Fractal warp shader to the “Function” input of the Displacement shader.
  • Drag a connection line from the “Output” of the Multiply scalar node to the “Main input” of the Fractal warp shader.
  • Double-click on the Fractal warp shader node to open its dialog window.
  • Experiment with the Fractal warp shader parameters and see how they warp the concentric circles into new shapes.
Node Network view Step 06.
Render Step 05.


We can follow a similar procedure for creating parallel rows. Instead of directly connecting the Get position in texture node to the Sin scalar node we can insert a node to isolate one of the axis.

  • Start with a new project, deleting the same three nodes in the Terrain group we did in the first step above.
  • Add a “Displacement shader" node, “Get position in texturenode, a “Sin scalarnode, and a “X to scalar” node to the project and connect them together as indicated in the image below.
Node Network view Step 01 - rows.
Render Step 01 - rows.


Just like with the example using concentric rings, we can control the number of rows by multiplying the texture coordinate data before it gets to the Sin scalar node.

  • Add a “Multiply scalar” node and a “Constant scalar” node to the project.
  • Drag a connection line from the “Output” of the X to scalar node to the “Main input” of the Multiply scalar node.
  • Drag a connection line from the “Output” of the Multiply scalar node to the “Main input” of the Sin scalar node.
  • Drag a connection line from the “Output” of the Constant scalar node to the “Input 2” of the Multiply scalar node.
  • Double-click on the Constant shader node to open its dialog window.
  • Set “Scalar” to “2”, to increase the number of rings, or “0.5” to decrease them.
Node Network view Step 02 - rows.
Render Step 02 - rows.  Scalar value set to 2.0.
Render Step 02 - rows.  Scalar value set to 0.5.


The profile or curvature of the rows can be manipulated in precisely the same way as with the concentric rings.

  • Add a “Bias scalar” node and another “Constant scalar” node to the project, and connect them as indicated in the image below.
Node Network view Step 03 - rows.
Render Step 03 - rows.  Scalar value set to 0.8.
Render Step 03 - rows.  Scalar value set to 0.2.


The parallel rows can be broken up by multiplying them with other function nodes, like Perlin noise and Voronoi noise.

  • Add a “Multiply scalarnode, a “Voronoi 3D diff scalarnode, another “Get position in texturenode, and a “Constant scalar” node to the project, and connect them as indicated in the image below.
Node Network view step 04 - rows.
Render Step 04 - rows.


Finally, the broken up parallel rows can be warped, just as we did with the concentric rings.

  • Add a “Fractal warp shader” node to the project and connect it as indicated in the image below.
Node Network view of Step 05 - rows.
Render Step 05 - rows.



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

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.

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.