Worldspace maps
The export:worldspace-maps:* commands write one map per worldspace of the load order: one PNG,
or with --format grid or --format pmtiles the tiles of a zoomable map viewer (see
Output formats).
A map is a background, then layers drawn over it, bottom to top. Each command has its own background; the layers, the crop, the parent LOD and the output are shared. This page documents what the commands share; each command’s page documents its background, its own options and its results on the vanilla data.
| Command | Background |
|---|---|
export:worldspace-maps:lod | The terrain LOD diffuse tiles of the archives, stitched |
export:worldspace-maps:raster-records | Each cell rasterized from its LAND record: landscape textures, vertex colors, relief |
No map marker or book is drawn on the image. With --markers, the grid and pmtiles outputs list them
for a viewer, see Markers. The only labels drawn are the cell labels of --cell-grid,
see Cell grid.
Pipeline
The code is in Pipelines/Maps/, by what each folder does:
| Folder | Holds |
|---|---|
| (root) | MapPipeline, MapOptions and MapRegionRenderer, which draws a region |
Planning/ | Which cells each worldspace draws, from the plugins alone, and what is read for them |
Geometry/ | The projection, pixel rectangles, cell windows and the rotation of a placed object |
Surface/ | The height of the LAND under each pixel, between vertices |
Style/ | The light, the tone and the colors the terrain and the objects share |
Backgrounds/ | The bottom of a map: Lod/ and Landscape/ (Terrain/, Textures/ and Grass/) |
Canvas/ | The image being drawn and the planes its layers pass each other |
Layers/ | The layers, a folder for each with the pieces only it uses |
Levels/, Markers/, Output/ | The floors of a multi-level map, the marker catalog, the writers |
Objects/ | What draws the placed objects |
Layers/PlacedObjects/ holds the objects layer and the map’s object logs, and its Materials/
holds what each objects mode reads in the archives to give the shapes their materials. Objects/ holds the rasterizer at its root,
the models and their placements in Scene/, the textures and their mip selection in Textures/,
each shape’s material (its pass, color, texture and effect, resolved once per map), the face
lighting and the shading of effect shapes in Materials/, the region’s pixel frame, the
transformed vertices and the traversal of a triangle’s pixels in Raster/, the region’s buffers, its
candidate instances and the face shading in Drawing/, with the passes over
a band’s shapes (opaque then blended, or depth then edges in wireframe) in Passes/, what a
covered pixel becomes in each in Writers/, and the blended faces in Blended/, and the heights sampled on a world grid in Sampling/.
Each step reads only what the previous one gave it, so the planning is tested without
archives, a background without plugins, and a layer on a synthetic image.
| Step | Code | Reads | Gives |
|---|---|---|---|
| Read | MapPipeline, with the WorldspaceRecords and WorldspaceMaps datasets | Every plugin, in one pass | Merged worldspaces, their cells, what the background and the layers read |
| Plan | MapPlanner | The merged records | Per worldspace: the cells to draw, the crop, the parent whose LOD it uses |
| Background | MapBackground (LodBackground, LandscapeBackground), prepared once into an IBackgroundRun, which opens each map | The archives, and the plugins’ data it asked for | The map’s MapProjection, cropped, and a BackgroundRaster that draws any rectangle of it |
| Render | MapRegionRenderer: the surface when a layer reads it, the raster, then each layer’s drawer in the order of MapLayers | A rectangle of the map, the plugins’ data of the worldspace | The rectangle’s pixels, at each level |
| Write | MapWriter, with a MapSink per format (PlainPngSink, GridSink, PmTilesSink) and per level | The regions’ pixels, one at a time | A PNG, a tile grid or a PMTiles archive, and one per level |
- Ask the background and every layer what they read in the plugins (
WorldspaceMapReads), and read their union withDatasets/Worldspaces/WorldspaceMapQuery.csin one pass over every plugin of--load-order. It readsWRLDandCELLand locates eachLANDfrom its header; it parses nothing else unless a background or a layer asks for it. Merge theWRLDrecords withWorldspaceMerger, and collect each worldspace’s exteriorLANDcells withWorldspaceCells.FindLandscapeCellsByWorldspace. FormIds resolve through each plugin’s masters, so a DLC adding cells to Tamriel counts toward Tamriel. When a layer reads references, a second walk reads the base objects they place (BaseObjects), known only once the references are merged. With--lights, the same walk reads theLIGHbases among them (LightBases, see Lights). With--markers=books, the same pass reads everyBOOK(BookRecords, shared with the book export) to tell which placed references are books and to name them. - Plan each worldspace from the records alone: its
LANDcells, with--crop-to-playableonly those inside the playable bounds (see below), and with--parent-lodthe cells of its parent (see below). With--worldspace, only the worldspaces named are planned; a name no worldspace has stops the command here, before anything is drawn. A child named alone still uses its parent with--parent-lod. - Prepare the background over the planned cells, cropped to the kept cells when there is a crop:
what is computed once per map (vertex colors, decoded tiles), and the
MapProjectionthat maps every pixel to its cell. - Draw a region of the map: the background’s pixels in it, then each layer, in a fixed order (see
Layers). A region where the background draws nothing is not drawn: it stays
transparent. In a region that draws one level, the background leaves its colors until the first layer that
reads them: the objects layer only paints over pixels, so the background then paints only the
pixels it left uncovered (
BackgroundRaster.DrawDeferred, theCoveredplane, see Region planes). On Tamriel at 512 pixels per cell, an object covers 47 % of the ground’s pixels. The pixels don’t depend on how the map is cut into regions. A layer that reads the pixels around its own (ILayerDrawer.Margin, the lighting’s contact occlusion) gets them: the region is drawn that many pixels larger, up to the map’s edge, then cropped. In that margin only the surface and the blended shapes are computed (MapCanvas.Shown): no colors, normals or relief. - Write each region as it is drawn (see Output formats). The format picks the
regions: square blocks of 4 x 4 tiles for
gridandpmtiles, bands of the full width forplain-png. The next regions are drawn while the last one is written, 2 bands at a time, or one block per logical core, from 2 to 32, unless--jobssets the count: one region’s parallel loops leave cores idle as they end, and the other regions fill them. Measured on 4, 8 and 16 logical cores, half as many blocks takes up to 17 % longer on Blackreach and twice as many saves at most 8 %, for more memory. A smaller block also redraws fewer levels, since a level is drawn again only in the regions where it differs from level 0. A block under 2 tiles costs more than it saves: the contact occlusion’s margin weighs more against the pixels kept. A band stays at 2, since it holds 16 times a block’s pixels. A map takes the memory of the regions drawn and the one written, whatever its size; with levels, those regions at each level that differs from level 0. The tiles waiting for their siblings in the lower zooms add to it, and grow with the map’s width. The exporter setsSystem.GC.ConserveMemory: the regions’ large arrays pile up in the heap faster than the GC returns them. Blackreach at 4096 pixels per cell peaks at 7 GB with it, 16 GB without, and takes no longer. A map is refused only when a side passes 2^31 - 1 pixels, the most a PNG holds.
Crop to the playable area
A worldspace’s LAND records cover much more than the part you can walk in. Solstheim has 34,383
LAND cells: most are sea floor, and a large part of the south is Vvardenfell scenery. Sovngarde
has strips of filler terrain around its valley, and Tamriel has mountains past the borders.
--crop-to-playable (MapCrop) keeps the LAND cells inside the overlap of two bounding boxes,
grown by one cell:
| Box | Cells | What it leaves out alone |
|---|---|---|
| Navmesh | Cells with a NAVM record | Scenery nobody walks on (Tamriel’s borders, Vvardenfell) |
| References | Cells with a non-persistent REFR or ACHR | Stray navmeshes (the columns of navmesh in Sovngarde’s filler) |
Persistent references are left out because they sit in the worldspace’s persistent cell, not in
the cell where they are placed. The one-cell margin keeps the terrain you see from the edge of the
walkable area. When a worldspace has no navmesh or no reference, the other box is used alone; when
the boxes don’t overlap, the navmesh box is used. Cells without LAND inside the kept area are
transparent. The crop and the mask come from the records, not from the pixel colors, so a dark
area inside a real cell is kept.
This is a heuristic chosen on the vanilla worldspaces, see assumptions. Results on the vanilla SE load order:
| Worldspace | Without crop | With crop |
|---|---|---|
| Tamriel | 119x94 cells | 103x82 cells |
| DLC2SolstheimWorld | 192x192 cells | 31x30 cells |
| Sovngarde | 58x73 cells | 31x34 cells |
| MarkarthWorld | 18x9 cells | 4x5 cells |
MarkarthWorld’s navmeshes cover 2x3 cells: the city is built from objects on a small patch of terrain, so its cropped map is small.
Parent LOD
A child worldspace whose WRLD PNAM sets “Use LOD Data” (0x02), the Creation Kit’s “Use LOD
Data” checkbox under its parent worldspace, shows the LOD of its WNAM parent around it in game.
On the vanilla SE load order, 7 worldspaces set it: the cities (SolitudeWorld, RiftenWorld,
WhiterunWorld, WindhelmWorld), WindhelmPitWorldspace, WhiterunDragonsreachWorld and KatariahWorld.
The last two have no exterior LAND and get no map. With --parent-lod
(WorldspaceLodSource), such a worldspace is drawn with the first ancestor that doesn’t set the
flag. A missing parent or a WNAM loop leaves the
worldspace without a parent. raster-records takes the same parent, though it draws its LAND,
not its LOD.
The child’s cells sit at the same grid coordinates as in its parent. A child’s own LAND has holes
(about half of WhiterunWorld’s bounding box has no LAND), and in game the parent’s LOD fills them.
The map draws the child’s LAND cells and the parent’s inside their bounding box
(MapCrop.WithParentLandCellsWithin), and is always cropped to them, with or without
--crop-to-playable. With --crop-to-playable, the box comes from the child’s playable cells.
The data the background and the layers read (LAND, heights, water, navmesh triangles,
references) comes from the child where the child has the cell, and from the parent elsewhere
(MapInputs.ContentFor). A navmesh triangle belongs to the cell of its centroid, a reference to
the cell of its position. Where the two disagree, the water stops on a straight cell edge
(Solitude’s harbour). How each background draws a child is on its page.
Child worldspaces
A child worldspace’s WRLD ONAM says where its map markers fall on the map of its WNAM parent:
a point (x, y) of the child lands at (x * scale + X offset, y * scale + Y offset) on the parent
(WorldspaceMapPlacement). A scale of -1 hides them. The Z offset isn’t used: the map is flat. A
grandchild goes through each offset on the way up. A child without ONAM, or a WNAM loop, stops
the walk there.
The scale tells how the child relates to its parent:
| Scale and offsets | Vanilla examples | Its markers on the parent’s map |
|---|---|---|
| 1, offsets 0 | The cities, MarkarthWorld, but also SkuldafnWorld and DLC01Boneyard | At their own position |
| 1, X/Y offsets | KarthspireRedoubtWorld, DLC1HunterHQWorld | Moved as a block, same size |
| Near 0 | AlftandWorld, FallowstoneCaveWorldEnd | Gathered on one point, usually the entrance |
| Other | Blackreach (2.5), DLC01FalmerValley (0.5) | Scaled around the offset |
| -1 | Sovngarde | Hidden |
Only the markers use it: a parent’s map lists its children’s markers and books. The background and the layers draw the worldspace’s own records only, as the game does: Tamriel holds each city as seen from outside its walls, and the city’s worldspace holds it as seen from inside. A city’s walls cross its cells, so no cell of Tamriel can be swapped for the city’s without losing the gate, the road or the bank outside it.
To draw the cities on Tamriel’s map, load a mod that moves them into Tamriel, such as Open Cities
Skyrim, with --load-order custom: their records are then Tamriel’s.
Interpolation
--interpolation sets how a value between samples is computed, wherever the map reads one between
them:
| Samples | Read for | With |
|---|---|---|
The 33x33 vertices of a LAND cell | The terrain height of the surface the objects stand on and the water tints | --objects or --water |
| The same vertices | The colors, the texture weights and the slopes of the hillshade | raster-records |
| The texels of a mip level, wrapping every repeat | The pattern of the landscape textures, see Textures | raster-records --terrain texture |
| The texels of a mip level, wrapped or clamped | The objects’ textures, see Texture mode | --objects=texture |
It doesn’t apply where nothing is read between samples. The lod tiles are drawn at their own size:
every vanilla tile and its normal map are 256x256, apart from 20 tiles of 4x4 that are redrawn (see
placeholder tiles). Two mip levels blend linearly, and each zoom of a
grid is the mean of 2x2 pixels of the one above, whatever the option.
The table and the edges below are written for the LAND vertices. On a texture, the same kernels
read texels, and past the texture’s edge they wrap or clamp as the texture does.
| Value | Reads | Result |
|---|---|---|
nearest | The nearest vertex | A square of one value around each vertex: the raw data, blocky past 32 pixels per cell |
bilinear | The 2x2 nearest vertices | The default. Straight blends, diamond-shaped corners past 64 pixels per cell |
bicubic | The 4x4 nearest vertices, Catmull-Rom | Smoother transitions, and the relief has no crease at each vertex |
bspline | The 4x4 nearest vertices, cubic B-spline | The softest: smooth curvature, no overshoot, but it doesn’t pass through the vertices |
bspline smooths the data instead of interpolating it: a peak comes out lower and a valley
shallower than their vertices, and a lone vertex of another color fades into its neighbours. The
water follows that smoothed terrain, so a shallow shore can move by a fraction of a vertex.
bicubic and bspline read one vertex past the cell’s edge. For the colors, the hillshade and
the water it comes from the neighbouring cell, so the map has no seam there. Where that cell has no
LAND, the cell repeats its own edge. The texture weights always repeat the edge: two cells don’t
weigh the same textures. Bicubic can overshoot past its samples; the colors are clamped to 0 to 255
and a negative texture weight is ignored.
At 32 pixels per cell or less, the pixels sit close to the vertices: bilinear and bicubic give
about the same map. bspline still softens it.
Kernels
The code is in Imaging/Interpolation/, which knows nothing of the landscape. A kernel, in
Kernels/, gives weights for a position between two samples. Taps, in Taps/, apply a kernel at
one position on one axis: which samples it weighs and with which weights.
| Type | Role |
|---|---|
InterpolationKernel | One way to interpolate along one axis: samples, weights, margin |
NearestKernel, BilinearKernel, BicubicKernel, BSplineKernel | The kernels |
SampleGrid | A grid of values and its margin, interpolated with its kernel at a row, then along that row |
KernelTaps | The samples and weights of a kernel at one position on one axis of a SampleGrid |
TexelTaps | The same along one axis of a texture, without a margin: an index past the edge wraps or is clamped |
A kernel says which samples around a position it weighs, with which weights, and how far past the
grid’s edge it reads (its margin). It weighs at most InterpolationKernel.MaxTaps samples.
InterpolationKernel.All lists the kernels the commands offer. Pipelines/Maps/CellVertexGrid fills
a SampleGrid with a cell’s vertices and the margin from its neighbours. To add a way, write a
subclass of InterpolationKernel and list it in All: --interpolation takes its Name, and every
map layer and background uses it.
Surface
The objects and the water share one height per pixel, the surface: the height of what the pixel
shows. MapRegionRenderer computes it for each region when a layer reads the LAND heights
(TerrainSurface): the terrain under each pixel center, interpolated between the vertices with
--interpolation, reading the neighbouring cells past the edge (see
Interpolation). A pixel of a cell without LAND has no
surface.
The layers then change it in their order:
| Layer | Reads the surface | Changes it |
|---|---|---|
| Objects | An object shows where it rises above the surface, less a tolerance of 32 units | Raised to the object where a pixel shows it: a face in colormap or texture, an edge in wireframe |
| Lighting | Its contact occlusion measures the sky each pixel sees, see Lighting | No |
| Water | A pixel is tinted where the surface lies below its cell’s water height | No |
| Lights | A glow shows where the surface lies under its light, see Lights | No |
The tolerance (ObjectRasterizer.GroundTolerance) keeps the objects laid on the ground: a road
piece follows the LAND only roughly. Measured on Tamriel’s 5,500 road pieces against the bilinear
terrain, 5.3 % of their vertices lie more than 32 units under it, and 0.4 % of the pieces have
half their vertices there. A face less than 32 units under the terrain shows, but leaves the
surface at the terrain’s height.
Without --objects, the surface is the terrain: the water tints by the depth of the ground, and only
the ground covers a light.
Region planes
The surface is one of the planes a region’s layers pass each other (RegionPlanes, in Canvas/):
| Plane | Written by | Read by |
|---|---|---|
Surface | The renderer (the terrain), then the objects layer (raised) | The objects layer, the lighting layer, the water layer, the lights layer |
PlacedWater | The objects layer, when the region shows a water shape | The water layer |
BlendedObjects | The objects layer, when the region shows a blended shape | The blended objects layer, then the lights layer |
Covered | The objects layer and the grass tufts, where they paint a pixel | The background, which paints its colors only elsewhere |
Normals | The objects layer where it paints a pixel, then the background on the ground it leaves | The lighting layer |
Relief | The objects layer, the broad relief and curvature of the surface it raises; then the background, the ground’s, where none is written | The lighting layer |
Emission | The objects layer, where it paints a pixel | The emissive layer |
Normals and Relief exist only on a lit map, with --hillshade: the renderer rents them when a
layer reads Normals, every pixel without a normal, which the lighting layer leaves as it is. Each
level of a map drawn with levels holds a copy of the plane, so a normal takes four bytes
(PackedNormal): its east and north as halves, its up recomputed, as it always faces up. Emission
exists only with --objects=texture: three bytes per pixel, black for a pixel that emits nothing.
The background marks its pixels pending and resolves them when it paints its colors, since no layer
reads either plane before: on the ground of a map with objects and textures, each would otherwise be
computed twice and written over.
MapRegionRenderer owns the planes of the region it draws. It rents the surface and the placed water
from pools kept for the regions (RegionPools), and gives them back once the region is drawn. The
normals and the relief, the objects’ depth, slope and cut, the covered pixels, and the ground’s relief
under the grass, come from the same pools. A pool keeps an array at the length a region asked for: a grid block and its margin
is past a power of two, and rounding it up would make each array half as long again. With
levels, each level draws over a copy of the background’s planes, given back once that
level is drawn, but for Relief, which level 0 writes: the levels share it.
Each layer declares the planes it writes (MapLayer.Produces) and reads (MapLayer.Consumes).
MapLayers.PrepareAsync refuses an order where a layer reads a plane that a layer above it writes:
it would read the plane before it is written. A plane that no layer writes is read as the renderer
leaves it, so the water layer runs without the objects layer and reads the terrain.
Lighting
With --hillshade, the lighting layer (LightingLayer) lights the map once, after the objects and
before the water: each pixel is multiplied by the map’s one formula on the normal of what it shows,
see Map shading. The layers under it don’t
shade their colors: they leave each pixel’s normal and cartographic terms in the
region planes.
| What the pixel shows | Normal | Cartographic terms |
|---|---|---|
LAND (raster-records) | The VHGT slope, bent by the landscape textures’ normal maps where the pattern is drawn, see Hillshade | Broad relief and curvature, of the surface with --objects |
Terrain LOD (lod) | The tile’s _n.dds texel, see Hillshade | None |
| A grass tuft | The ground’s under it; its color is multiplied by 0.8 only | The ground’s |
| An opaque object face | Its vertex normals blended at the pixel, bent by its normal map in texture mode (see Texture mode) and by a projected material, else its face’s, turned up when it faces down | The surface’s, see Hillshade |
An effect face, a wireframe edge, a pixel without LAND | None: left as drawn | None |
Then the contact occlusion darkens a pixel by the sky its surface doesn’t see within 64 units around it: the foot of a wall, the gap between two rocks, a hollow. A plane, a slope or a ridge sees the whole sky over its tangent plane and keeps its light. It reads the surface, so a region is drawn 64 units wider, see Pipeline. Its radius, directions and weight are in Contact occlusion.
The blended shapes can’t leave a normal: what lies under them shows through. They are lit as they are drawn, by the same formula on their normals, without cartographic terms or contact occlusion.
Limits:
- A wall or a house casts no shadow: its foot darkens on every side the same, whatever the light. Only the relief casts one, see Cast shadows.
- With grass tufts that blend (see Grass tufts), a tuft takes the ground’s normal with the grain of its normal maps; tufts that don’t blend take it without.
- In the cells
--levelscuts, the broad relief and the curvature read theLANDalone: under a vault, meshes enter them at no level, see Surface relief. - In
wireframe, the objects aren’t lit and don’t enter the relief: the ground keeps its own.
Hillshade hour
By default the map is lit from the north-west, 45 degrees above the horizon, the usual convention for
shaded relief maps. --hillshade-hour picks another light from a few presets, for how the map reads,
not to simulate the game’s sky: the weather and the climate aren’t read. It needs --hillshade. The
light (MapLighting.At) is the one the lighting layer lights the map by.
Without --hillshade, the map has no light: nothing is shaded, neither the ground, the LOD tiles,
the objects nor the grass tufts.
--hillshade-hour | Light from | Elevation | Tint |
|---|---|---|---|
| none | North-west | 45 degrees | None |
sunrise | East | 20 degrees | None |
midday | South | 65 degrees | None |
sunset | West | 20 degrees | None |
midnight | North-east | 35 degrees | Red x 0.55, green x 0.62, blue x 0.85 |
The angles and the tint are style choices. Flat ground keeps its color under every light; the
night tint then darkens and cools the whole map (LightTintLayer, see Layers).
Limits:
- A low sun brightens the slopes facing it up to the bound of the map’s formula, x 1.35: a whole mountain side reaches it.
middaylights from the south: the north slopes, steep in the terrain LOD, fall in shade, and the map is darker than with the default light.
Layers
A layer (Pipelines/Maps/Layers/, in a folder of its own) declares what it reads in the plugins,
then changes a region’s pixels in place from the region’s projection and the worldspace’s data. It goes through three
stages, each a type of its own, so what a stage computes exists only once that stage has run:
| Stage | Type | Built by | Holds |
|---|---|---|---|
| Options | MapLayer record | MapLayers.From | What it reads, its label in the manifest |
| Run | ILayerRun | PrepareAsync, once per run, after the plugins are read, with the archives | The objects: the meshes to read, the texture colors read so far |
| Map | ILayerDrawer | ForMapAsync, once per map, before its first region | The roads’ and the lights’ reach; the objects’ models, instances, index and levels |
The drawer draws each region of its map (Apply) and gives the renderer its margin and its levels.
Adding a layer is a record, its WorldspaceMapReads flag if it reads something new, its option,
and its place in MapLayers.From. Its base follows what it keeps:
StatelessLayerkeeps nothing: it is its own run and its own drawer.PerMapLayercomputes something once per map: it is its own run, and itsForMapAsyncreturns anILayerDrawerthat holds what it computed.MapLayerwith a run of its own keeps something across the maps of the run, as the objects layer does with the textures it has read.
A layer draws an object in every region its shape reaches. The roads and the lights look for the objects of the cells under the region, widened by how far past its own cell an object of the map reaches, measured once per map. The objects layer lists each object in every cell its box covers instead.
A layer never changes a transparent pixel: where the background draws nothing, the map stays transparent whatever the layers, so the parts of a map left empty can be skipped without changing it.
| Order | Layer | Option | Reads in the plugins |
|---|---|---|---|
| 1 | Objects (ObjectsLayer) | --objects | With --projected-materials, every MATO; LAND VHGT; exterior REFR NAME, DATA, XSCL, XPRM and header flags, their bases’ model and Is Marker flag; with --levels, every exterior NAVM NVNM vertex and triangle; then the NIF models and, in colormap and texture modes, their diffuse textures |
| 2 | Lighting (LightingLayer) | --hillshade | LAND VHGT |
| 3 | Water (WaterLayer) | --water | LAND VHGT, CELL XCLW and DATA, WRLD DNAM |
| 4 | Blended objects (BlendedObjectsLayer) | --objects | Nothing more |
| 5 | Roads (RoadsLayer) | --roads | NAVM NVNM, exterior REFR NAME, DATA, XSCL, their bases’ MODL and OBND |
| 6 | Light tint (LightTintLayer) | --hillshade-hour midnight | Nothing more |
| 7 | Emissive (EmissiveLayer) | --objects=texture | Nothing more |
| 8 | Lights (LightsLayer) | --lights | Exterior REFR NAME, DATA, XRDS, their LIGH bases’ DATA |
| 9 | Cell grid (CellGridLayer) | --cell-grid | Exterior CELL EDID and XCLC, located from their group |
| 10 | Land mask (LandMaskLayer) | With a crop | Nothing more |
The lighting comes after the objects, whose normals it reads, see Lighting. The water comes after the lighting, so it tints what is already lit, and after the objects, so it tints what lies under it, ground or object, and leaves dry what rises above it. The objects’ blended shapes come after the water, so a waterfall body mixes over its pool instead of being tinted under it, see Blending. These constraints are checked from what each layer declares, see Region planes. The roads come after them, so a road stays visible under the clutter along it and bridges show over the rivers. When the objects, the roads or the lights are on, the references are read once and serve them all. The light tint comes after them, so the night darkens everything the world shows. What the objects emit and the lights come after the tint, so the night darkens the map but not its windows or its lights, and before the cell grid, whose lines and labels keep their colors.
The land mask is last: it clears every pixel outside the kept LAND cells, whatever the layers
below drew there. It runs when the plan has a crop, with --crop-to-playable or
with --parent-lod.
Objects
--objects draws every exterior object placed in the worldspace, seen from above, from its NIF
model: buildings, walls, rocks, mountains, trees, furniture, clutter. Where two objects cover a
pixel, the higher surface wins. The code is in Pipelines/Maps/Objects/, wired by ObjectsLayer.
| Option | Mode | Reads the textures | Draws |
|---|---|---|---|
--objects, --objects=colormap | colormap | Yes | Each face filled with the mean color of its diffuse texture (color map), shaded by the map’s light |
--objects=texture | texture | Yes | Each face mapped with its diffuse texture through its UVs, shaded by the map’s light |
--objects=wireframe | wireframe | No | The edges seen from above in one dark color; the ground shows between them |
The value is optional, so --objects takes the next argument as its mode: write
--objects=wireframe, or put --objects after the data directory. --objects Data -o out is
refused because Data is not a mode.
It reads the same references as the road pieces (WorldspaceMapReads.Placements), merged and
filtered the same way (see Roads), with their DATA height and rotations, their XPRM
and their header flags, then each base’s model path and Is Marker flag. Markers, primitives,
references hidden from the local map and objects without a model are left out: the rules are in
export heuristics. Each model is placed
by its reference’s position, scale and three rotations, see
assumptions.
Models. For each map, the models its references place are extracted from the archives and
decoded in parallel, once each whatever the number of references: every BSTriShape under the
root, each node’s transform applied, see NIF format.
The geometry is released with the map. A map drawn with --parent-lod decodes the parent’s
models too: an object outside the child’s cells can reach over them.
Drawing. An index of the cells each object’s box covers finds the objects of a region, and an object whose box holds no pixel center is skipped, since it would draw nothing. A depth buffer per region keeps the highest surface of each pixel, starting from the surface: a rock half buried in the ground shows only what rises above it. Bands of rows are drawn in parallel, objects in the order of the references, so the image is the same however the map is cut.
colormap: each face takes the color of its shape’s diffuse texture, its color map: the mean of its first mip level of 64 texels a side or less, weighted by alpha, toned like the terrain (see Colors). Each texture is read once per run, whatever the maps that show it. With--hillshade, each pixel of a face is lit by the vertex normals blended there, as the game lights a model, in the same pass and by the same formula as the ground, see Lighting, so objects and ground read together. A face whose shape has no normals is lit by its slope. Without--hillshade, the faces aren’t shaded. A shape without a texture, or whose texture is missing or unreadable, is gray.texture: each pixel of a face takes its diffuse texture at the pixel’s UVs, see Texture mode. It is toned, tinted and shaded as incolormap.wireframe: the faces fill the depth buffer without color, then each edge is drawn where it is at the height of the top surface, within half a pixel of that surface’s slope. Edges hidden under a higher face or under the terrain, and the undersides of objects, are not drawn. Inside the faces, the ground shows, and so does the water over it.
In colormap and texture, a shape whose shader sets Vertex_Colors is tinted by its vertex
colors, blended across each face, as the game multiplies its diffuse by them (see
BSTriShape). Models bake their shading
into them: the hollows of rocks and mountains darken, a waterfall body turns blue-green. Most vanilla
shapes carry them, so the objects are darker than their textures alone.
The shapes a lighting shader draws are painted, and those an effect shader draws, see Effect
shaders. A shape whose shader is a water shader (BSWaterShaderProperty) is a
water surface: it isn’t painted, and with --water the water layer tints what lies under
it. Shapes without a shader and hidden blocks are left out, see
export heuristics.
Limits:
- An object less than 32 units under the terrain still shows: a buried stone that close to the ground is drawn. See Surface.
- A skinned shape, such as a tree, a banner or a flag, is drawn in the pose its file stores, not
swaying.
NiTriShape,NiTriStrips, particles and billboards aren’t drawn, see not implemented. - In
colormap, leaves are alpha-tested cards drawn opaque: a tree is a blob of its leaves’ mean color, and a face has one color, no pattern. - No snow from
DNAMmaterials. The alternate textures of a base (MODS) or aTXSTaren’t read. - The alpha test reads the texel’s alpha alone, not the vertex alpha or the material
Alpha, see not implemented. - In
wireframe, below about 64 pixels per cell most edges are shorter than a pixel: forests and rocks become dark patches. The mode reads at the scales where a triangle covers several pixels.
Blending
A shape whose NiAlphaProperty sets Alpha Blend (flag 0x0001) mixes with what lies under it, in
colormap and texture, as the game draws it. Its opacity is the product of:
| Factor | From | In colormap |
|---|---|---|
| Texel alpha | The diffuse texture at the pixel’s UVs | 1 |
| Vertex alpha | The vertex colors’ alpha, blended across the face, when the shader sets Vertex_Alpha | Yes |
| Material alpha | The lighting shader’s Alpha field | Yes |
The product is clamped to 0 to 1. The shape’s color, shaded and tinted as an opaque one, then goes
through the property’s blend modes: color × source factor + pixel × destination factor, clamped,
with the factors of nif.xml’s AlphaFunction. Most vanilla shapes blend over (SRC_ALPHA,
INV_SRC_ALPHA); a few add (SRC_ALPHA, ONE) or multiply (ZERO, SRC_COLOR).
The opaque shapes are drawn first. Each blended face then leaves a fragment over every pixel where it
rises above the top opaque surface, without raising it: the water layer still tints the
ground under a waterfall body. Once the water is drawn, BlendedObjectsLayer mixes the fragments of
each pixel from the lowest up, as the game draws its blended shapes back to front; faces at one height
mix in the order of the references, then of their triangles. The image is the same however the map is
cut. The rules are in assumptions.
The waterfall bodies of Markarth and Whiterun (markarthwaterfallcliff*, mrkkeepwaterfall,
wrterwind01waterfall01) blend at a mean vertex alpha of 80 to 216 out of 255: the rock under them
shows through.
Limits:
- In
colormap, the texture’s alpha isn’t read: a blended shape is as opaque as its vertex and material alpha. - A blended face under the water is mixed over it, not tinted by it.
- The game’s waterfall bodies
effects\fxwaterfallbody*have noNiAlphaProperty: they stay opaque, dark with their vertex colors. Their foam, an effect shader shape, lightens them; their spray, a particle system, isn’t drawn. - A pixel center exactly on an edge shared by two triangles belongs to both, so a blended shape mixes there twice: at 0.5 opacity, 0.25 of what lies under it comes through instead of 0.5. A mod’s blended mesh set exactly on the pixel grid shows a line one pixel wide. See below why this stays.
The rasterizer keeps edges inclusive because the case doesn’t occur on the vanilla data: of about 100 million blended fragments, over 29 exports from 32 to 4096 pixels per cell, none has its center on an edge. The edge has to fall on the center to the bit. A top-left fill rule would give each such center to one triangle, but it applies to every face: it moves pixels of the other faces on these same exports, and it can leave a center to neither triangle when their rounding disagrees.
Effect shaders
A shape whose shader is a BSEffectShaderProperty (foam, falling water, mist, clouds, glows) is
drawn in colormap and texture, as NifSkope’s Skyrim effect shader computes it, then blended by
its NiAlphaProperty like any shape (see Blending); without one, it is opaque. The
fields are listed in NIF format.
| Output | Computed from |
|---|---|
| Color | Texture × vertex colors × Base Color, all × Base Color Scale |
Color, with Greyscale_To_PaletteColor | The palette (Greyscale Texture) at u = the texture’s green, v = vertex green × falloff × Base Color red; × Base Color Scale |
| Alpha | Texture alpha × vertex alpha × falloff × Base Color alpha² |
Alpha, with Greyscale_To_PaletteAlpha | The palette’s alpha at u = the texture’s alpha, v = vertex alpha × falloff × Base Color alpha² |
Falloff, with Use_Falloff | The stop opacity at the stop angle, the start opacity at the start angle, smooth between; the angle is the face’s with the view straight down |
Soft fade, with Soft_Effect | Alpha × height above the opaque surface / Soft Falloff Depth, at most 1; blended shapes only |
An effect shape isn’t shaded by the map’s light: its colors are its own. In texture, a texture
that gives a palette its u is read untoned, since the tone would move it along the palette; the
palette is toned, read whole up to 1,024 texels a side.
Glows and fire add to the map (SRC_ALPHA, ONE). The foam of the waterfalls, rapids and creeks (FXWhiteWater01) reads
both in a GradWhiteWater* gradient.
Limits:
- In
colormap, the palettes aren’t read: an effect shape takes its texture’s mean, times its vertex colors and base color. - The UVs don’t scroll: the foam is frozen as the file stores it.
- The soft fade is an assumption. A soft falloff depth of 1,024 or more isn’t drawn, see map objects.
- Lighting influence and refraction aren’t read, see not implemented.
Texture mode
For each map, the shapes on its ground ask their diffuse texture at the side that gives one texel per pixel: the map’s pixels per unit, times the largest scale among the shape’s instances on the map, over the texture’s repeats per unit along the shape (the square root of its UV area over its area), rounded up to a power of two. The DDS is read on its first mip level whose sides are at most that, toned like the terrain, then halved down to one texel, colors weighted by alpha. A texture is read once per run, and read again only when a later map needs it larger and the run hasn’t read its first level yet.
Each face then picks one level of that chain, as anisotropic filtering does: the texels per pixel
along the least stretched pixel axis, or along the most stretched one over 16, whichever is more.
Without this, a steep face such as a leaf card seen from above would read a level where its alpha
has averaged out. At each pixel center, the UVs interpolated on the face (uv × UV Scale + UV Offset, see NIF format) sample the level
with --interpolation (bilinear by default, see Interpolation), wrapped or clamped by the shader’s clamp mode. A texel the shape’s alpha test discards
leaves the pixel and its depth as they are: what lies under shows through the leaves. A shape
without UVs takes the last level, the texture’s mean.
With --hillshade, a shape’s normal map, slot 1 of its texture set, bends the vertex normal at each
pixel, as the game’s lighting shader does: the texel’s red runs along the vertex bitangent, its green
along the tangent, its blue along the normal. The map keeps half the texel’s tilt, see
Map shading. The map is read untoned at the same side as the
diffuse, every texel weighed alike (its alpha is the gloss), and sampled at its own level for the
face, so its pattern flattens as the map zooms out, as the landscape textures’ do. A shape without
tangents or UVs, a model-space normal map, or a normal map missing from the archives leaves the
vertex normal as it is; a missing one is logged with the missing textures. See
Object normal maps. colormap reads no
normal map: it draws no pattern.
Limits:
- A shape’s texture is read for its average repeats per unit: a part of it mapped finer, such as a small island of an atlas, is read blurred.
- Alpha-tested plants are mostly transparent: at 256 pixels per cell a shrub or a flower shows a
few pixels of leaves where
colormapshows a solid blob. That is what their textures hold: the vanilla shrubs and flowers of WhiterunWorld are 9 to 35 % opaque. - A part of a normal map mapped finer than the shape’s average, as for the diffuse, reads flattened.
Projected materials
--projected-materials covers the statics with the snow, ash or moss their STAT names in DNAM: a
MATO, a directional material. It needs --objects in colormap or texture mode, and works with or
without --hillshade. It does what the game’s lighting shader does for a single pass material:
| Step | What the map does |
|---|---|
| How much shows | From how far the pixel’s normal faces up, its vertex color’s alpha, the MATO’s falloff and the noise, under the STAT’s Max Angle |
| From where | Straight above in the world, whatever the object’s rotation: it lies on what faces up where the object stands |
| Color | ProjectedDiffuse.dds times the MATO’s Single Pass Color, between the texture and the vertex colors, so they tint it too |
Normal, texture mode | ProjectedNormal.dds and ProjectedNormalDetail.dds blended into the surface’s normal, at half tilt as an object’s normal map |
The four textures under textures\effects\ are read once per run, in world coordinates seen from
above: a covered object is the same however the map is cut. colormap shows no pattern: it reads the
diffuse as its mean, and no normal, but keeps the noise. The formula and its sources are in
Projected materials.
The covered statics match the LAND’s snow without a tuning constant: the colors of the
vanilla snow materials give about the tone of its snow textures once toned.
Limits:
- A multipass material, which draws a second geometry with textures of its own (glaciers, ice), leaves the object bare, see not implemented.
- A
MATOthat is missing or has no usableDATAleaves the object bare: logged in one warning, listed with--verbose. A missing texture goes without it: no noise, the color alone, no bending. - Skinned shapes and parallax, face tint, multilayer parallax and sparkle snow shaders stay bare, as in the shader.
- Nothing ties the coverage to what lies over an object: snow shows under a roof where the shader would show it, unless the model’s vertex alpha holds it back.
Emissive
With --objects=texture, the map adds what the opaque shapes emit: embers, windows, candles. The other
modes emit nothing, as a glow map lies on the shape’s UVs. It works at any hour, with or without
--hillshade, and shows most at night. Seen from above, the map shows little of a window on its wall. The game’s
shader adds the emission to the light on the pixel’s color, so a pixel emits its color, vertex colors
and projected material included, times the shape’s Emissive Color and Emissive Multiple. On a
Glow shader the glow map, slot 2 of its texture set, weighs that per channel; on another shader the
whole shape emits, whatever its slot 2 holds.
The objects layer leaves this in the Emission plane. The emissive layer adds it over the tint, so
the night doesn’t darken it, less what the blended shapes above the pixel hold back. A glow map missing
from the archives leaves its shape dark, and is logged with the other textures.
Limits, see not implemented and assumptions:
- A blended shape emits nothing on the map.
External_Emittanceis ignored: the game scales such a shape, a window among others, by the light or region its reference names inXEMI. The map draws it at its own color, at every hour.
Decals
The shapes their lighting shader marks Decal or Dynamic_Decal, layers of moss, snow or paving laid
over rocks and walls, are drawn closer to how the game does: in a pass over the opaque faces, showing
over what they lie on even a hair under it, without raising the surface. Each stays lit by its own
normal. See export heuristics. The wireframe mode
draws them as any face.
Levels
Seen from above, a cave is its rock shell: the back of its ceiling hides the floor you walk on.
--levels cuts that ceiling. In the cells whose floor lies under a vault, the objects layer leaves
out every face more than 160 units above the walkable floor under each pixel, so the map shows the
floor, its paths and what stands on it. The other cells are drawn as without --levels. It needs
--objects. The code is in Pipelines/Maps/Levels/.
| Step | Code | Gives |
|---|---|---|
| Floors | FloorField | Per 32-unit square: the heights of the navmesh over it, merged into floors at least 128 units apart; the LAND height where there is no navmesh; elsewhere the floors of the nearest square that has some |
| Vaults | VaultMap | The cells whose navmesh lies under faces with no face up above them, the back of a shell |
| Stops | LevelStops | The altitudes where a floor passes under another, each one a level under the top one |
| Cut | LevelCut | Per pixel, the floor the level shows plus 160 where the cell is cut, no limit elsewhere |
MapLevelsBuilder computes the floors, the vaults and the stops once per map, before its first region. The
floors cover the cut cells and one cell around them, so a floor near their edge comes from the
navmesh past it. The cut of a pixel comes from its world position alone: a pixel gets the same cut
whatever the region that draws it. A face above the cut at a pixel is not there: it is not drawn
and hides nothing under it. The same holds for an edge in wireframe mode and for a water surface.
The map written is level 0, which shows each square’s top floor. Each stop gives one level more:
level k shows, at each square, its highest floor less than 64 units above the k-th stop, else its
lowest. Every level is written next to level 0, holding only what differs from it (see
Level files). A map without navmesh, or without a cell under a vault, is drawn as
without --levels and has no level file. The rules and their thresholds are in
export heuristics; the navmesh as the
walkable floor and the faces’ winding are
assumptions.
Per region, the renderer first asks which levels change, then draws the background once. A level under which no pixel of the region, margin included, changes floor is not drawn: it reuses level 0’s pixels. Where no level changes, level 0 draws like a map of one level, over the background itself. Otherwise, each level starts from a copy of the background and of its planes, then applies every layer: the water layer reads the surface the objects raise, so it is drawn again at each level.
On the vanilla SE load order, 25 of the 45 maps cut at least one cell. Most cave worldspaces
(Blackreach, DLC1DarkfallPassageWorld) cut every cell, Tamriel 5 of 5,644, the cities none. The
counts don’t depend on --pixels-per-cell.
A map of one level with cut cells writes no level file, but its level 0 changes: the cut cells show their floor.
Limitations:
- A cell is cut whole. Where an open cell holds enough navmesh under rock, its mountain is cut too
and the
LANDshows through as a square: on Tamriel, 4 cells west of Solitude and one more. - A one-sided shell over open ground counts as a vault. On DLC2SolstheimWorld, 8 cells cut a dark dome over open ground; the part of the dome outside them stays, as a rectangle.
- No threshold leaves Tamriel’s cells out: they have 5.7 % to 10.7 % of their navmesh under a vault, the cut cells of the cave worldspaces as little as 7.1 %. See export heuristics.
- The
LANDis never cut. A worldspace whoseLANDlies over its caves shows theLAND.
Water
--water also reads every exterior LAND record’s VHGT heights, in the same pass over the
plugins (WorldspaceMapReads.Heights, CreationEngineFormats LandscapeReader),
33x33 vertices per cell. Datasets/Worldspaces/WorldspaceTerrain.cs joins them with each cell’s water:
| Cell | Water height |
|---|---|
DATA without “Has Water” | None |
“Has Water” and an XCLW height | XCLW, for rivers and lakes |
“Has Water”, XCLW absent or a no-water value | The worldspace’s DNAM default water height, the sea (-14000 on Tamriel) |
A child worldspace whose PNAM sets “Use Land Data” takes its parent’s DNAM. The no-water
values include two that the spec doesn’t list, see
deviations.
A pixel whose surface lies below its cell’s water height is tinted, darker with depth
(WaterLayer): the terrain, or with --objects an object under the water, a wreck or a sunken
rock. A dock or a ship above the water stays dry. With bicubic the shore follows the terrain’s
curve between vertices instead of a straight line.
With --objects, water placed as objects counts too: a pixel under the surface of a shape whose
shader is a BSWaterShaderProperty is tinted as if its cell’s water stood at that height, the
highest of the two winning. It fills the pools, troughs, puddles and tundra streams that no cell
water reaches. Over a pixel without LAND, only a cell’s water is drawn.
It shows Tamriel’s sea, the rivers and lakes (Lake Honrich, the White River, the Eastmarch hot springs) and Solstheim’s sea with its shallows. Limits:
- Water is one flat plane per cell. Where neighbouring cells store different
XCLWheights, the water stops on a straight cell edge, as in Blackreach. - A waterfall body has a lighting shader, not a water shader: the objects layer paints it with its
vertex colors, mixed over the ground when it blends, with its foam over it, see
Effect shaders. Every water body has the same
color: the
WATRwater types aren’t read. - A
LANDwithoutVHGT(183 in vanilla) is flat at the worldspace’sDNAMdefault land height, see assumptions. - Every exterior cell’s heights are held at once.
Roads
--roads paints the roads and trails in one color over the layers below, from two sources:
| Source | Records | Reads |
|---|---|---|
| Navmesh | Each NAVM’s triangles with the “Preferred” bit, the paths the AI prefers | NVNM vertices and triangles (WorldspaceMapReads.Paths) |
| Road pieces | Each exterior REFR of a STAT under landscape\roads\ | REFR NAME, DATA, XSCL (WorldspaceMapReads.Placements), then the base’s MODL and OBND |
The navmesh alone misses roads: the bit covers Tamriel’s network, but only part of a mod’s
(Vominheim marks 3,776 triangles, and its 468 references to vanilla road pieces fill the gaps). Each
road piece is drawn as a stroke with round ends through its OBND box, scaled and turned by its
reference: see road pieces and
assumptions. Which objects count as road
pieces is in export heuristics.
The records are merged over the load order (WorldspacePaths, WorldspacePlacements): the last
version of a NAVM replaces the whole navmesh, and a deleted one removes it. A reference that is
deleted or “Initially Disabled” in its last version isn’t drawn, see
disabled references. Persistent
references count, placed by their DATA position.
The layer fills every shape into one pixel mask, then paints the mask once
(PolygonRasterizer): overlapping triangles don’t darken. A pixel is covered when its center lies
in a shape; a shape too small to hold a pixel center anywhere, inside the image or not, covers
the pixel under its centroid, so trails stay connected at a low resolution. Limits:
- Roads have no outline and one width: a trail is as wide as its navmesh, a road piece half as wide as its box. The color is blended at 35 % over the map, so the relief shows through.
- Bridges are drawn like roads, over the water.
- Only the navmesh triangles are kept in memory.
Lights
--lights adds a glow around each exterior reference whose base is a LIGH: torches, candles,
campfires, forges, street lamps, and the magic and fill lights of caves and the Soul Cairn. It reads
three things from the light:
| Value | Read from |
|---|---|
| Color | The LIGH DATA Color |
| Radius | The LIGH DATA Radius plus the reference’s XRDS, see light radius |
| On or off | The LIGH DATA flag Off by default (0x20), and the reference’s state as for any layer: deleted and initially disabled references aren’t drawn |
The glow falls from the light’s color at its position to nothing at its radius, as the square of
the remaining distance, so most of it stays near the light. It is blended in screen mode
(1 - (1 - map) x (1 - glow)), which only lightens: on a bright map a glow barely shows, on a dark
one it stands out. The layer doesn’t know the hour: it comes after the
night tint, and --hillshade-hour midnight gives the dark map it reads best on.
On the five vanilla masters, 1,680 lights are placed in worldspaces, 559 of them on Tamriel, spread
over about 200 locations (forts, camps, redoubts) with at most a dozen each. The cities are their
own worldspaces: WindhelmWorld has 50, WhiterunWorld 24. A light’s radius plus XRDS has a median of
about 460 units, nine in ten under 1,000. A cell is 4,096 units: a glow is about 2 pixels across at
16 pixels per cell and reads from about 128.
Limits:
- A flame the game draws with particles has its own light only when a
LIGHis placed near it: on vanilla worldspaces, about two thirds of the burning campfires, torches and braziers. The rest have no glow. - A glow is centered on the light, not on the flame it stands for: level designers place a light where it should shine from, often in front of a brazier or a sconce and above it. The median distance from a light to the nearest flame model is 14 units on Tamriel, where campfire lights sit over the fire, but 110 in RiftenWorld and 200 in WhiterunWorld, 25 pixels at 512 pixels per cell.
- A light whose radius plus
XRDSis over 100,000 units isn’t drawn: see data problems. - Falloff Exponent, Fade, FOV and the flicker and pulse effects aren’t read, see not implemented. The glow’s shape is in export heuristics.
Cover
A light shows only where the sky is open over it. The layer reads the surface and the
blended shapes the objects layer leaves, and compares them with the light’s height
(its reference’s DATA Z):
| Where | Covered when | Then |
|---|---|---|
| The light’s own pixel | The surface rises more than 32 units above the light: a roof, a cave ceiling, a tree’s canopy | No glow at all, even past the cover’s edge |
| A pixel of the glow | The surface there rises more than 32 units above the light | That pixel isn’t lit: a glow stops at the edge of a roof above it |
A blended face higher than the light, over its pixel or over a pixel of the glow, dims the glow
there by what it keeps of what lies under it: its destination factor, 1 - alpha for a shape
blended over, while a shape that adds lets all of it through. The faces over one pixel multiply.
A pixel takes the lesser of what leaves the light and what its own faces let through, so a canopy
over both the light and the pixel counts once.
The 32 units (LightCover.Tolerance) leave a light lit inside its lantern or brazier, whose top
rises a little above it. Measured at 256 pixels per cell on the 1,561 vanilla lights placed over
LAND, 32 lie 0 to 32 units under the surface at their pixel, 22 lie 32 to 64 units under it, and
815 more than 64. Without --objects, only the terrain covers a light.
The cover of a light whose glow reaches a region from outside it is read at the light’s pixel alone
(MapRegionRenderer.ProbeAt): the renderer draws that pixel by itself at the level drawn, with the
objects and nothing shown, and keeps it for the other regions the glow reaches. A glow reaches about
4,000 pixels at 4096 pixels per cell: a grid block drawn out to its light would take over 70 times
its pixels on Blackreach, at each of its levels, and most of the map’s memory.
Limits:
- The surface is a height per pixel, with nothing under it: an eave, a porch roof or a tree’s canopy over a light hides all of its glow, though in the game the light spills out from under it. Lights in cave worldspaces, such as Blackreach, are all under the ceiling the objects draw.
- The top of a fixture more than 32 units above its light, such as a street lamp’s cap, stays unlit in the middle of its glow.
- A slope rising more than 32 units above a light isn’t lit, though the light faces it.
Cell grid
--cell-grid draws the grid of the worldspace’s exterior CELL records, labels each cell, and
outlines the LAND cells the map draws: every LAND cell, or only those inside the playable
bounds with --crop-to-playable. A CELL without LAND has its grid line and label too. The
cells are listed from their place under the worldspace’s children group, with their XCLC grid
position and EDID (WorldspaceMapReads.CellNames). A CELL override without EDID or XCLC
keeps the earlier one.
| Mark | Drawn as |
|---|---|
Line between two cells, either a CELL record | Black blended at 35 %, on the west or south border of a cell |
Edge between a LAND cell and a cell without LAND | Black blended at 80 %, inside the LAND cell |
| Label | x,y, then (EditorID) on the lines below, white with a black shadow, in the north-west corner |
A line is one pixel wide per 32 pixels of cell, at least one: 1 pixel at 32 pixels per cell, 4 at 128. The label’s font is 5x7 pixels, scaled up by one per 128 pixels of cell. It draws capitals only and wraps the EditorID at the cell’s width. A label never spills into the next cell.
A pixel belongs to the cell under its center, so the lines and labels fall at the same place however the map is cut into regions or tiles. The layer comes after the roads, so the grid shows over every layer. Limits:
- A cell narrower than 4 pixels would be mostly lines, so the layer draws nothing on that map and
logs it at debug level (
--verbose). Below 32 pixels per cell, the lines are drawn without labels. Raise--pixels-per-cell, or pick a finer--level. - A child drawn with
--parent-lodshows its own cells and the parent’s cells inside its bounds alike. Where both have aCELLat the same grid position, the child’s label wins.
Output formats
--format picks how each map is written. All three hold the same image. --png-compression sets the
deflate level of every PNG written, 4 by default: lower writes faster and larger files.
--format | Writes | For |
|---|---|---|
plain-png (default) | <output-directory>/<EditorID>.png | Viewing the whole map at once |
grid | <output-directory>/<EditorID>/<z>/<x>/<y>.png and tiles.json, <EditorID>.json and maps.json | Leaflet, OpenLayers or any viewer of XYZ tiles |
pmtiles | <output-directory>/<EditorID>.pmtiles, <EditorID>.json and maps.json | The grid’s tiles in one file, for large maps, see PMTiles output |
With grid and pmtiles, each map gets a manifest, <EditorID>.json, next to its tiles, and
maps.json lists the maps of the run, replacing any earlier one. They follow the
map export format, which the generated site reads. The manifest adds
what tiles.json doesn’t hold: the worldspace’s name, parent and flags, the plugins that carry
it, the load order and how the map was drawn. To list these plugins, the plugins’ pass also lists
every exterior CELL under its worldspace (WorldspaceMapReads.Contributors).
Grid output
The grid is a pyramid of 256x256 tiles (MapTilePyramid). The highest zoom holds the image at
full size; each zoom below halves it, down to zoom 0, where the whole image fits in one tile. x
counts columns from the left edge and y rows from the top. Tiles past the image’s right or bottom
edge are transparent where the image ends. A tile with no visible pixel is not written: a viewer
shows a missing tile as empty, which is what it holds. Each zoom is built from the tiles of the zoom
above as they are written, never from the whole image.
tiles.json describes the grid:
| Property | Meaning |
|---|---|
editorId, formId | The worldspace |
width, height | The full-size image, in pixels |
tileSize | 256 |
minZoom, maxZoom | 0, and the zoom at full size |
emptyTilesOmitted | true: a fully transparent tile is not written |
pixelsPerCell | The width of a cell at full size, in pixels |
lodLevel | The terrain LOD level drawn. Only with the lod background |
worldBounds | west, north, east, south: the image’s edges in game units (X east, Y north) |
language | The language of the names. Only with --markers |
markerGroups | The groups of markers on the image, see Markers. Only with --markers |
levelOf, level, altitude | The map a level is drawn over, the level’s index and its stop in game units. Only in a level’s tiles.json |
A pixel at full size spans (east - west) / width game units. With Leaflet, use CRS.Simple
and a tile layer on <EditorID>/{z}/{x}/{y}.png with maxNativeZoom set to maxZoom.
PMTiles output
--format pmtiles writes the tiles of the grid into one
PMTiles v3 archive,
<EditorID>.pmtiles, with tiles.json as the archive’s metadata. The tiles, their z/x/y and
the JSON are those of grid, byte for byte. A grid of a large map is millions of small files:
each costs the file system an inode and a directory entry, and on a hard disk a seek. The archive
is written from start to end instead.
Tamriel cropped to the playable area at 512 pixels per cell (45,110 tiles, --water), written to
an ext4 hard disk, timed from the command’s start to a sync after it:
--format | Time | Size |
|---|---|---|
pmtiles | 30 s | 830 MB, one file |
grid | 57 s | 931 MB, 45,110 files |
The same archive takes about 26 s on an NVMe SSD: on the hard disk, pmtiles costs little more
than the drawing. The gap grows with the tile count, once the page cache no longer absorbs the
grid’s writes.
The archive is written in one pass (PmTilesSink, PmTiles/PmTilesWriter):
- The archive is written as
<EditorID>.pmtiles.part. Its first 16 KiB are left as zeros, for the header and the root directory. - Each block’s tiles are encoded in parallel, then appended in the order the pyramid emits them. A tile identical to one already written (by SHA-256) is not written again: its entry points at the first one.
- Once the map is drawn, the entries are sorted by TileId, the leaf directories and the gzipped metadata are appended, then the header and the root directory are written at the start.
- The
.partfile is renamed<EditorID>.pmtiles, replacing the archive of an earlier run.
| Header field | Value |
|---|---|
| Tile type | PNG |
| Tile compression | None: a PNG is already compressed |
| Internal compression | gzip, for the directories and the metadata |
| Clustered | No: tiles are in the order they are drawn, not in TileId order |
| Min zoom, max zoom | minZoom and maxZoom of tiles.json |
| Bounds, center | Where the image sits on zoom 0’s Web Mercator tile; the map isn’t georeferenced |
The root directory holds every entry when it fits in the first 16 KiB; otherwise it points at leaf directories of at least 4,096 entries, grown until it fits. A Tamriel at 512 pixels per cell has 45,110 tiles and 40,351 entries in about 10 leaves.
Limits:
- A run cut short (a crash, Ctrl+C) leaves its
.partfile, with no header: no reader opens it. The archive of the last complete run stays in place. Run the command again: it overwrites the.partfile. - The entries and the hashes of the tiles stay in memory until the end: about 100 bytes a tile, some 400 MB for 4 million tiles.
To read an archive:
| Reader | How |
|---|---|
| Leaflet | pmtiles.leafletRasterLayer(new pmtiles.PMTiles(url), options) of the pmtiles library, with a grid layer’s options; getMetadata() returns tiles.json |
| A local file in a browser | new pmtiles.FileSource(file) on a file input: the browser reads only the ranges it needs |
| A server | It must answer HTTP Range requests (nginx, caddy file-server, or serve <folder> [port] in the dev shell). Python’s http.server doesn’t |
pmtiles CLI | pmtiles serve <dir> serves /<EditorID>/{z}/{x}/{y}.png to any XYZ viewer; pmtiles verify checks an archive |
| QGIS | Not directly: GDAL reads vector PMTiles only. Add pmtiles serve as an XYZ connection. QGIS shows it in Web Mercator, not in game units |
tool/map-viewer.html opens both a grid folder and an archive, by URL or by file input.
Level files
With --levels, a map with stops writes each level next to level 0. A level is a layer
of tiles meant to be stacked over level 0: it holds only the tiles whose pixels differ from level
0’s tile at the same z/x/y, at every zoom. Where it has no tile, a viewer shows level 0, which
is right there since nothing changes.
--format | Level k | Missing tile |
|---|---|---|
plain-png | <EditorID>.level-<k>.png, the whole image: a PNG has no tile to leave out | None |
grid | <EditorID>.level-<k>/<z>/<x>/<y>.png, with its tiles.json | Left out, as a transparent tile is |
pmtiles | <EditorID>.level-<k>.pmtiles, its tiles.json as metadata | Not in the archive |
A level’s tiles.json is level 0’s with levelOf, level and altitude added (see
Grid output). A level equal to level 0 everywhere still gets its folder or archive,
with no tile. The map’s manifest lists each level with its stop and its path, see
Map levels.
The regions are drawn once and handed to each level’s sink in turn, level 0 first. Level 0’s sink
keeps the tiles the region completes, transparent ones included, until every level has written
the region (LevelTileFilter). Every pyramid gets the same regions, so each emits the same z/x/y
at the same step, and the comparison holds at every zoom. A level tile byte-equal to level 0’s is
neither encoded nor written.
Stacking is exact only where a level is opaque wherever level 0 is: a pixel transparent in the level but opaque in level 0 would show level 0 through it. A worldspace map is opaque wherever its background is, at every level, so the writer checks it and stops with an error naming the tile if a level breaks it. A map without background, such as an interior, would break it wherever the cut empties a pixel: it would need to paint such a pixel with an opaque void color first. The worldspace maps don’t need it.
Markers
With --markers, tiles.json and the map manifest list what a viewer places on the image, with
--format grid or pmtiles only: a plain PNG has nowhere to put it. Nothing is drawn: a viewer
places each marker from its pixel position. The value picks the kinds of marker, comma-separated;
without a value every kind is listed. Each kind is one group of markerGroups, with its name,
color and whether a viewer shows it at first, see
Marker groups.
| Kind | Records | Marker placed at | Marker data |
|---|---|---|---|
location | Each exterior REFR with XMRK: its FNAM flags, FULL name and TNAM type | Its DATA position | The type’s name, and the Visible and Can travel to flags |
books | Each exterior REFR whose NAME is a BOOK: the book’s FULL title | The REFR’s DATA position | None |
The plugins’ pass decodes every exterior REFR for the kinds asked. Each record’s last version
wins, see Load order and merging. A location marker whose last
version is deleted, or a REFR that no longer has XMRK, is removed. A marker whose last version
is “Initially Disabled” stays, with disabled set: a quest enables it, such as the Dark
Brotherhood Sanctuary, and a viewer draws it fainter. A book follows the same rule, a deleted
REFR left off. A book is listed once per REFR: its formId is the BOOK, so a book lying in
several places appears several times. Only the books lying in the world are listed: those in a
container or on an NPC have no position. A book’s content, image and page are not part of the list.
The names are resolved in --language (english by default), against the string tables of the
plugin that wrote the record’s last version. A map lists the markers of its worldspace whose
position falls on the image, and with --parent-lod its parent’s too. It adds those of each
descendant placed by its ONAM, see Child worldspaces.
With --levels, a map with stops gives each marker the levels whose floor under it is
the floor nearest its height (levels). The floor is read once per map from the level set the
objects layer built for the drawing, so a marker’s levels and the tiles agree.
tiles.json leaves out a property that is null; a map manifest writes it as null.
A kind is a MapMarkerSource in Pipelines/Maps/Markers/, one file per kind, listed in
MapMarkerSources. The source says what it reads in the plugins (Reads, Datasets), builds its
markers with their data once the plugins are read, and gives its group’s id, name, color and
default visibility. MapMarkerCatalog resolves the names, places the markers on each image and
writes the groups; the options, the manifest and the viewers need no change for a new kind.
Limits:
- A name is the record’s
FULLonly: no script or quest changes it. - A book with no
FULLis listed without a name. - A child’s
ONAMis taken as is. FallowstoneCaveWorldEnd is built in Tamriel’s coordinates, but itsONAMgathers it near Whiterun: Giant’s Grove is listed there, see the assumption.
Output and logging
Each map logs how it was drawn at debug level. A problem in the data is counted in one warning per
map or per run and listed with --verbose, see
data problems. The run ends with
N of M worldspace map(s) written to <dir>., M counting only the worldspaces named by
--worldspace when given. A run that writes no map, or a --worldspace that names no worldspace,
is an error.
While a map is written, a status line under the log gives its progress, redrawn twice a second:
Tamriel [skyrim.esm:00003C]: 14.1 of 35.4 Gpx (40.0%), 39.3 Mpx/s, 5m39s, ~8m left
It reads: pixels written of the total, the speed over the last 10 seconds, the time elapsed, and the time left at the average speed so far. The transparent regions outside the worldspace’s cells count as written pixels and take almost no time. The status line appears only on a terminal and is erased once the map is written, see Logging. A large map then logs its summary:
[INFO] Tamriel [skyrim.esm:00003C]: 210944x167936 px (35.4 Gpx), 33784 region(s), 540544 tile(s) at zoom 10.
[INFO] Tamriel [skyrim.esm:00003C]: 35.4 Gpx in 14m46s, 40.0 Mpx/s.
When stderr goes to a file or a pipe, a large map logs the status line at each tenth of its pixels instead, ending with a period. A map below 2^30 pixels logs none of these lines.
The worldspaces that get no map are counted in one warning, and --verbose gives each one’s
reason. Each background adds its own reasons, see its page. The ones shared by every background are:
- no EditorID, which names the map;
- no exterior
LANDrecord in the load order; - with
--crop-to-playable, noLANDcell inside its playable bounds.
When the worldspace has a parent (WNAM) and PNAM sets “Use LOD Data”, the reason adds that
the worldspace uses its parent’s LOD and that --parent-lod draws it.
Shared arguments and options
Every export:worldspace-maps:* command takes these, after its own options:
<data-directory> --output-directory <dir> [--clean] [--crop-to-playable] [--water] [--interpolation nearest|bilinear|bicubic|bspline] [--objects[=colormap|texture|wireframe]] [--levels] [--projected-materials] [--hillshade-hour sunrise|midday|sunset|midnight] [--roads] [--lights] [--cell-grid] [--parent-lod] [--worldspace <EditorID>]... [--format plain-png|grid|pmtiles] [--png-compression <1-9>] [--jobs auto|<count>] [--markers[=location,books] [--language <language>]] [--load-order se|ae|custom [--load-order-plugins <names|file>] [--load-order-archives <names|file>]]
Each option is described in its section above; <command> --help lists them with their defaults.