Difference between revisions of "Geog Image Map Shader"

From Terragen Documentation from Planetside Software
Jump to: navigation, search
(Updated descriptions and added example images, conformed to new layout.)
m (Remarked out lines of text indicating parameters only available in Professional version. Adjusted layout.)
 
(3 intermediate revisions by the same user not shown)
Line 14: Line 14:
 
When the node is loading an image it loads each raster band (channel) of the image in turn. It shows a progress dialog, if needed, for each raster band that's loaded.
 
When the node is loading an image it loads each raster band (channel) of the image in turn. It shows a progress dialog, if needed, for each raster band that's loaded.
  
Georeferencing settings are only available in the Professional edition. However the correct size for the image will still be calculated based on georeferencing if needed.
+
As of Terragen 4.6.30 Georeferencing settings are available on all vesions of Terragen. However the correct size for the image will still be calculated based on georeferencing if needed.
  
 
When you use a georeferenced image and the '''Georeference''' parameter is checked it will be placed at the correct position on the planet. However accuracy falls away as you move away from the origin of the planet, which corresponds to 0° latitude, 0° longitude or the Prime Meridian at the Equator. To ensure the best accuracy when working with georeferenced data it's suggested that you move the planet origin to the area you're interested in. This is less important with image data but can be a factor if you're using the image for displacement or along with georeferenced DEMs.
 
When you use a georeferenced image and the '''Georeference''' parameter is checked it will be placed at the correct position on the planet. However accuracy falls away as you move away from the origin of the planet, which corresponds to 0° latitude, 0° longitude or the Prime Meridian at the Equator. To ensure the best accuracy when working with georeferenced data it's suggested that you move the planet origin to the area you're interested in. This is less important with image data but can be a factor if you're using the image for displacement or along with georeferenced DEMs.
Line 62: Line 62:
 
==Location Tab==
 
==Location Tab==
 
[[File:GEOG_01_LocationTab.png|none|470px|Location Tab]]
 
[[File:GEOG_01_LocationTab.png|none|470px|Location Tab]]
The georeferencing settings below are only available in the Professional version:
+
<!-- The georeferencing settings below are only available in the Professional version: -->
 +
 
 
   
 
   
 
* '''Georeference: '''  When checked, the shader will be positioned or “georeferenced” according to the settings in the fields below..
 
* '''Georeference: '''  When checked, the shader will be positioned or “georeferenced” according to the settings in the fields below..
Line 73: Line 74:
 
* '''SW corner lat long:'''  This sets the latitude and longitude of the southeast corner of the heightfield.
 
* '''SW corner lat long:'''  This sets the latitude and longitude of the southeast corner of the heightfield.
  
* '''Position explicitly:'''  When checked, you can set the position of the image directly without using georeferencing, with the settings below. Explicit positioning is the only option for versions of Terragen lower than the Professional version.
+
* '''Position explicitly:'''  When checked, you can set the position of the image directly without using georeferencing, with the settings below. <!-- Explicit positioning is the only option for versions of Terragen lower than the Professional version. -->
  
 
* '''Position center:'''  When checked, the shader is positioned relative to the centre of the image.
 
* '''Position center:'''  When checked, the shader is positioned relative to the centre of the image.
Line 95: Line 96:
 
*'''Flip y:'''  When checked, the image is flipped in the Y direction, the top becomes the bottom, or up becomes down.
 
*'''Flip y:'''  When checked, the image is flipped in the Y direction, the top becomes the bottom, or up becomes down.
 
<ul>
 
<ul>
[[File:GEOG_12_FlipXY.jpg|none|800px|Flipping the image on its XY axis]]
+
[[File:GEOG_18_FlipXY.jpg|none|800px|Flipping the image on its XY axis]]
 
</ul>
 
</ul>
  
Line 112: Line 113:
  
 
* '''NODATA colour value:''' This lets you choose the colour that the NODATA pixels are replaced with. If the image is indexed/paletted greyscale the luminance of this colour is used as a greyscale value.
 
* '''NODATA colour value:''' This lets you choose the colour that the NODATA pixels are replaced with. If the image is indexed/paletted greyscale the luminance of this colour is used as a greyscale value.
 +
<ul>
 +
[[File:GEOG_19_NODATAReplaceColour.jpg|none|800px|Replacing the NODATA pixels with a colour value.]]
 +
