MCM1 TRN Extractor Help

Back to Extractor

This utility extracts editable displacement and texture images from compiled Motocross Madness 1 National and TrackEdit/SX .trn terrain files. It also calculates a compatible Tga2Asc MAXHEIGHT for the selected output gray range.

The extractor calculates an equivalent reconstruction. A compiled TRN does not retain every original TGA, ASC, Tga2Asc, Base, or VerticalMultiplier setting used when the track was authored.

Quick start

  1. Drop one National or SX .trn file onto the extractor.
  2. Optionally drop its same-name .scn at the same time.
  3. Review the center and perimeter previews.
  4. Leave Darkest Gray at 0 and Max Gray at 255 for a full-range starting point.
  5. Use the displayed Calculated Tga2Asc MAXHEIGHT when converting the extracted displacement TGA to ASC.
  6. Download individual files or use Download All (.zip).

Every newly loaded TRN resets the gray range to 0–255. Adjustments apply only to the currently loaded track.

Controls

ControlPurpose
Displacement base elevation Reconstruction offset used when converting compiled elevations to grayscale. It is automatically calculated when a track loads or the gray endpoints change. Manually changing it shifts the grayscale and can move values outside the selected endpoint targets.
Darkest editable gray Gray assigned to the lowest elevation in the shared extraction range. Defaults to 0.
Max gray Gray assigned to the highest elevation in the shared extraction range. Defaults to 255.
Calculated Tga2Asc MAXHEIGHT Read-only value calculated from the compiled TRN elevation span and selected gray endpoints.

Output files

FileContents
-displacement.tga257×257 center displacement, 24-bit grayscale RGB.
-texture.tgaReconstructed center terrain texture, 24-bit RGB: 1024×1024 for National or 2016×2016 for SX.
-perimeter-displacement.tga129×129 representative repeated perimeter displacement, when identified.
-perimeter-tile.tgaPalette-decoded perimeter texture tile, when present.
-extraction-info.txtSource details, calculated values, orientation, wrapping, and rebuild notes.
-extracted.zipAll available outputs in one stored ZIP archive.

Displacement TGAs use identical blue, green, and red channel values: B = G = R. They are written with TGA descriptor 0x00, using classic bottom-left row storage.

National and SX textures

The extractor identifies the terrain variant from the TRN terrain-kind field. National and TrackEdit/SX files use the same indexed texture format, but store and arrange their center textures differently.

VariantStored layoutExtracted texture
National Sixteen 256×256 indexed tiles arranged as a fixed 4×4 grid. 1024×1024
TrackEdit/SX 128×128 indexed tiles referenced by the terrain quadtree, including a one-pixel border and per-leaf transformations. 2016×2016

For SX, the extractor removes each stored tile’s one-pixel border, applies its quadtree transformation, and assembles the resulting 126×126 interiors into a 16×16 terrain texture. The extraction-info file records the detected terrain variant and final texture dimensions.

TRN elevation values

Supported TRN heights are stored as 16-bit fixed-point values with eight fractional bits. The extractor presents the useful elevation value rather than the encoded integer.

Stored elevation:

elevation_units = raw_height / 256

Examples:

Encoded valueElevation value
3840 (0x0F00)15.0
876034.21875

The common compiled edge elevation 15.0 is an elevation value, not gray 15 and not raw integer 15.

GridResolutionInFeet and physical scale

The TRN contains the scale used by MakeTerr. The stored floating-point field is multiplied by 256 to recover GridResolutionInFeet.

GridResolutionInFeet = trn_scale_field × 256
TRN fieldGrid resolution257-point center width
0.011718753.0 ft256 × 3 = 768 ft
0.0156254.0 ft1024 ft
0.019531255.0 ft1280 ft

In this authoring workflow, Tga2Asc elevation values are terrain elevation units. MakeTerr applies the terrain grid scale. A Tga2Asc value of 25 on a 3.0 terrain represents 25 × 3 = 75 ft at white.

Gray-range normalization

A compiled TRN no longer contains the original editable TGA gray endpoints. The extractor therefore creates a new linear mapping.

Using 0–255 uses all available grayscale levels. A narrower range leaves editing headroom but requires a larger Tga2Asc MAXHEIGHT.

Calculated Tga2Asc MAXHEIGHT

Compiled elevation span:

span = (raw_max − raw_min) / 256

MAXHEIGHT for selected gray endpoints:

MAXHEIGHT = span × 255 / (max_gray − darkest_gray)

