Difference between revisions of "Simple Shape Shader"

From Terragen Documentation from Planetside Software
Jump to: navigation, search
(Simple Shape Shader)
m (Added image example for SSS applied as colour with edge units set to percentage. Also, fixed typo.)
 
(13 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:IMPORT]]
+
[[File:SimpleShapeShader_00_MainAndColourTab.png|none|470px|Simple Shape Shader]]
='''Simple Shape Shader'''=
+
<br />
 +
== Overview ==
 +
The Simple shape shader node creates simple shapes that can generate colour and displacement with a variety of effects applied to the edge of the shape.  It is only applied in a straight-up-and-down Planar Y projection.
  
[[Image:drex_module_168_image_0.png|485pxpx|Simple Shape Shader]]
+
'''Node Type:''' Shader
 +
<br />
  
'''Node Description and Purpose'''<br />
+
'''Settings:'''
The Simple shape shader is a node which makes it easy to create simple shapes such as circles/ellipses, squares/rectangles, triangles and regular polygons like pentagons and octagons. It can generate both colour and displacement. It can also apply different effects to the edges of the shape.
+
<ul>
 +
<li> '''Show b-box in preview: ''' If this is checked the bounding box of the shape will be displayed in 3D Preview.</li>
 +
<li> '''Draw shape edges in preview: '''If this is checked an orange dotted outline of the shape will be displayed in the 3D Preview. </li>
 +
[[File:SimpleShapeShader_01_BBoxDrawShape.Png|none|400px|Bounding box and shape edges in 3D preview.]]
 +
<li> '''Type of shape: ''' This popup has 3 options to let you choose the type of shape generated by the shader. To create a triangle use a polygon with 3 sides.</li>
 +
[[File:SimpleShapeShader_02_TypeOfShape.Png|none|257px|Types of simple shapes.]]
 +
<li>'''Position:''' This sets the position of the centre of the shape.</li>
 +
<li>'''Size:''' You can use this to set the width and height of the shape. Note, an ellipse is a circle where the height is a different size to the width.</li>
 +
<li>'''Rotation:''' This param sets the rotation of the shape around its centre. You can only rotate the array around the Y (upright) axis.</li>
 +
<li>'''Polygon sides:''' This setting lets you control the number of sides when '''Type of shape''' is set to "Polygon".</li>
 +
</ul>
 +
<br />
 +
== Colour Tab ==
 +
[[File:SimpleShapeShader_10_ColourTab.png|none|470px|Colour tab.]]
 +
'''Settings: '''
 +
<ul>
 +
<li>'''Apply colour:''' If this is checked the shader will generate colour information.</li>
 +
<li>'''Apply main colour: '''This sets the colour for the shape.</li>
 +
<li>'''Apply edge colour: ''' The shader can apply a separate colour to the edge of the shape. To show the edge colour the '''Edge profile''' popup needs to be set to something other than "None" and the '''Edge width''' needs to be more than “0”.</li>
 +
<li>'''Edge profile: '''This popup has 5 options which control the edge profile or blending which is applied to the edge of the shape. </li>
 +
{|
 +
|-
 +
| [[File:SimpleShapeShader_03_ColourTab_EdgeProfile.Png|none|222px|Edge profile options.]] || [[File:Simple_shape_shader_edge_profiles.png|border|Profiles the shader can apply to edges of shapes.]]
 +
|}
  
Currently the Simple shape shader is only applied in a straight-up-and-down Plan Y projection.
+
<ul>
 +
<li>'''None: '''No edge profile is used.</li>
 +
<li>'''Smooth Step: '''Creates a smooth transition along the length of the edge and the interior of the shape, to the extent defined by the '''Edge width''' param. </li> 
 +
<li>'''Bevel: '''Creates a straight line or linear ramp along the length of the edge and the interior of the shape, to the extent defined by the '''Edge width''' param. </li> 
 +
<li>'''Radius: '''Makes a quarter circle shape along the length of the edge and the interior of the shape, to the extent defined by the '''Edge width''' param. </li> 
 +
<li>'''Stroke: '''Creates a solid stroke or border around the inside of the shape to the extent defined by the '''Edge width''' param. The stroke can only be used in colour mode. </li>
 +
