Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

export:worldspace-maps:raster-records

export:worldspace-maps:raster-records <data-directory> --output-directory <dir> [--pixels-per-cell <1-4096>|auto [--max-size <pixels>]] [--terrain auto|colormap|texture] [--hillshade] [--grass] [<shared options>]

The shared options are in Worldspace maps.

Draws each worldspace’s map from its LAND records: the landscape textures each cell paints, its vertex colors, with --hillshade its relief and with --grass the grass its textures grow. Unlike lod, it needs no terrain LOD: every worldspace with exterior LAND gets a map, including the ones that ship no LOD, and a mod that edits the landscape shows on the map without regenerating LOD. The archives are read only for the landscape textures and, with --grass, the grass models and their textures.

The background shows the ground, tinted by its grass with --grass, or from 512 pixels per cell covered with grass tufts (see Grass). Buildings, rocks and trees need --objects, roads and trails --roads, see Objects and Roads. Without them, a forest looks like the ground under it. A worldspace that uses its parent’s LOD has holes where it has no LAND; --parent-lod fills them from its parent, see Parent LOD.

Pipeline

The background is Pipelines/Maps/Backgrounds/Landscape/LandscapeBackground.cs.

  1. In the same pass as the worldspaces, read every exterior LAND’s BTXT, ATXT, VTXT and VCLR (WorldspaceMapReads.Textures), its VHGT with --hillshade or --grass, every LTEX and TXST with its TX00, TX01 and DNAM (Datasets/Landscape/LandscapeTextures), and with --grass every GRAS (Datasets/Landscape/GrassTypes).
  2. Keep each cell’s last LAND over the load order and resolve its LTEX FormIds (Datasets/Worldspaces/WorldspaceLandscapes). A later LAND replaces the whole cell.
  3. Before the first map, give each LTEX a color (LandscapePalette, see Colors), when the maps draw the pattern, its swatches (see Textures) and with --hillshade those of its normal map (see Normal maps), and with --grass its grass (GrassPalette, GrassCover, see Grass); from 512 pixels per cell, the grass models with their UVs and textures (GrassTuftModels, see Grass tufts).
  4. Size the image on the planned cells, --pixels-per-cell pixels per cell side (MapProjection.ForCells, see Size), and compute every cell’s vertex colors (LandscapeRasterizer).
  5. Draw a region of the map: the cells under it build their color, texture and relief grids, in parallel, then the pixels of its cells are made opaque and its grass tufts are drawn. The rows are painted in parallel last, once the objects are drawn, and only where neither a tuft nor an object covers the ground (see Pipeline). A planned cell without a LAND record stays transparent.

With a crop, the image covers only the kept cells: there is nothing outside them to crop. The layers are drawn next.

Size

--pixels-per-cell sets the side of a cell in pixels, 1 to 4096. The default, 32, draws one pixel per vertex step (128 units): a LAND cell has 33x33 vertices, and a path narrower than a vertex step blurs. Past 64 pixels per cell, the ground is the vertices scaled up: soft blocks (rounder with --interpolation bicubic), and a water shore drawn without anti-aliasing shows steps. --terrain texture adds detail past that scale, see Textures.

Tamriel is 119x94 cells: 3808x3008 pixels at the default, 7616x6016 at 64, 243,712x192,512 at 2048, 210,944x167,936 cropped to the playable area. Any size is drawn region by region, see Pipeline. Write a single worldspace at that size with --worldspace.

Automatic size

--pixels-per-cell auto picks a size per worldspace: the largest whole number of pixels per cell whose longest side fits --max-size, measured on the cropped cells with --crop-to-playable. It never goes past 32, one pixel per vertex step: a larger size only scales the vertices up. A small worldspace gets 32. With the default --max-size 2048, Tamriel (119 cells wide) gets 17, 2023x1598 pixels. A worldspace wider than --max-size cells gets 1 pixel per cell and exceeds it.

Terrain

--terrain sets how the landscape textures are drawn. Every mode builds each cell’s colors the same way, see Colors.