With a full 0–255 range, MAXHEIGHT equals the compiled elevation span. If the output uses only part of the grayscale range, MAXHEIGHT increases so the selected endpoints still represent the same elevation difference.

This is an equivalent value for the newly extracted TGA. It is not proof of the original Tga2Asc value used years earlier.

Base and VerticalMultiplier

In a MakeTerr .ter source file, Base identifies the flat edge elevation of the referenced ASC terrain. MakeTerr uses it to align that terrain with the surrounding compiled terrain.

VerticalMultiplier controls the strength of a terrain chunk. A National center chunk normally uses 1.0. Surrounding copies may use smaller or negative values.

These source parameters are baked into the compiled TRN geometry and are not recoverable as their original text values. The extractor’s Base field is a calculated reconstruction offset, not necessarily the original .ter Base.

Extractor reconstruction mapping:

elevation = reconstruction_base + ((raw_height − 3840) / 256)
gray      = round(elevation × 255 / MAXHEIGHT)

Perimeter displacement

National terrain, and any compatible SX terrain containing the same repeated structure, may contain a representative 129×129 perimeter displacement that is reused around the center terrain. The extractor identifies the repeated source and exports one representative tile.

For example, a flat perimeter is gray 0 when the center edge is gray 0, and gray 56 when the center edge is gray 56.

Orientation and patch-edge wrapping

TRN patch order does not match the way the displacement appears in an image editor. The extractor applies the verified vertical flip to both center and non-flat perimeter displacement maps.

The extractor also derives cyclic X/Y patch wrapping from the TRN quadtree center block. The extraction-info file records the fixed orientation and calculated wrap values.

Worked examples

FireRoad

Grid resolution3.0
Compiled elevation minimum15.0
Compiled elevation maximum34.21875
Compiled elevation span19.21875
Calculated MAXHEIGHT at 0–25519.2188
Calculated MAXHEIGHT at 56–25424.7514

FireRoad’s surviving 257×257 source TGA uses gray 56–254. That known range explains why an equivalent reconstructed MAXHEIGHT is close to 25. The TRN alone would reveal the 19.21875 span but not the original starting gray.

JoyOfSX

Grid resolution3.0
Compiled center minimum15.0
Compiled center maximum22.4453125
Compiled center span7.4453125
Calculated MAXHEIGHT at 0–2557.4453
Flat perimeter elevation16.34375
Flat perimeter output at 0–255Gray 0, matching the center edge.

Suggested rebuild workflow

  1. Load the TRN and leave the gray range at 0–255 initially.
  2. Download the center displacement TGA.
  3. Convert it with Tga2Asc using scale 1.0 and the displayed calculated MAXHEIGHT.
  4. Use the TRN-derived GridResolutionInFeet in the new .ter.
  5. Use the extractor’s reconstruction Base as the starting Base for the extracted center ASC.
  6. Edit the displacement only after confirming the unedited round trip builds correctly.
  7. Keep the center and perimeter boundaries compatible before compiling with MakeTerr.

If you change the gray endpoints, reconvert with the newly calculated MAXHEIGHT. Do not continue using the value calculated for an earlier range.

What cannot be recovered reliably

The TRN does preserve compiled elevations, terrain scale, textures, and geometry sufficiently to produce an equivalent editable extraction.

Troubleshooting

The displacement looks upside down

The extractor applies the verified vertical flip automatically. The extraction-info file records the output orientation and calculated patch wrapping.

The extracted image is too dark

Raise Darkest Gray. The extractor will recalculate Base and MAXHEIGHT to preserve the elevation span.

The extracted image clips at white

Confirm Max Gray is greater than Darkest Gray and use the displayed calculated MAXHEIGHT when running Tga2Asc.

The perimeter is one solid color

The compiled perimeter may be genuinely flat. A flat perimeter is intentionally colored to match the center edge.

The reported histogram count is three times the pixel count

Some editors count the identical R, G, and B channels separately. A 24-bit grayscale TGA pixel has three equal channel samples. Divide such a channel count by three to get the number of pixels.

The matching SCN was not selected

The SCN is optional and is used only to display the track name. It does not change terrain extraction.

The extractor rejects a TRN

The file must be a supported MCM1 National or TrackEdit/SX TRN with a valid TRN\0 signature, indexed texture format, and recognized terrain kind. Stunt Quarry, Baja, damaged, or differently structured terrain may require a different extractor.

Help guide for MCM1 TRN Extractor version 2.0.