</ul>
 +
{|
 +
|-
 +
| [[File:SimpleShapeShader_05_ColourTab_ApplyColour_EdgesOff.gif|400px|Simple shape shader applied as colour without edges.]] || [[File:SimpleShapeShader_06_ColourTab_ApplyColour_EdgesOn_1000ms.gif|400px|Simple shape shader applied as colour with edges]] || [[File:SimpleShapeShader_07_ColourTab_ApplyColour_EdgesOn_CloseUp_1000ms.gif|400px|Close up of edge details.]]
 +
|}
 +
<li>'''Edge width: '''This param lets you set the width of the edge area of the shape in '''Edge units'''. To show the edge colour the '''Edge profile''' popup needs to set to something other than "None".</li>
 +
<li>'''Edge units: '''This popup has two options.</li>
 +
[[File:SimpleShapeShader_04_ColourTab_EdgeUnits.Png|none|213px|Edge units options.]]
 +
<ul>
 +
<li>'''Metres:  '''Choosing this option sets the '''Edge width''' value to meters.</li>
 +
<li>'''Percentage: '''Choosing this option uses the '''Edge width''' value as a percentage of the maximum area allowed for an edge, which is half of the area defined by the '''Size''' param.  For example, if the '''Size''' width and height values are 100 meters and the '''Edge width''' value is 10, then the edge would be 5 meters or 10 percent of 50 meters.</li>
 +
</ul>
 +
[[File:SimpleShapeShader_17_ColourTab_EdgeUnitsPercentage.gif|none|800px|Simple shape shader applied as colour with Edge units set to percentage.]]
 +
<li>'''Position key: '''This popup has two options.</li>
 +
[[File:SimpleShapeShader_08_ColourTab_PositionKey.png|none|291px|Position key options.]]
 +
<ul>
 +
<li>'''Final Position: '''This param setting depends on its usage, as displacement  or non-displacement (colour).  For displacement the '''Final position''' means the most recently known displacement of the surface relative to this nodes location in the node network pipeline.  It only knows upstream shaders from its location.  When used for non-displacement (colour) purposes, it knows the upstream and downstream shaders.  This is because displacement is calculated before non-displacement.</li>
 +
<li>'''Position in Terrain / Texture:  '''Uses the texture coordinates which were generated for the surface. On terrains these coordinates are initially set to the position on the flat planet from which the terrain is displaced, but may be updated by “Compute Terrain” or “Tex Coords From XYZ” nodes to provide fully 3D texture coordinates.  Texture coordinates can also be modified by downstream transform shaders and warp shaders, whereas '''Final position''' is not affected by these.</li>
 +
</ul>
 +
</ul>
 +
<br />
 +
== Displacement Tab ==
 +
[[File:SimpleShapeShader_09_DisplacementTab.png|none|470px|Displacement tab.]]
  
<u>Edge profiles</u><br />
 
These are the different profiles the shader can apply to the edges of shapes:
 
[[File:Simple_shape_shader_edge_profiles.png]]
 
Smooth step creates a smooth transition between the edge and the interior of the shape. Bevel creates a straight line and Radius makes a quarter circle shape. Stroke is not shown here. It creates a solid stroke or border around the inside of the shape. Stroke can only be used in colour mode.
 
<br /><br />
 
'''Node Type:''' Shader
 
<br /><br />
 
 
'''Settings:'''
 