--terrainDraws
auto, the defaulttexture from 768 pixels per cell, colormap below, see Automatic terrain
colormapEach landscape texture as the average color of its color map
textureThe same colors, carrying each texture’s pattern repeated as in game, see Textures

Automatic terrain

With auto, a map draws the pattern when a repeat is at least 32 pixels wide, 768 pixels per cell and more (LandscapeOptions.AutoPatternPixelsPerCell), and the average colors below. The scale is the map’s own: with --pixels-per-cell auto, which never goes past 32, every map draws the colors.

A repeat narrower than that shrinks a texture of 1024 texels or more to a few dozen pixels: what is left is its periodicity, a regular grain or grid of dots, not a texture you recognize (see the limits). On WhiterunWorld, compared side by side at 256, 512, 768 and 1024 pixels per cell, the grain reads as ground from 768. The 32 pixels are a style choice.

Colors

A landscape texture’s color is the average of its color map: LTEX TNAM points at a TXST, whose TX00 is a path under textures\. A quadrant without a base texture uses textures\landscape\dirt02.dds, as the engine does. A texture that can’t be read is drawn gray, see data problems.

Each cell is drawn from its 33x33 vertices, then interpolated for each pixel (see Interpolation):

StepSourceEffect
BaseBTXTEach quadrant’s 17x17 vertices take its base texture’s color
LayersATXT and VTXTIn ATXT layer order, each point moves toward the layer’s color by its opacity
Vertex colorsVCLRThe color is multiplied by the vertex color
Tone255 x (c / 255)^0.6 x 1.05 per channel
HillshadeVHGT, with --hillshadePer pixel, after the tone, see Hillshade

The tone curve lifts the dark average of the terrain textures, which VCLR darkens further. It is a style choice.

The quadrant grid and the VTXT layout come from the Oblivion LAND page, see assumptions.

Two cells share their edge vertices, but each quadrant carries its own base texture and layers, so neighbouring cells don’t always paint a shared vertex the same color: in Tamriel, the base texture changes across 6,220 of the 22,184 quadrant pairs that meet on a cell’s east edge. Drawn as is, each cell would stop on a straight line at its edge. Each vertex on a cell’s border takes the mean color of the cells sharing it, two along an edge and up to four at a corner, after the tone. Inside a cell, a vertex two quadrants share takes the later quadrant’s base texture and every layer that reaches it.

Limits:

  • A texture’s average hides its pattern: a cobblestone texture and a gravel one of the same tone look alike. --terrain texture adds the pattern.
  • A quadrant painted with another base texture than its neighbours still ends on a straight line, one vertex step wide.

Textures

With --terrain texture, each pixel keeps its average color and takes on the pattern of the textures under it (LandscapeTextureDetail). A landscape texture repeats 24 times per cell, 12 per quadrant, aligned on the cell edges, as in game (see assumptions). A repeat is pixels per cell / 24 pixels wide: 4 pixels at 96, about 11 at 256, 85 at 2048.

  1. Before the first map, each color map is shrunk to square power-of-two levels down to 1x1 (LandscapeSwatch), each texel the mean of the pixels it covers. The finest level is the repeat’s width in pixels at --pixels-per-cell, rounded up to a power of two, and at most the color map’s shorter side: 16 texels at 256 pixels per cell, 128 at 2048, 256 at 4096.
  2. The map samples the two levels around one texel per pixel, each with --interpolation (bilinear by default, see Interpolation), wrapping at each repeat, and blends them linearly by where the scale falls between them. At 2048 pixels per cell, a repeat of 85 pixels reads the 64 and 128 texel levels.
  3. Each vertex weighs its textures the way it blends their colors: a layer covers what lies under it by its opacity. The weights are interpolated to the pixel.
  4. The pixel’s color is multiplied by the weighted texture samples over the weighted texture means, per channel, raised to the tone curve’s 0.6. ToneCurve computes the power from a table, within a thousandth of a color level.