</ul>
  
 
* '''NODATA alpha value: ''' This sets the alpha value of the replacement colour. You can use values from 0 (fully transparent) to 1 (fully opaque). Note that this may change the internal image to RGBA if you specify a value other than 1.
 
* '''NODATA alpha value: ''' This sets the alpha value of the replacement colour. You can use values from 0 (fully transparent) to 1 (fully opaque). Note that this may change the internal image to RGBA if you specify a value other than 1.
Line 125: Line 129:
 
* '''NODATA scalar value:''' This is the scalar value used for NODATA replacement.
 
* '''NODATA scalar value:''' This is the scalar value used for NODATA replacement.
 
* '''Make NODATA transparent:''' When checked, NODATA values become  completely transparent. If any channel of a pixel has a NODATA value the pixel is made fully transparent. Note that enabling this setting means images will be expanded to RGBA, potentially increasing memory usage.
 
* '''Make NODATA transparent:''' When checked, NODATA values become  completely transparent. If any channel of a pixel has a NODATA value the pixel is made fully transparent. Note that enabling this setting means images will be expanded to RGBA, potentially increasing memory usage.
 +
<ul>
 +
[[File:GEOG_20_ReplaceNODATAWithTransparency.jpg|none|800px|When replacing the NODATA values with transparent values, you can use the direct blending setting under the Effects tab.]]
 +
</ul>
 
* '''Update button:''' Click this button to update the image when you change any of the NODATA replacement settings. This is not done automatically as you make changes as it can be a time consuming process with large images.
 
* '''Update button:''' Click this button to update the image when you change any of the NODATA replacement settings. This is not done automatically as you make changes as it can be a time consuming process with large images.
  

Latest revision as of 17:59, 2 November 2022

GEOG Image Map Shader


The Geog image map shader can load and georeference images in many raster geospatial data formats. In other words, you can use it to load aerial and satellite photos. Georeferencing means it places images in their correct geographic location on the planet, as long as the georeferencing information is available with the image. Please note that the node does not support vector images.

The Geog image map shader is a specialised version of the Image Map Shader. It shares quite a few settings with the Image map shader but also provides new ones for working with geospatial data.

You can see a list of the image formats supported by the node here. Terragen supports all of the formats which have "Yes" in the "Compiled by default" column of the table on that page. It also supports JPEG2000 via OpenJPEG. Most commonly used image formats are supported. Please note that not all of the supported formats have been tested, there are a lot of them and some are quite obscure.

The Geog image map shader doesn't allow you to specify the image projection (not to be confused with the geographic projection) for the shader. The only image projection it supports is Plan Y.

When the node is loading an image it loads each raster band (channel) of the image in turn. It shows a progress dialog, if needed, for each raster band that's loaded.

As of Terragen 4.6.30 Georeferencing settings are available on all vesions of Terragen. However the correct size for the image will still be calculated based on georeferencing if needed.

When you use a georeferenced image and the Georeference parameter is checked it will be placed at the correct position on the planet. However accuracy falls away as you move away from the origin of the planet, which corresponds to 0° latitude, 0° longitude or the Prime Meridian at the Equator. To ensure the best accuracy when working with georeferenced data it's suggested that you move the planet origin to the area you're interested in. This is less important with image data but can be a factor if you're using the image for displacement or along with georeferenced DEMs.

It's easy to move the planet origin. Let's say you've loaded an image and it's georeferenced. We'll move the planet origin so that it's at the southwest corner of the image. Follow these steps:

  1. Click the copy/paste button (clipboard icon) at right of the SW corner lat long parameter.
  2. Choose "Copy coordinates" from the menu which pops up. This will copy the lat/long values from both text fields at the same time.

  3. Open the parameter view for the Planet 01 node (the default planet object). You can find this in the Objects node list or double click on the node in the network view.

  4. Paste the values into the planet's Lat long at apex parameter. You should use the copy/paste button for this again. Click the button and choose "Paste coordinates".

Those steps move the planet origin to the area you're interested and should ensure the best results.

The node allows you to replace NODATA values with a different value. NODATA values indicate areas in the image without valid data, which would usually be represented as black areas in the image.

The Geog image map shader works best with images that are already have the raster data aligned north/south. For example some of the US National Land Cover Database images have the raster data rotated within the image bounds. These currently will not display properly. The Geog image map shader will support warping images such as these in the future. In the meantime you may want to warp these images yourself, perhaps using the GDAL tools.

The node uses GDAL and PROJ.4 to load and georeference image files.


