Personal tools
You are here: Home Data and Tools Topography Paraview: Topography by Texture Mapping

Paraview: Topography by Texture Mapping

Motivation

The usual way of including topography in Paraview is using a sufficiently fine grid where each grid point contains a data value that is mapped to a color via a color table. Thus, it is possible to change the colors by adjusting the color map, or to exaggerate the relief, as described here: Exaggerated Topography in Paraview.

However, sometimes this is not necessary. Either, because there is no need for a three-dimensional relief, or because the available relief is much coarser than the desired resolution of the surface features. Then it's not necessary to have a very high grid resolution, but can project a high-resolution bitmap onto a much coarser grid.

Procedure

  • A texture requires a dataset with texture coordinates. Paraview contains three filters that generate these texture coordinates automatically. Once these coordinates are present, one can assign an image file to the surface of the body. Thus, the 3D object must exist first, and the texture filters provides only the possibility to assign a texture to it. The available filters are:
    • Texture Map to Cylinder
    • Texture Map to Sphere
    • Texture Map to Plane
  • Then you need a bitmap. A possible source could be a map like an extract from OpenStreetMap. Just click on Export and choose the appropriate part and resolution.
  • Paraview uses a right-handed Cartesian coordinate system. This means, if the x axis points to the right, the y axis points upwards. This is different for bitmaps; there, the origin is on the top left, so the x axis goes to the right ("columns"), but the y axis goes downward ("rows"). Thus, the bitmap must be flipped in the vertical direction, which can be done with any graphics program.
  • Then load the texture in the texture map filter (in the Object Inspector, tab Display, choose Texture/Load...).
  • Sphere: There are some additional caveats.
    • There is an option Prevent Seam. Its goal is to prevent a seam between the end and start of the texture by adding a mirrored copy of the texture behind it. This may make sense for textures that are symmetric and discontinuous between end and start. This does not apply for topography: it is not symmetric, yet continuous around the Earth. Thus, this option should be switched off.
    • The image starts at x=1/y=0; normally, this corresponds to a longitude of 0°. So make sure that the texture starts at 0° and ends at 360°, instead of -180° to +180° which is probably more common.
  • The Paraview texture filters seem to have a problem with some geometric shapes; they create a seam e.g. on a sphere that is not even straight. There does not seem to be a reliable workaround; however, one can create the texture coordinates by hand:
    • Create a 2D array of point data, with the two normalized texture coordinates for each gridpoint. The variable type in the VTK file is, however, not SCALAR or VECTOR, but TEXTURE_COORDINATE (see below).
    • The first component of the texture coordinates, commonly named u, corresponds to the x coordinate of the texture. So u = 0 refers to the left side of the texture, u = 0.5 to the middle, and u = 1 to the right side.
    • The second component, v, is similar: v = 0 refers to the lower end of the texture, and v = 1 to the upper end.
    • For a bitmap with a world map reaching from -90°/-180° to +90°/+180°, one would choose v = 0 for the North pole of the sphere (due to the coordinate system convention in bitmaps, see above), v = 1 for the South pole, and u = 0 for -180°, u = 0.5 for the Greenwich meridian, and u = 1 for +180°.
    • These texture coordinates are persistent over the whole filter pipeline. So it makes sense to create the texture coordinates for a simple basic shape like the sphere, and deform it afterwards.
    • Example for a texture coordinate section:
POINT_DATA 2000
TEXTURE_COORDINATES Texture%20Coordinates 2 float
0     1
0.1   1
...
1     0

Textures

  • Textures to be projected onto a sphere should use the equirectangular or "plate carré" projection.
  • Creation of such a texture from ETOPO using GMT:
    makecpt -Ctopo > "topo.cpt"
    grdimage etopo.grd -JQ20c -Rg -Ctopo.cpt > "output.ps"
    ps2raster "output.ps" -A -Tg
  • A good and high quality image source are the Blue Marble Next Generation images:
    http://visibleearth.nasa.gov/view_set.php?categoryID=2363
  • Most maps go from -180° to +180° instead of 0° to 360°. This can be changed with the following ImageMagick command:

    montage input.tif input.tif -geometry 100% -gravity Center -crop 50%x100% -flip output.png

Examples

This is NASA's blue marble image, wrapped around a sphere:

Blue Marble

The texture image is: texture_land_ocean_ice_8192.png

 

 

For the next example, see Exaggerated Topography in Paraview.

 SRTM + OSM Fürth 25x exaggerated

Document Actions