The colors stay those of --terrain colormap on average: the edges between cells, VCLR, the tone and the hillshade work the same way. At 24 pixels per cell or less a repeat fits in a pixel and the map is the same as with --terrain colormap.

A color map of N texels a side shows one texel per pixel at 24 x N pixels per cell, its repeat then N pixels wide. Below that scale the map shows the color map reduced. Past it, the finest level is the whole color map, scaled up with --interpolation: the map only zooms in on it, without new detail.

Color map sideOne texel per pixel atMagnified within --pixels-per-cell (1 to 4096)
641,536 px per cellPast 1,536
1283,072 px per cellPast 3,072
2566,144 px per cellNever
102424,576 px per cellNever

At 4096 pixels per cell a repeat is 171 pixels: only a color map under 171 texels a side is magnified. Apart from one 32-texel mask, the vanilla files under textures\landscape are 256 texels or more on their shorter side, most of them 1024 or 2048: in the accepted range, the vanilla pattern is always a reduction.

Pattern tiles

When a cell spans a power of two of pixels, the pattern comes back every 3 repeats, an eighth of a cell: 512 pixels at 4096 pixels per cell. Each pixel’s place in a repeat is then an exact binary fraction, so each period gives the same values to the bit. LandscapePatternTiles computes one tile per color map and per normal map the first time a cell uses it, and a pixel reads the tile instead of its texels. Other scales have no exact period, and some have none short enough to hold in memory: 4097 pixels per cell would need a tile of 4097 x 4097 pixels. They read the texels for each pixel.

A texture holds 10.5 MiB of tiles at 4096 pixels per cell, in double to keep the output exact, on top of its levels. Only the textures of the cells drawn cost it.

Limits:

  • Below 384 pixels per cell a repeat is under 16 pixels: the map shows a fine, regular grain, not a texture you recognize. At 96 pixels per cell, Tamriel differs from --terrain colormap by about 1.4 levels out of 255 on average.
  • The grain is regular, so a large area of one texture looks like a grid. At 2048 pixels per cell, the 85-pixel repeat is visible on rock and gravel.
  • VCLR is left out of the weights: where it changes fast, the pattern’s strength is off by the change.

Hillshade

With --hillshade, each pixel is multiplied by a shading factor, lit from the north-west at 45 degrees, or from the preset of --hillshade-hour (see Hillshade hour). The ground computes its terms (LandscapeHillshade) and leaves them to the lighting layer: the fine slope as the pixel’s normal, the broad and curvature terms as its relief. Flat ground keeps its color. The factor is computed per pixel, not per vertex, so the relief stays sharp past 32 pixels per cell, and after the tone curve, which would otherwise flatten it.

TermSlope measuredExaggerationWeight
FineFrom the vertex on each side, at each vertex10.8
BroadFrom 12 vertices (1536 units) on each side, at each vertex20.4

Every term is computed at each vertex, then interpolated to the pixel with --interpolation. Each slope term is the Lambert shading of its slope minus that of flat ground. The fine one shows the vertex-scale detail, the broad one the shape of a mountain or a valley.

The curvature term doesn’t depend on the light. It measures how much the slope rises across the vertex, from 4 vertices (512 units) on each side, on both axes: it is positive in a hollow and negative on a ridge. The term is -0.18 x tanh(3 x change), so a hollow darkens, a ridge lightens, and a cliff stays bounded. It shows the gullies and crests that face neither toward nor away from the light. A curvature measured from the next vertex only shows the vertex grid: it draws a mottling on snow at 64 pixels per cell, and a checkerboard 8 pixels wide at 256.

The factor is the map’s one formula, see Map shading, on the fine slope, with the broad and curvature terms as its cartographic terms: 1 + fine + broad + curvature, kept between 0.55 and 1.35. The fine term’s weight is the formula’s k, the one the objects and the LOD tiles are shaded by. Every term reads the heights of the neighbouring cells, so the shading has no seam at a cell edge. Where a neighbour has no LAND, the cell repeats its own edge. The weights, exaggerations and the curvature’s radius, weight and 3 are style choices.