Settings:


  • Name: This setting allows you to apply a descriptive name to the node, which can be helpful when using multiple GEOG Image 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 parameter lets you specify the image file to be loaded. Click the File button on the right to open a file chooser dialog.
  • Load method: This popup menu has two options which allow you to choose between loading the image via the Geospatial Data Abstraction Library (GDAL) or using Terragen's internal image loading.
    Load method options

    GDAL: Select this option for Geospatial Data Abstraction Library and other geographic type images.
    Terragen: This option is useful for other types of image formats which GDAL doesn’t support such as OpenEXR. It is more consistent with image loading in other nodes.

  • Border blending: This setting softens the edge of the shader allowing it to blend into underlying textures.
  • Mask by shader: When checked, the GEOG 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.


Location Tab[edit]

Location Tab


  • Georeference: When checked, the shader will be positioned or “georeferenced” according to the settings in the fields below..
  • Auto georeference from file: When checked, the node tries to load georeferencing information from the image. This setting is enabled by default, so that when a new node is created and an image file chosen, the georeferencing information will be loaded automatically. If georeferencing information is found when the file loads, the Georeference setting is automatically enabled, so that the georeferencing information will be read the next time the project is opened. Therefore, if you turn off the Georeference setting you should also turn off the Auto georeference from file setting, otherwise georeferencing will be turned back on when the project loads. If you make changes to the georeferencing values below this parameter is turned off.
  • Reproject on the fly: When checked, the shader is able to dynamically reproject images so they line up much more accurately with other georeferenced data. Previously for the best results you would need to reproject or warp the original data to a suitable projection. With this parameter checked you can use the original data unchanged. Note that the georeferencing information from the file is used when this is checked, and changes to the georeferencing parameters won't apply.
  • NW corner lat long:This sets the latitude and longitude of the northwest corner of the heightfield.
  • NE corner lat long: This sets the latitude and longitude of the northeast corner of the heightfield.
  • SE corner lat long: This sets the latitude and longitude of the southeast corner of the heightfield.
  • SW corner lat long: This sets the latitude and longitude of the southeast corner of the heightfield.
  • Position explicitly: When checked, you can set the position of the image directly without using georeferencing, with the settings below.
  • Position center: When checked, the shader is positioned relative to the centre of the image.
  • Position lower left: When checked, the shader is positioned relative to the lower left corner of the image.
    The GEOG image map shader positioned at the lower left and at the center.


  • Position: These XYZ values set the position of the shader.
  • Size: This sets the size of the shader in metres.
  • Size from Image: Click this button to set the size based on the data available from image. For example, if the georeferencing data for the image indicated it covered an area of 5 km by 10 km then the Size parameter would be set to { 5000, 10000 }.


Flip Tab[edit]

Flip Tab


  • 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.
    Flipping the image on its XY axis


NODATA Tab[edit]

NODATA Tab


The NODATA tab has settings which let you replace pixels with NODATA values in the image data with another value. Pixels with NODATA values indicate areas in the image where there is missing or invalid data. The NODATA tab parameters let you replace these with a colour, a value or make them transparent. When an image is loaded Terragen tries to do it in a manner which uses the least memory resources, by matching the internal image format as closely as possible to the image file. However replacing NODATA pixels may require that the internal image format takes up a lot more memory. For example, let's say that the image file is an 8 bit greyscale paletted/indexed image. If you chose to replace NODATA pixels and make them transparent then TG would need to change the internal image format from 8 bit to 32 bit RGBA, quadrupling the amount of memory used. As geospatial images can be very large it is worth keeping this in mind if you don't have a lot of memory available. You can check if an image has any NODATA values by looking at the Raster and Projection Info field on the Info tab.

  • Replace NODATA values: When checked, the NODATA pixels in the image will be replaced. Be aware that this can take some time with large images, as the image data has to be reloaded. You might find it more efficient to first set up the replacement values with the settings below and then check this checkbox. It will save you having to immediately update the image data after making the changes.
  • Replace with colour: When checked, the NODATA pixels will be replaced with the NODATA colour value below.
  • NODATA colour value: This lets you choose the colour that the NODATA pixels are replaced with. If the image is indexed/paletted greyscale the luminance of this colour is used as a greyscale value.
    Replacing the NODATA pixels with a colour value.
  • NODATA alpha value: This sets the alpha value of the replacement colour. You can use values from 0 (fully transparent) to 1 (fully opaque). Note that this may change the internal image to RGBA if you specify a value other than 1.
  • Replace colour mode: This popup has two options which determine how NODATA pixels are replaced.
    Replace colour mode options

    Channel by channel: This option replaces the NODATA values on a channel by channel basis. Lets say your image has R, G and B channels. A particular pixel has a NODATA value in its R channel but valid data in the G and B channels. In this case the node will take the R value from the NODATA colour value and replace the R channel of the pixel but leave the G and B channels unchanged.
    Any channel: This option replaces the entire pixel if any channel has a NODATA value. Again we'll use the example of a pixel that has a NODATA value in its R channel but valid data in the G and B channels. With this option the pixel is entirely replaced using the NODATA colour value, even though the G and B channels have valid data.

  • Replace with scalar: When checked, the NODATA values are replaced with the NODATA scalar value below. This always operates on a channel by channel basis. If only one channel of an image pixel has a NODATA value then only that channel is replaced.
  • NODATA scalar value: This is the scalar value used for NODATA replacement.
  • Make NODATA transparent: When checked, NODATA values become completely transparent. If any channel of a pixel has a NODATA value the pixel is made fully transparent. Note that enabling this setting means images will be expanded to RGBA, potentially increasing memory usage.
    When replacing the NODATA values with transparent values, you can use the direct blending setting under the Effects tab.
  • Update button: Click this button to update the image when you change any of the NODATA replacement settings. This is not done automatically as you make changes as it can be a time consuming process with large images.