'''Settings:'''
* '''Type of shape''': This setting lets you choose the type of shape generated by the shader. You can choose from "Square/Rectangle", "Circle/Ellipse" or "Polygon". To create a triangle use a polygon with 3 sides.
+
<ul>
* '''Position:''' This sets the position of the centre of the shape.
+
<li>'''Apply Displacement: '''If this is checked the shader will generate displacement information.</li>
* '''Size:''' You can use this to set the width and height of the shape. N.B. an ellipse is a circle where the height is a different size to the width.
+
<li>'''Displace relative to surface:  '''This is how displacement was always applied in TG2. The shader looks at the position of the surface underneath and then applies displacement to that, which means if the surface is lumpy that lumpiness flows through into the shape created by the shader. In this case the shader was making a pyramid and the pyramid shape has been distorted by the underlying terrain. It also integrates smoothly with the terrain around the edges. </li>
* '''Rotation:''' This param sets the rotation of the shape around its centre. You can only rotate the array around the Y (upright) axis.
+
[[File:Sss_surface_relative_displacement.jpg|none|480px|Displacement relative to surface.]]
* '''Polygon sides:''' This setting lets you control the number of sides when '''Type of shape''' is set to "Polygon".
+
<li>'''Displace relative to shader position: '''Ignores the underlying surface and always displaces from the shader position. Currently this means that displacement is applied relative to the Y coordinate of the shader position. As you can see from the image below this means that the displaced shape is generated exactly by the shader and not distorted. In this case the shader Y position is 10. You can see there is a "wall" around the bottom of the shape. This accounts for the difference between the edge of the shader (at 10m) and the underlying terrain, which is lower than along 10m along the two edges we can see.</li>
 +
[[File:Sss_shader_relative_displacement.jpg|none|480px|Displacement relative to shader position.]]
 +
<li>'''Displacement direction: '''This popup has 5 options.</li>
 +
[[File:SimpleShapeShader_11_DisplacementTab_DisplacementDirection.png|none|441px|Displacement direction options.]]
 +
<ul>
 +
<li>'''Along Vertical: '''Displacement will happen along the original normals of the underlying object (i.e. the planet or a model) prior to any displacement having been applied.</li>
 +
<li>'''Along Normal: '''Displacement will happen along the current surface normal.</li>
 +
<li>'''Vertical only (requires computed normal):  '''Displacement only happens along the normal of the underlying object (i.e. the planet or a model). The displacement is scaled by the difference between the object normal and the surface normal. Displacement is reduced as the angle between the normals approaches 90°.</li>
 +
<li>'''Lateral only (requires computed normal): '''Displacement only occurs in the lateral plane, or in other words perpendicular to the normal of the underlying object.</li>
 +
<li>'''Lateral normalized (requires computed normal): '''This is the same as Lateral only but the normal is normalised, that is, scaled so it has a length of 1.</li>
 +
</ul>
 +
{|
 +
|-
 +
| [[File:SimpleShapeShader_13_DisplacementTab_DirectionOptions.gif|400px|Simple shape shader as displacement. Direction options.]] || [[File:SimpleShapeShader_14_DisplacementTab_DirectionOptionsCloseUp.gif|400px|Simple shape shader as displcement. Direction options close up.]]
 +
|}
 +
<li>'''Displacement amplitude: '''The amount of displacement in metres.</li>
 +
