Image Map Shader

From Terragen Documentation from Planetside Software
Jump to: navigation, search
Image Map Shader


Overview[edit]

The Image Map Shader allows you to load an external image map file in one of many supported formats. You can find a complete list of the image formats supported here. You can control the way the texture is applied in the scene - the "projection" - the position, as well as whether to flip or repeat the loaded image, adjust the colour values, determine whether displacement is applied, and control other image-specific effects.


Settings

  • Name: This setting allows you to apply a descriptive name to the node, which can be helpful when using multiple Image map shader nodes in a project.
  • Enable: When checked, the node is active and the settings below will affect the surface. When unchecked, the node is ignored.
  • Image filename: This setting is where you specify the image file used by the shader. The button to the right opens a Choose File dialog window.
  • Border blending: This setting softens the edge of the shader allowing it to blend into underlying textures.
    Border blending examples


  • Mask by shader: When checked, the Image map shader is masked by the shader or function nodes assigned to this setting. Whiter parts of the masking shader show more of the image map. Shades of grey control the opacity of the image map.
  • Fit mask to this: When checked, the masking shader or function nodes are remapped to fit into the area of the image map shader. When unchecked, the masking shader determines the area to which the mask is applied.
  • Invert mask: When checked, the shader or function nodes assigned to the Mask by shader input are inverted. For example, light parts become dark and vice versa.
    Invert mask off and on


Projection, Location Tab[edit]

The Projection Tab

The settings on this tab allow you to project an image along various axis such as Terragen’s world space, an object’s internal UV mapping coordinates, or even from a camera’s point of view.


  • Projection type: This popup menu has six options allowing you to select the way in which the image is projected onto a surface.
    Projection types

    Planar Y (edges = XZ): The image is projected vertically through the scene along the Y axis.
    Side X (edges = YZ): The image is projected horizontally through the scene along the X axis.
    Side Z (edges = XY): The image is projected horizontally through the scene along the Z axis.
    Through camera: The image is projected from the camera assigned to the Projection camera setting. Selecting this option automatically enables the Position center setting, and changes the X and Y Size values to 1, and the Position coordinates to (0.5, 0.5, 0).
    Object UV (if available): The image is mapped to the object’s UV coordinates if they exist. Setting this option automatically enables the Position lower left setting, and changes the X and Y Size values to 1, and the Position coordinates to (0,0,0).
    Cylindrical: The image is projected cylindrically around the object or surface. Selecting this option automatically enables the Position center setting.
    Spherical: The image is projected spherically around the object or surface. Selecting this option automatically enables the Position center setting and changes the X and Y Size values to 1.

    Projection types


  • Position centre: When checked, the image is positioned relative to its centre in world space.
  • Position lower left: When checked, the image is positioned relative to its lower left corner in world space.
    Position at center and lower left


  • Position: This setting positions the image center or lower left corner, depending on which radio button has been selected, by the values entered into the XYZ input fields. The values are in metres.
    Position offset by 2,800 metres on the X axis and 600 metres on the Z axis.


  • Size: This parameter sets the size of the image in metres. By default the image is set to 1 metre by 1 metre and the image is stretched or shrunk to fit this size.
    Size can be used to increase or decrease the area that an image covers.


  • Image size (pixels): This shows the actual size in pixels of the image.: This is a read only setting which indicates the actual size of the image in pixels.


Flip Repeat Tab[edit]

The Flip, Repeat Tab

The settings on this tab allow you to flip or repeat the image on a surface. Enabling both the Repeat x and Repeat y checkboxes allows an image to tile across a surface.


  • Flip x: When checked, the image is flipped in the X direction, the left becomes the right.
  • Flip y: When checked, the image is flipped in the Y direction, the top becomes the bottom, or up becomes down.
    Image flipped along the X and Y directions.


  • Repeat x: When checked, the image repeats along the X axis.
  • Repeat y: When checked, the image repeats along the Y axis.
    Image repeated along the X and Y directions


Colour Tab[edit]

The Colour Tab

The settings on this tab control how the shader generates colour information from the image.


  • Apply colour: When checked, the shader will generate colour from the image assigned in the Image filename setting.
  • Smooth interpolation: When checked, colour values from the image are smoothly interpolated. When unchecked, no interpolation occurs and colour values are taken directly from the pixel at the point being shaded. This will give a blockier result than using smooth interpolation.
    Smooth interpolation off and on.


  • Unpremultiply: When checked, the shader will unpremultiply the image’s colour values with the image’s alpha values. If you see odd fringes along the edge of transparent parts of the image you can enable the checkbox to see if the fringing is reduced or eliminated.
    Unpremultiply off and on.


  • Convert to linear: When checked, it is assumed the image is gamma corrected and a conversion is done to convert it to linear colour space. The gamma value used for conversion is specified in the Conversion gamma parameter below.
  • Data is linear: When checked, it is assumed the image is already in linear colour space and has not been gamma corrected.
  • Conversion gamma: This value is used for gamma conversion when the Convert to linear radio button is checked.
  • Multiply RGB: This setting allows you to modify the colour component values of the image. Only the image’s colour is affected, not the shader’s built-in displacement or areas outside the projection.
    Changing the image’s colours via the Mulitply RGB values


  • Offset RGB: This setting allows you to offset the colour component values of the image. Only the image’s colour is affected, not the shader’s built-in displacement or areas outside the projection. This setting is useful when working with displacement vector images that are centered on grey instead of black. In that case an RGB offset of (-0.5, -0.5, -0.5) would be necessary.