A ridge running diagonally across the vertex grid shows a step at each vertex: that is the terrain itself, which the game hides under rock meshes.

With --objects, those meshes are drawn and lit in the same pass, by the same light and formula; without --hillshade, neither the ground nor the objects are shaded. The broad and curvature terms then read the surface the map shows rather than the LAND alone: at each vertex, the LAND raised to the highest object face that faces up over it. A mountain mesh enters the broad relief as a LAND mountain would, and the ground around it takes its relief. See Surface relief.

Normal maps

Where the map draws the pattern (see Terrain), --hillshade also shades the relief of each landscape texture: the pebbles, clods and cracks of its normal map, TXST TX01. Nothing else turns it on, and without --hillshade the map has no light to show it by.

  1. Before the first map, each normal map is shrunk to the same levels as its color map (see Textures), with the same repeats.
  2. At each pixel, each texture’s normal becomes a slope east and north, tilted at most 60 degrees, and the slopes are weighted the way the colors are: a layer covers what lies under it by its opacity, and with --grass the grass share counts as flat.
  3. That slope is added to the fine term’s LAND slope, before its Lambert shading. The factor keeps its terms and its bounds, 0.55 to 1.35: the relief of the texture tilts the ground, it isn’t a second shading.

A normal map averages out as it shrinks: the further out the scale, the flatter the relief, so it fades with the pattern. The 60 degrees are a style choice: vanilla normal maps draw crevices close to vertical (on dirt02_n.dds, 1% of texels lean past 84 degrees), which Lambert shading turns into isolated black pixels at 2048 pixels per cell. How the map is oriented on the ground, and why a model-space one (DNAM 0x04) is left out, is in assumptions. On the vanilla SE load order, the 90 LTEX with a TX01 all have a readable tangent-space normal map.

Limits:

  • The default texture, dirt02.dds under a quadrant without a base texture, has no TXST, so no normal map: it shows no relief.
  • The relief repeats with the pattern: at 1024 pixels per cell, a texture with a strong directional relief shows diagonal stripes 42 pixels apart.

Cast shadows

--hillshade adds to the cartographic terms the shadow the relief casts away from the light. The heights are those the broad relief reads: the LAND, raised with --objects by the faces over it. So a mountain casts a shadow, mesh or LAND, and a house doesn’t: at 128 units between vertices, the shadow has the scale of the relief. It shows most under a low sun, with --hillshade-hour sunrise or sunset. The values are in export heuristics.

The lod background casts none: it writes no relief, and reads no VHGT to cast from.

Grass

With --grass, the ground takes on the color of the grass its landscape textures grow (GrassCover). Everything comes from the load order: a mod that adds or recolors grass changes the map. Below 512 pixels per cell, it tints the ground where grass grows; from 512, it scatters the grass models over it, see Grass tufts.

ValueSource
Which grass a texture growsLTEX GNAM, one per GRAS; a GRAS listed twice counts once
Its colorThe GRAS MODL model’s diffuse textures, each alpha-weighted, the shapes weighted by triangle count (GrassPalette)
How much growsGRAS DATA Density, read on 0 to 100
Where it growsGRAS DATA Min Slope and Max Slope, in degrees, both inclusive
Its side of the waterGRAS DATA Distance from water and How water distance is applied, against the cell’s water height

At each vertex, the slope is measured from VHGT (LandscapeHeightField), from the vertex on each side, across cell edges. --grass reads VHGT even without --hillshade. A cell without VHGT counts as flat. The vertex’s height is compared with its cell’s water height (XCLW, or the worldspace’s default): dry-land grass grows only over the water, kelp and coral only under it, see water distance. Each texture’s grasses whose slope range and water rule hold the vertex then give:

  • a coverage, the sum of their densities over 100, at most 1;
  • a grass color, their colors weighted by density.