<li>'''Displacement offset: The starting offset of the displacement in metres.</li>
 +
<li>'''Edge profile: '''This popup has 4 options to control the shape of the profile applied along the edge of the displacement.  Note, that the “Stroke” edge profile is not available for displacement.</li>
 +
{|
 +
|-
 +
| [[File:SimpleShapeShader_12_DisplacementTab_EdgeProfile.png|none|226px|Edge profile options.]] || [[File:Simple_shape_shader_edge_profiles.png|border|Profiles the shader can apply to edges of shapes.]]
 +
|}
 +
<ul>
 +
<li>'''None: '''No edge profile is used.</li>
 +
<li>'''Smooth Step: '''Creates a smooth transition along the length of the edge and the interior of the shape, to the extent defined by the Edge width param.</li> 
 +
<li>'''Bevel: '''Creates a straight line or linear ramp along the length of the edge and the interior of the shape, to the extent defined by the Edge width param.</li> 
 +
<li>'''Radius: '''Makes a quarter circle shape along the length of the edge and the interior of the shape, to the extent defined by the Edge width param.</li> 
 +
</ul>
 +
[[file:SimpleShapeShader_15_DisplacementTab_EdgeProfiles.gif|none|400|Simple shape shader as displacement. Edge options.]]
 +
<li>'''Edge width: '''This param lets you set the width of the edge area of the shape in '''Edge units'''. To show the displaced edge profile, the '''Edge profile''' popup needs to be set to something other than "None".</li>
 +
<li>'''Edge units: '''This popup has two options.</li>
 +
[[File:SimpleShapeShader_04_ColourTab_EdgeUnits.Png|none|213px|Edge units options.]]
 +
<ul>
 +
<li>'''Metres:  '''Choosing this option uses the '''Edge width''' value as meters.</li>
 +
<li>'''Percentage: '''Choosing this option uses the '''Edge width''' value as a percentage of the maximum area allowed for an edge, which is half of the area defined by the '''Size''' param.  For example, if the '''Size''' width and height values are 100 meters and the Edge width value is 10, then the edge would be 5 meters or 10 percent of 50 meters.</li>
 +
</ul>
 +
[[File:SimpleShapeShader_DisplacementTab_16_MeasureEdgeWidthUnits.png|none|800px|Measuring Edge width with ruler.]]
 +
<li>'''Position key: '''This popup has two options.</li>
 +
[[File:SimpleShapeShader_08_ColourTab_PositionKey.png|none|291px|Position key options.]]
 +
<ul>
 +
<li>'''Final Position: '''This param setting depends on its usage, as displacement  or non-displacement (colour).  For displacement the '''Final position''' means the most recently known displacement of the surface relative to this nodes location in the node network pipeline.  It only knows upstream shaders from its location. When used for non-displacement (colour) purposes, it knows the upstream and downstream shaders. This is because displacement is calculated before non-displacement.</li>
 +
<li>'''Position in Terrain / Texture: '''Uses the texture coordinates which were generated for the surface. On terrains these coordinates are initially set to the position on the flat planet from which the terrain is displaced, but may be updated by “Compute Terrain” or “Tex Coords From XYZ” nodes to provide fully 3D texture coordinates.  Texture coordinates can also be modified by downstream transform shaders and warp shaders, whereas '''Final position''' is not affected by these.</li>
 +
</ul>
 +
</ul>
 +
<br />
 +
== Examples ==
 +
 
 +
These are project files showing some different ways of using the Simple shape shader. The projects are explained in greater detail in the Comments section of the project settings. To view this click the Project Settings button in the bottom left of the main window. You might need to right click and choose "Save as" (Windows) or option-click (Mac) on the project file links to download them directly and prevent them opening in your browser.
 +
 
 +
<ul>
 +
<li>'''Population density: '''This project shows how to use a Simple shape shader to control the density of a population. This example combines two Simple shape shaders using a [[Merge_Shader|Merge shader]] to make a more complex shape.</li>
  
<u>Colour tab</u>
+
[[Media:simple_shape_shader_population_density.tgd]]
* '''Apply colour:''' If this is checked the shader will generate colour information.
+
[[image:simple_shape_shader_population_density.jpg|none|320px|thumb]]
* '''Colour:''' This sets the colour for the shape.
 
* '''Edge colour:''' The shader can apply a separate colour to the edge of the shape. To show the edge colour the '''Colour edge profile''' popup needs to set to something other than "None" and the '''Colour edge width''' needs to be more than 0.
 
* '''Colour edge profile:''' This controls the edge profile or blending which is applied to the edge of the shape. See above for examples of the different edge profiles.
 
* '''Colour edge width:''' This param lets you set the width of the edge area of the shape. To show the edge colour the '''Colour edge profile''' popup needs to set to something other than "None".
 
* '''Position key:'''
 
  
<br />
+
<li>'''Displacement: '''This project is an example of using the Simple shape shader to create displacement on the terrain.</li>
 +
 
 +
[[Media:simple_shape_shader_displacement.tgd]]
 +
[[image:simple_shape_shader_displacement.jpg|none|320px|thumb]]
 +
 
 +
<li> '''Surface layer blending: '''This project shows how to use a Simple shape shader to control the blending of a surface layer.</li>
  
==Additional tabs for Simple Shape Shader==
+
[[Media:simple_shape_shader_layer_blending.tgd]]
 +
[[image:simple_shape_shader_layer_blending.jpg|none|320px|thumb]]
 +
</ul>
  
* [[Simple Shape Shader - Displacement Tab]]
 
__NOTOC__
 
 
<!-- imported from file: module_168.html-->
 
<!-- imported from file: module_168.html-->
 +
 +
[[Category:Colour Shader]]
 +
[[Category:Displacement Shader]]

Latest revision as of 17:17, 21 August 2020

Simple Shape Shader


Overview[edit]

The Simple shape shader node creates simple shapes that can generate colour and displacement with a variety of effects applied to the edge of the shape. It is only applied in a straight-up-and-down Planar Y projection.

Node Type: Shader

Settings:

  • Show b-box in preview: If this is checked the bounding box of the shape will be displayed in 3D Preview.
  • Draw shape edges in preview: If this is checked an orange dotted outline of the shape will be displayed in the 3D Preview.
  • Bounding box and shape edges in 3D preview.
  • Type of shape: This popup has 3 options to let you choose the type of shape generated by the shader. To create a triangle use a polygon with 3 sides.
  • Types of simple shapes.
  • Position: This sets the position of the centre of the shape.
  • Size: You can use this to set the width and height of the shape. Note, an ellipse is a circle where the height is a different size to the width.
  • Rotation: This param sets the rotation of the shape around its centre. You can only rotate the array around the Y (upright) axis.
  • Polygon sides: This setting lets you control the number of sides when Type of shape is set to "Polygon".


Colour Tab[edit]

Colour tab.

Settings:

  • Apply colour: If this is checked the shader will generate colour information.
  • Apply main colour: This sets the colour for the shape.
  • Apply edge colour: The shader can apply a separate colour to the edge of the shape. To show the edge colour the Edge profile popup needs to be set to something other than "None" and the Edge width needs to be more than “0”.
  • Edge profile: This popup has 5 options which control the edge profile or blending which is applied to the edge of the shape.
  • Edge profile options.
    Profiles the shader can apply to edges of shapes.
    • None: No edge profile is used.
    • Smooth Step: Creates a smooth transition along the length of the edge and the interior of the shape, to the extent defined by the Edge width param.
    • Bevel: Creates a straight line or linear ramp along the length of the edge and the interior of the shape, to the extent defined by the Edge width param.
    • Radius: Makes a quarter circle shape along the length of the edge and the interior of the shape, to the extent defined by the Edge width param.
    • Stroke: Creates a solid stroke or border around the inside of the shape to the extent defined by the Edge width param. The stroke can only be used in colour mode.
    Simple shape shader applied as colour without edges. Simple shape shader applied as colour with edges Close up of edge details.
  • Edge width: This param lets you set the width of the edge area of the shape in Edge units. To show the edge colour the Edge profile popup needs to set to something other than "None".
  • Edge units: This popup has two options.
  • Edge units options.
    • Metres: Choosing this option sets the Edge width value to meters.
    • Percentage: Choosing this option uses the Edge width value as a percentage of the maximum area allowed for an edge, which is half of the area defined by the Size param. For example, if the Size width and height values are 100 meters and the Edge width value is 10, then the edge would be 5 meters or 10 percent of 50 meters.
    Simple shape shader applied as colour with Edge units set to percentage.
  • Position key: This popup has two options.
  • Position key options.
    • Final Position: This param setting depends on its usage, as displacement or non-displacement (colour). For displacement the Final position means the most recently known displacement of the surface relative to this nodes location in the node network pipeline. It only knows upstream shaders from its location. When used for non-displacement (colour) purposes, it knows the upstream and downstream shaders. This is because displacement is calculated before non-displacement.
    • Position in Terrain / Texture: Uses the texture coordinates which were generated for the surface. On terrains these coordinates are initially set to the position on the flat planet from which the terrain is displaced, but may be updated by “Compute Terrain” or “Tex Coords From XYZ” nodes to provide fully 3D texture coordinates. Texture coordinates can also be modified by downstream transform shaders and warp shaders, whereas Final position is not affected by these.


Displacement Tab[edit]

Displacement tab.

Settings:

  • Apply Displacement: If this is checked the shader will generate displacement information.
  • Displace relative to surface: This is how displacement was always applied in TG2. The shader looks at the position of the surface underneath and then applies displacement to that, which means if the surface is lumpy that lumpiness flows through into the shape created by the shader. In this case the shader was making a pyramid and the pyramid shape has been distorted by the underlying terrain. It also integrates smoothly with the terrain around the edges.
  • Displacement relative to surface.
  • Displace relative to shader position: Ignores the underlying surface and always displaces from the shader position. Currently this means that displacement is applied relative to the Y coordinate of the shader position. As you can see from the image below this means that the displaced shape is generated exactly by the shader and not distorted. In this case the shader Y position is 10. You can see there is a "wall" around the bottom of the shape. This accounts for the difference between the edge of the shader (at 10m) and the underlying terrain, which is lower than along 10m along the two edges we can see.
  • Displacement relative to shader position.
  • Displacement direction: This popup has 5 options.
  • Displacement direction options.
    • Along Vertical: Displacement will happen along the original normals of the underlying object (i.e. the planet or a model) prior to any displacement having been applied.
    • Along Normal: Displacement will happen along the current surface normal.
    • Vertical only (requires computed normal): Displacement only happens along the normal of the underlying object (i.e. the planet or a model). The displacement is scaled by the difference between the object normal and the surface normal. Displacement is reduced as the angle between the normals approaches 90°.
    • Lateral only (requires computed normal): Displacement only occurs in the lateral plane, or in other words perpendicular to the normal of the underlying object.
    • Lateral normalized (requires computed normal): This is the same as Lateral only but the normal is normalised, that is, scaled so it has a length of 1.
    Simple shape shader as displacement. Direction options. Simple shape shader as displcement. Direction options close up.
  • Displacement amplitude: The amount of displacement in metres.
  • Displacement offset: The starting offset of the displacement in metres.
  • Edge profile: This popup has 4 options to control the shape of the profile applied along the edge of the displacement. Note, that the “Stroke” edge profile is not available for displacement.
  • Edge profile options.
    Profiles the shader can apply to edges of shapes.
    • None: No edge profile is used.
    • Smooth Step: Creates a smooth transition along the length of the edge and the interior of the shape, to the extent defined by the Edge width param.
    • Bevel: Creates a straight line or linear ramp along the length of the edge and the interior of the shape, to the extent defined by the Edge width param.
    • Radius: Makes a quarter circle shape along the length of the edge and the interior of the shape, to the extent defined by the Edge width param.
    Simple shape shader as displacement. Edge options.
  • Edge width: This param lets you set the width of the edge area of the shape in Edge units. To show the displaced edge profile, the Edge profile popup needs to be set to something other than "None".
  • Edge units: This popup has two options.
  • Edge units options.
    • Metres: Choosing this option uses the Edge width value as meters.
    • Percentage: Choosing this option uses the Edge width value as a percentage of the maximum area allowed for an edge, which is half of the area defined by the Size param. For example, if the Size width and height values are 100 meters and the Edge width value is 10, then the edge would be 5 meters or 10 percent of 50 meters.
    Measuring Edge width with ruler.
  • Position key: This popup has two options.
  • Position key options.
    • Final Position: This param setting depends on its usage, as displacement or non-displacement (colour). For displacement the Final position means the most recently known displacement of the surface relative to this nodes location in the node network pipeline. It only knows upstream shaders from its location. When used for non-displacement (colour) purposes, it knows the upstream and downstream shaders. This is because displacement is calculated before non-displacement.
    • Position in Terrain / Texture: Uses the texture coordinates which were generated for the surface. On terrains these coordinates are initially set to the position on the flat planet from which the terrain is displaced, but may be updated by “Compute Terrain” or “Tex Coords From XYZ” nodes to provide fully 3D texture coordinates. Texture coordinates can also be modified by downstream transform shaders and warp shaders, whereas Final position is not affected by these.


Examples[edit]

These are project files showing some different ways of using the Simple shape shader. The projects are explained in greater detail in the Comments section of the project settings. To view this click the Project Settings button in the bottom left of the main window. You might need to right click and choose "Save as" (Windows) or option-click (Mac) on the project file links to download them directly and prevent them opening in your browser.

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.

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.

The bounding box is a box which surrounds (or bounds) an object or shader. This box shows the maximum extents of the item inside it. Sometimes abbreviated as "b-box".