Displacement Tab[edit]

The Displacement Tab

The settings on this tab control how the shader generates displacement from the loaded image. Displacement values are calculated using the luminance of pixels in the image.


  • Apply displacement: When checked, the shader will generate displacement from the image. When unchecked, no displacement from the image is calculated.
  • Displacement amplitude: This setting scales the displacement values calculated from the image. A value of 1 leaves the displacement values unchanged. A value of 2 would make the displacement values twice as large. A value of 0.5 would make them half as large. Negative values will invert the displacement.
    The Displacement amplitude value controls the height of the displacement.


  • Displacement offset: This value is added to incoming displacement values after they are scaled by the Displacement amplitude parameter. This creates the effect of offsetting the displacement up or down. Positive values push the displacement out so it looks almost as if it was sitting on a plinth. Negative values will sink the displacement back into the underlying surface. It doesn't reverse the displacement, it's more like creating a hole in the surface and then applying the displacement to the bottom of the hole.
    Displacment offset value at -200 metres, 0 metres, and 200 metres.


  • Smooth disp interpolation: When checked, displacement values are smoothly interpolated from the image. When unchecked, no interpolation is used and displacement is taken from the pixel at the point being shaded. The shading results tend to be more noisy than when the setting is enabled. Note, this is not the same thing as smoothing a heightfield’s values to eliminate stair-stepping or blockiness.
    Smooth disp interpolation off and on.


  • Convert disp to linear: When checked, it is assumed the image is gamma corrected and a conversion is done to convert it to linear colour space before the displacement value is calculated. The gamma value used for conversion is specified in the Disp conversion gamma parameter below.
  • Disp data is linear: When checked, it is assumed the image is already in linear colour space and has not been gamma corrected.
  • Disp conversion gamma: This is the value used for gamma conversion if the Convert disp to linear radio button is checked.
  • Use settings from colour tab (compatible with old versions): When checked, the source of displacement values comes from the Colour tab settings. This allows for backwards compatibility for projects created in older versions of Terragen.


Effects Tab[edit]

The Effects Tab

The settings on this tab provide control over the alpha channel, transparency and translucency of the image assigned to the shader.


  • Alpha as opacity: Currently this setting is not functioning properly. Use instead the Use Alpha/Transparency for direct blending setting below.


  • Alpha as colour: When checked, the alpha channel of the image replaces the RGB channels, effectively displaying the alpha channel as a greyscale image.
    The alpha channel replaces the colour values of the image.


  • Create transparency: When checked, the Image map shader will generate transparency based on a colour from the image. This will allow shaders upstream from its Main input to be visible. The colour used for transparency is set with the Transparency key parameter.
  • Transparency key: This sets the colour used to generate transparency. For example, if you want green areas to be transparent you would select a green value in the colour picker to the right.
    Transparency key values set to Black, Green, and Dark grey.


  • Key tolerance: This setting defines a threshold to include colour values similar to the Transparency key colour when generating the transparency. The higher the value the greater the range of colour values used to generate the transparency.
    The Key tolerance value can be used to expand the colour values used to generate the transparency key.


  • Invert alpha/transparency: When checked, the alpha/opacity/transparency for the image is inverted. This will change opaque areas to transparent and vice versa.
    Inverting the alpha/transparency.


  • Use alpha/transparency for direct blending: When checked, the image’s alpha channel or generated transparency is used to blend the image with underlying surfaces. When unchecked, transparency behaves like a cookie cutter, putting a hole in the underlying surfaces and preventing them from rendering at all.
    Invert alpha/transparency for direct blending off and on.

    Workflow showing how the alpha channel of an image can be used in various ways, such as Alpha as colour or Use alpha/transparency for direct blending.

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


  • Translucent: When checked, translucency is enabled and the slider to the right controls the amount of translucency. Translucency gives an effect of light filtering through a surface. As an example, you might use translucency on a leaf texture to simulate light passing through it. It's not the same thing as opacity/transparency. Translucency is explained in more detail here.


  • Translucency tint: This colour tints the translucency effect and is explained in further detail here.



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.

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.

A single element of an image which describes values for color and/or intensity, depending on the color system which the image uses. Groups of ordered pixels together form a raster image.

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.

This is essentially the brightness of the colour. Terragen converts RGB colours to greyscale by taking the luminance of the colour.

A heightmap or heightfield is an array of height values, usually in a grid which describe the height at specific points in a defined area. Heightfields are used to represent real-world and virtual terrain in a specific, easily converted format. Most heightfields can be represented as simple image data in grayscale, with black being minimum height and white being maximum height.