The texture’s color moves toward its grass color by coverage x 0.6, before the layers are blended (see Colors): VCLR, the tone and the hillshade then work as without grass. The 0.6 keeps the ground’s own color under full grass. It is a style choice, see export heuristics.

With --terrain texture, the pattern of a texture applies to its ground share only; its grass share is flat (see Textures).

A worldspace whose WRLD DATA sets No Grass (0x80) gets no grass. The map’s own worldspace decides: with --parent-lod, the parent’s cells drawn in a child’s holes follow the child. On the vanilla SE load order, 4 of the 45 maps have the flag, among them WhiterunWorld.

On the vanilla SE load order, 26 of the 91 LTEX list a GRAS, and 30 of the 31 GRAS get a color. The last names a model that no archive holds, see data problems. Every vanilla grass model reads without a skipped NIF block.

Limits:

  • Position, height and color range, wave period and the DATA flags aren’t used, see not implemented.
  • The slope changes from one vertex to the next: at 64 pixels per cell and more, grass on uneven ground looks mottled.
  • The grass color is the average of its texture: two grasses of the same tone look alike.

Grass tufts

From 512 pixels per cell (LandscapeOptions.TuftPixelsPerCell), --grass no longer tints the ground: it places each GRAS model over it and draws them from above like the objects, with their textures, alpha test and vertex colors (GrassTufts). The ground between the tufts keeps its own color. Below that scale a tuft is a few pixels wide and the tint reads better. A map with an automatic size stays under it.

The engine’s placement isn’t documented, so the tufts are placed the map’s own way (see export heuristics):

  1. A grass may grow every 32 world units on both axes (GrassTufts.Spacing), moved within its 32-unit square.
  2. A place holds a grass with a chance of the texture weights there times the grass’s density over 100, counted at each vertex where the grass’s slope range holds the slope, then interpolated bilinearly. A boundary between two textures or a slope limit fades over a vertex step instead of cutting along the grid.
  3. A kept tuft turns about its vertical axis, scales by 0.8 to 1.2 and stands upright at the ground’s height, bilinear between the VHGT vertices.
  4. A tuft whose height doesn’t meet its grass’s water rule is dropped: the rule is checked at the tuft’s own height, so the shore cuts the grass where the ground meets the water, not along the vertex grid. Placed water (WATR references) doesn’t count.

The place, turn, scale and the draw against the chance come from a hash of the place and the GRAS FormId. Every region of every run draws the same tufts, and a grass that a mod adds to a texture leaves the other grasses’ tufts where they were.

Every tuft is multiplied by 0.8 (GrassTufts.SelfShadow) for the blades’ shade on one another, its only shading of its own. With --hillshade, the lighting layer then lights it as the ground under it, by the ground’s normal and relief, so the relief still reads under a meadow. The tufts are a cover of the ground: they leave the surface at the ground’s height. The water layer tints them by the ground’s depth, and the contact occlusion doesn’t count each tuft as a step.

Limits:

  • Seen from straight above, a blade card shows its slant only: an upright card is a line.
  • The tufts take their color from their texture: on the tundra, they read more saturated than the tint.

Parent LOD

Without --parent-lod, a worldspace whose PNAM sets “Use LOD Data” is drawn from its own LAND only, with holes where it has none (about half of WhiterunWorld). With --parent-lod, its parent’s LAND fills them, see Parent LOD.

A child and its parent paint the same place their own way, so a cell of the parent can stand out from the child’s cells next to it. The rasterizer blends their shared edge (see Colors), not the whole cell. SolitudeWorld shows it most: its own LAND is close to one flat texture, Tamriel’s cells around it are not.

Worldspaces without a map

A worldspace without exterior LAND counts in the shared warning, which reads “have no exterior LAND to rasterize”, see Output and logging. On the vanilla SE load order, 4 worldspaces have none, among them KatariahWorld and WhiterunDragonsreachWorld.

A texture, normal map, grass model or tuft texture that can’t be read is drawn gray or left out, and counted in one warning, see data problems.