Info tab[edit]

Info Tab

The Info tab displays image data, including the image size in metres and pixels and how the image is projected. The settings on this tab are read only, and although you can’t edit them, you can select them and copy the text.

  • XY size (metres): This setting displays the size of the image in metres. The values are calculated from the georeferencing information. If there is no georeferencing information available for the file then a default scale of 1 pixel equals 1 metre is used.
  • XY size (pixels): This is the size of the image resolution in pixels.
  • Raster and Projection Info: This field displays quite a lot of information about the structure of the raster data, along with the projection found for the image file. The first two lines display the raster dataset size in pixels and the number of raster bands in the image. Raster bands are similar to channels in a normal image, except in geospatial images they may represent data other than colour data. Information is shown about each raster band in the image. The raster band information will look something like this:

    Raster band 1
    Colour interpretation: Red
    Data type: Unsigned 8 bit integer
    Band doesn't have a NODATA value

    The first line shows the index of the raster band in the image, in this case "1". The second line shows the colour interpretation of the raster band. The colour interpretation is a hint about how the raster band data should be read. In this case it is "Red" which means the raster band is the red channel of an image. The next line displays the data type of the raster band. Finally there is a line which describes the NODATA status of the raster band.

    The final block of information is the projection and coordinate system which is being used to georeference the image. The coordinate system is displayed using the OpenGIS Well Known Text format.

    Raster and Projection info when Load method set to GDAL
    Raster and Projection info when Load method set to Terragen


Colour tab[edit]

Colour Tab

This tab has settings which control how the Geog Image Map Shader generates colour information from the image.

  • Apply colour: When checked, the shader will generate colour from the image.
  • 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.
  • 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.
  • 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.
    Using the Multiply RGB setting to change the colour values in the image.
  • 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.
    Using the Offset RGB setting to change the colour values in the image.


Displacement tab[edit]

Displacement Tab

The Displacement tab has settings which control how the Geog Image Map 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 raises or lowers the image’s pixel values thereby raising or lowering the height of the terrain.
  • 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.
    The Displacement offset value raises or lowers the entire area covered by the GEOG image map shader.
  • 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.
  • 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.


Effects tab[edit]

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: When checked, the image’s alpha channel is used for opacity/transparency.
  • Alpha as colour: When checked, the alpha channel of the image replaces the RGB channels, effectively displaying the alpha channel as a greyscale 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.
  • 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.
  • Invert alpha/transparency: When checked, the alpha/opacity/transparency for the image is inverted. This will change opaque areas to transparent and vice versa.
  • 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.
  • 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.


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 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 parameter is an individual setting in a node parameter view which controls some aspect of the node.

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 Node List is a part of the Terragen interface that shows a list of nodes along the left side of the application window. The Node List generally shows only those nodes that are relevant to the current Layout (e.g. Terrain, Atmosphere). It sometimes includes buttons or other controls that are specific to a particular Layout as well. The Node List is hierarchical and each level is collapsible.

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 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.

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

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