This page follows NewTek’s description of LWO2. Chunk layouts are written, as there,
as an ID followed by its fields, with each field’s type in brackets; *
means repeated to the end of the chunk, and ? means optional.
Data types
Everything is big-endian (most significant byte first).
| Type | Size | Meaning |
|---|---|---|
ID4 | 4 | A tag of four 7-bit ASCII characters, such as FORM or POLS |
I1, I2, I4 | 1, 2, 4 | Signed integers, two’s complement |
U1, U2, U4 | 1, 2, 4 | Unsigned integers |
F4 | 4 | IEEE floating-point number |
S0 | Even | ASCII string ending in a zero byte, plus one more zero when needed to make the length even |
VX | 2 or 4 | Variable-length index: a U2 when the index is below 65,280 (0xFF00); otherwise a U4 with the top byte FF. A reader that sees a first byte of FF reads four bytes and masks off the top byte |
COL12 | 12 | A colour: red, green, blue as F4, nominally 0.0 to 1.0 |
VEC12 | 12 | A position or vector: x, y, z as F4 |
FP4 | 4 | A percentage as F4, 1.0 being 100% |
ANG4 | 4 | An angle as F4, in radians |
FNAM0 | Even | A file name as S0, in a neutral form: disk:path/file for an absolute path, path/subpath/file for a relative one |
Chunks and sub-chunks
| Kind | Layout |
|---|---|
| Chunk | tag[ID4], length[U4], data, and one pad byte when the length is odd (not counted in the length) |
| Sub-chunk | tag[ID4], length[U2], data, and a pad byte when the length is odd |
| File | FORM, length[U4] (file size − 8), LWO2, then chunks |
Sub-chunks appear inside ENVL, CLIP and SURF.
A sub-chunk’s meaning depends on where it is: CHAN in an envelope is not
CHAN in a surface block. Readers skip chunks they do not know by their
length.
LAYR – Layer
LAYR { number[U2], flags[U2], pivot[VEC12], name[S0], parent[U2] ? }
Starts a new layer; every chunk after it belongs to that layer until the next
LAYR. Data before any layer goes into an arbitrary layer. Bit 0 of
flags set means the layer is hidden. pivot is the layer’s
pivot point. parent is the number of the default parent layer, or −1
(or missing) for none.
PNTS – Points
PNTS { point-location[VEC12] * }
The points of the current layer, numbered from 0; their number is the chunk length ÷
12. A PNTS must come before the POLS, VMAP and
VMAD chunks that refer to it. LightWave’s coordinate system is
left-handed: +X right (east), +Y up, +Z forward (north). There are no explicit units;
by convention the unit is the metre.
The description says the positions are relative to the layer’s pivot. In the real
files read for this site they are not offset by it: in Assimp’s
hierarchy.lwo four layers have pivots such as (−2.75, 0, −0.85), and
drawing every layer’s points as stored puts each box on the sphere it belongs on.
Assimp’s importer reaches the same result: it puts a pivot node at the pivot and the layer’s
mesh node at minus the pivot beneath it, and keeps the points as stored, so the net
placement of the points is their stored position. This site’s viewer draws the points as stored and lists each layer’s pivot
and parent in the Layers table. The pivot is where LightWave turns the layer from.
VMAP – Vertex map
VMAP { type[ID4], dimension[U2], name[S0], ( vert[VX], value[F4] # dimension )* }
Gives some of the points of the latest PNTS a vector of
dimension values. A file may hold any number of vertex maps, each with a
different type or name.
| Type | Dimension | Meaning |
|---|---|---|
PICK | 0 | A selection set: marks points for quick selection; no effect on the geometry |
WGHT | 1 | A weight map, usually for the influence of deformers such as bones; may be negative; unmapped points weigh 0.0 |
MNVW | 1 | Subpatch weights, which change the shape of subdivided geometry |
TXUV | 2 | UV texture coordinates |
RGB (with a trailing space), RGBA | 3, 4 | Vertex colours |
MORF | 3 | A morph target as displacements from the base positions |
SPOT | 3 | A morph target as absolute positions |
MBAL | 1 | The radius of influence of each metaball point |
The description notes that other types will appear. As every ID is four bytes,
RGB is written RGB , with a space.
POLS – Polygons
POLS { type[ID4], ( numvert+flags[U2], vert[VX] # numvert )* }
The polygons of the current layer. Each starts with a U2 whose low 10
bits are the vertex count (up to 1023) and whose top 6 bits are flags; the vertices
follow as point numbers in the latest PNTS.
| Type | Meaning |
|---|---|
FACE | Ordinary polygons, the most common |
CURV | Catmull–Rom spline curves, used in modelling and ignored by the renderer |
PTCH | Subdivision patches: the polygons are the control cage, and LightWave subdivides them by a method that is not documented |
MBAL | Metaballs: single-point polygons, whose radius is in an MBAL vertex map |
BONE | Two-point line segments forming the object’s skeleton |
The meaning of the 6 flag bits depends on the type and is documented only for
CURV: the two lowest flag bits (bits 10 and 11) mark the first and last
points as continuity control points, and the four highest (bits 12 to 15) are extra
high bits of the vertex count, allowing curves of up to 16,383 points. A polygon’s
vertices start at a convex vertex and run clockwise as seen from its visible side;
the normal is the cross product of the first and last edges.
VMAD – Discontinuous vertex map
VMAD { type[ID4], dimension[U2], name[S0], ( vert[VX], poly[VX], value[F4] # dimension )* }
Introduced with LightWave 6.5. Like VMAP, but each value belongs to a
point as used by one particular polygon, so a point can have different values in
different polygons. This solves UV seams: where a VMAD has the same name
as a VMAP, its values replace the map’s for the polygons it lists. The
types TXUV, RGB , RGBA and WGHT
are supported; others, such as MORF and SPOT, are kept but
never used.
VMPA – Vertex map parameters
VMPA { UV-subdivision-type[I4], sketch-colour[I4] }
Special properties of a vertex map, from later versions of LightWave. The UV subdivision types are 0 linear, 1 subpatch, 2 subpatch with linear corners, 3 subpatch with linear edges, 4 subpatch with discontinuous edges.
Other chunks
| Chunk | Layout | Meaning |
|---|---|---|
BBOX | min[VEC12], max[VEC12] | Optional bounding box of the layer’s points |
DESC | description-line[S0] | Optional short description of the object, without control characters |
TEXT | comment[S0] | Optional comments, which may contain line breaks |
ICON | encoding[U2], width[U2], data[U1] * | Optional thumbnail. The only encoding is 0, uncompressed RGB byte triples; the height is (chunk length − 4) ÷ (width × 3) rows |
ENVL | index[VX], sub-chunks | An envelope; see Envelopes and clips |
CLIP | index[U4], sub-chunks | An image or image sequence; see Envelopes and clips |
SURF | name[S0], source[S0], sub-chunks | A surface; see Surface parameters |
The description gives the icon’s height as (chunk length − 4) ÷ width, which counts bytes rather than pixels; with three bytes per pixel the row count is a third of that.
Worked example
The smallest useful LWO2 file: one layer, three points, one triangle and one surface called Red, 176 bytes. It was built for this page and read back with this site’s reader; no LightWave version wrote it, but every field is as the chunk descriptions above give it.
00000000 46 4F 52 4D 00 00 00 A8 4C 57 4F 32 54 41 47 53 FORM....LWO2TAGS
00000010 00 00 00 04 52 65 64 00 4C 41 59 52 00 00 00 12 ....Red.LAYR....
00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000030 4C 00 50 4E 54 53 00 00 00 24 00 00 00 00 00 00 L.PNTS...$......
00000040 00 00 00 00 00 00 3F 80 00 00 00 00 00 00 00 00 ......?.........
00000050 00 00 00 00 00 00 3F 80 00 00 00 00 00 00 50 4F ......?.......PO
00000060 4C 53 00 00 00 0C 46 41 43 45 00 03 00 00 00 01 LS....FACE......
00000070 00 02 50 54 41 47 00 00 00 08 53 55 52 46 00 00 ..PTAG....SURF..
00000080 00 00 53 55 52 46 00 00 00 26 52 65 64 00 00 00 ..SURF...&Red...
00000090 43 4F 4C 52 00 0E 3F 80 00 00 00 00 00 00 00 00 COLR..?.........
000000A0 00 00 00 00 44 49 46 46 00 06 3F 4C CC CD 00 00 ....DIFF..?L....
| Offset | Bytes | Meaning |
|---|---|---|
| 0 | 46 4F 52 4D 00 00 00 A8 4C 57 4F 32 | FORM, length 168 (the file is 176 bytes), form type LWO2 |
| 12 | 54 41 47 53 00 00 00 04 52 65 64 00 | TAGS, length 4: one name, “Red” and its zero, which makes an even length so there is no padding. Tag 0 is “Red” |
| 24 | 4C 41 59 52 00 00 00 12 | LAYR, length 18 |
| 32 | 00 00 00 00 | Layer number 0, flags 0 (not hidden) |
| 36 | twelve 00 bytes | The pivot, (0, 0, 0): three floats |
| 48 | 4C 00 | The name “L” and its zero, which makes two bytes. The optional parent is left out |
| 50 | 50 4E 54 53 00 00 00 24 | PNTS, length 36: three points |
| 58 | 00 00 00 00 ×3 | Point 0 is (0, 0, 0) |
| 70 | 3F 80 00 00 00 00 00 00 00 00 00 00 | Point 1 is (1, 0, 0); 3F 80 00 00 is the float 1.0 |
| 82 | 00 00 00 00 3F 80 00 00 00 00 00 00 | Point 2 is (0, 1, 0) |
| 94 | 50 4F 4C 53 00 00 00 0C 46 41 43 45 | POLS, length 12, type FACE |
| 106 | 00 03 00 00 00 01 00 02 | One polygon of 3 vertices (no flags), points 0, 1 and 2, each a two-byte VX index |
| 114 | 50 54 41 47 00 00 00 08 53 55 52 46 | PTAG, length 8, type SURF: tags that name surfaces |
| 126 | 00 00 00 00 | Polygon 0 has tag 0, so its surface is “Red” |
| 130 | 53 55 52 46 00 00 00 26 | SURF, length 38 |
| 138 | 52 65 64 00 00 00 | Name “Red”; the source is empty: a zero and a pad zero make two bytes |
| 144 | 43 4F 4C 52 00 0E | Sub-chunk COLR, length 14 (a two-byte length) |
| 150 | 3F 80 00 00 00 00 00 00 00 00 00 00 00 00 | Colour (1, 0, 0), red; then the envelope index 0, meaning none |
| 164 | 44 49 46 46 00 06 | Sub-chunk DIFF, length 6 |
| 170 | 3F 4C CC CD 00 00 | Diffuse 0.8 (3F 4C CC CD), no envelope: 80% |
Not described
What this page and the viewer here leave out about the LWO2 chunks.
Known, not yet covered
- Reference: the polygon type
SUBDand theVMAPtypeNORM(Modo vertex normals), both handled in Assimp’s LWO loader; the viewer drawsSUBDas a control cage and listsNORMmaps without using them. - Viewer: using
WGHT,MORF,SPOT,PICKandMBALmaps, applyingPARTandSMGPtags and theVMPAsettings, all defined in the description; they are counted or listed only. - Viewer:
RGB/RGBAmaps are drawn only through a surface’sVCOL, and onlyTXUVmaps are drawn as UVs;VMADvertex colours are not drawn.
Unknown
- Reference: the meaning of the polygon flag bits for every type but
CURV; the description does not give it. - Reference and viewer: how
PTCHpatches are subdivided; the description says the method is not documented, so the viewer shows the control polygons. - Reference: what happens to data before the first
LAYR, beyond “an arbitrary layer”.