Fake Stones Shader

From Terragen Documentation from Planetside Software
Jump to: navigation, search
Fake Stone Shader


Overview[edit]

The Fake Stones shader creates a surface displacement that resembles individual stones or rocks. The effect is similar to a rock "population", except that as a surface shader it has global coverage unless restricted. You can control scale and density, shape, and colour. The Fake Stones Shader uses an internal Voronoi-based displacement function to create the rock shapes.

Settings:

    • Enable: When checked, the node is active. When unchecked, the node is ignored.
    • Seed: This setting controls the pattern used by the node to generate the placement of the fake stones. Changing the value allows you to easily create variations of the stones based on the node’s other settings.
    • Surface shader: The shader or function nodes assigned to this setting can change the surface colour and textures of the fake stones. When not empty, this setting overrides the Colour tab settings.
      Nothing assigned to Surface shader.
      Shader and function nodes assigned to Surface shader.
    • Mask by shader: When checked, the fake stones are restricted to the area defined by the shader or function nodes assigned to this setting.
      Mask by shader disabled.
      Simple shape shader assigned to Mask by shader.
    • Fit mask to this: When unchecked, the size of the shader or function nodes assigned as the mask determines the area to which the fake stones are applied.
    • Invert mask: When checked, the inverse of the shader or function nodes assigned as the mask is used as the mask.
      Invert mask checked.
    • Mask as stone density:
      Mask stone density unchecked.
      Mask stone density checked.
      Mask stone density unchecked.
      Mask stone density checked.

Scale / Density Tab[edit]

Fake Stones Scale / Density Tab


    • Stone scale: This setting scales the internal displacement function, effectively changing the size of the fake stones. Smaller values yield smaller stones but more of them in a given area.
      Stone scale = 0.1
      Stone scale = 0.5
      Stone scale = 1.0
    • Stone density: This setting controls how closely packed together the fake stones are. Smaller values result in more space between stones.
      Stone density = 0.1
      Stone density = 0.5
      Stone density = 1.0
    • Vary Density: When checked, this setting masks the Stone density setting introducing areas free of stones. Enabled by default and set to a value of 1, larger values will create bigger areas free of stones. Values above 10 have little to no effect, at which point the “Density variation scale” value can be increased to create larger stone free areas.
      Vary density disabled.
      Vary density = 1
      Vary density = 10
    • Density Seed: This setting allows you to change the starting point of the internal pattern used for the variation masking. Visually, a different area of the pattern is seen without having to change the other settings.
      Density seed = 101
      Density seed = 11286
      Density seed = 10196
    • Density variation scale: This setting determines the scale of the internal pattern used for the variation masking. Larger values create larger spaces between groups of stones.
      Density variation scale = 20
      Density variation scale = 50
      Density variation scale = 100


Shape Tab[edit]

Fake Stones Shape Tab


    • Stone tallness: This setting determines the height of the fake stones.
      Stone tallness = 0.1
      Stone tallness = 0.5
      Stone tallness = 1
    • Pancake effect: This setting squashes and expands the fake stone, trying to preserve its volume..
      Pancake effect = 0
      Pancake effect = 1
      Pancake effect = 2
    • Only displace upwards: When checked, the fake stones will displace vertically and not in the direction of the surface normal. It is important to have a compute normal or compute terrain node upstream of the Fake stone node in order for the displacement direction to work as expected.
      Only displace upwards unchecked (default).
      Only displace upwards checked.


Colour Tab[edit]

Fake Stones Colour Tab


    • Apply colour: When checked, the values defined for the “Diffuse colour” and “Colour variation” settings are used.
    • Diffuse colour: This setting can be used to apply a colour value to the fake stones.
      Diffuse colour = 130,70,100 sRGB
      Diffuse colour = 126,101,226 sRGB
    • Colour variation: When checked, each colour colour component (RGB) of the “Diffuse colour” is varied by value defined by the “Variation in…” settings below. A value of 0 means that the colour competent is not varied.
      Colour variation unchecked
      Colour variation: Red = 0.5, Green = 0.5, Blue = 0.5
      Colour variation: Red = 1.0, Green = 0, Blue = 0
      Colour variation: Red = 0, Green = 1, Blue =1
    • Variation in red: Defines the minimum or maximum variation allowed for the red component. A value of 0 means no variation will take place in the red channel.
    • Variation in green: Defines the minimum or maximum variation allowed for the green component. A value of 0 means no variation will take place in the green channel.
    • Variation in blue: Defines the minimum or maximum variation allowed for the blue component. A value of 0 means no variation will take place in the blue channel.


Functions[edit]

Fake Stones Functions Tab


    • Scale function: This setting allows you to assign a shader or function nodes in order to modify the scale of the individual fake stones. The function works as a multiplier to the Stone scale setting under the Scale / Density tab. Constant values work best, for example a Constant Scalar node with a Scalar value of 0.5, will make the fake stones half as large. If the assigned shader or function nodes utilize 3D space, such as the Power fractal shader, the scaling results are unpredictable and exaggerated the farther away from the origin you go.
      Nothing assigned to the Scale function.
      An Image shader assigned to the Scale function.
      A Power fractal shader assigned to the Scale function.


      In the example image below, the Stone scale value is set to 1, and a Constant scalar node is assigned to the Scale function input. The lower the Scalar value the smaller the fake stones.

      Scalar values from 0.1 - 5.0.  Smaller values result in smaller fake stones.


      In the example image below, a Voronoi 3D cell scaler node defines the initial grey areas, and a Colour adjust node raises or lowers the Black and White points. Note the hard transition from one grey value to another. While this sudden change in colour value might cause a rock to be cut off, it is usually preferable to soft transitions between the grey values, as illustrated in the following example. Dark values reduce the scale of the fake stones.

      Each patch of grey value multiplies the Stone scale value, resulting in patches of different sized fake stones.


      In the example image below, a Voronoi 3D diff scalar node defines the initial grey areas, and a Colour adjust node raises or lowers the Black and White points. Notice the soft, graduated transitions that define each cell. These non-constant values displace the texture space in unpredictable ways, and become exaggerated the farther away from the origin you go.

      This example illustrates how non-constant values displace the texture space, resulting in unpredictable stone scale and shapes.


      Click here to download the Terragen project file for the images above.


    • Tallness function: This setting allows you to assign a shader or function nodes in order to modify the tallness of the individual fake stones.
      Nothing assigned to the Tallness function.
      An Image shader assigned to the Tallness function.
      A Power fractal shader assigned to the Tallness function.



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.

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 scalar is a single number. 1, 200.45, -45, -0.2 are all examples of scalar values.