In LightWave a surface is a named set of colour and shading settings shared by a
group of polygons. Each SURF chunk describes one surface: it starts with
the surface’s name, ending in one or two zero bytes as in
SRFS, followed by sub-chunks up to the
end of the chunk. A sub-chunk is like a chunk, but its length is a 2-byte short.
Unknown sub-chunks are skipped.
Basic settings
| ID | Data | Meaning |
|---|---|---|
COLR | 4 bytes | Red, green, blue (0 to 255) and a byte that is ignored and should be 0 |
FLAG | short | Surface options; see below |
LUMI | short | Luminosity; 256 is 100%. New in LightWave 3.0, replacing the Luminous flag |
DIFF | short | Diffuse level; 256 is 100% |
SPEC | short | Specular level; 256 is 100% |
REFL | short | Reflection level; 256 is 100% |
TRAN | short | Transparency; 256 is 100% |
GLOS | short | Glossiness, needed only when SPEC is not 0: 16 low, 64 medium, 256 high, 1024 maximum (new in 3.0). It acts as a specular exponent |
RIMG | string | File name of the reflection map image, with its path |
RSAN | float | Heading of the reflection map’s seam, in degrees. New in 3.0 |
RIND | float | Refractive index, 1.0 or more |
EDGE | float | Edge transparency threshold, 0.0 to 1.0 |
SMAN | float | Largest angle between neighbouring polygons that is shaded smoothly, in degrees. New in 3.0 |
A missing LUMI, DIFF, SPEC, REFL or TRAN counts as 0. When REFL is not 0 but there
is no RIMG, the surface reflects the backdrop, or uses ray-traced reflection when
ray tracing is on. A file name ending in “ (sequence)” is the prefix of an
image sequence, to which LightWave adds a three-digit frame number.
FLAG bits
| Bit | Value | Option |
|---|---|---|
| 0 | 0x001 | Luminous |
| 1 | 0x002 | Outline |
| 2 | 0x004 | Smoothing |
| 3 | 0x008 | Colour highlights |
| 4 | 0x010 | Colour filter |
| 5 | 0x020 | Opaque edge |
| 6 | 0x040 | Transparent edge |
| 7 | 0x080 | Sharp terminator |
| 8 | 0x100 | Double sided |
| 9 | 0x200 | Additive (new in LightWave 3.0) |
The two edge transparency bits should not both be set. The description says only the nine lowest bits are used, then lists ten options; the tenth, Additive, was added in LightWave 3.0.
Textures
A surface may have up to six textures, one of each kind. Each starts with a
sub-chunk naming the texture type as shown on LightWave’s control panel, for example
Planar Image Map or Fractal Bumps; every texture sub-chunk
after it belongs to that texture until the next one starts.
| ID | Starts a texture for |
|---|---|
CTEX | Colour |
DTEX | Diffuse |
STEX | Specular |
RTEX | Reflection |
TTEX | Transparency |
BTEX | Bump |
| ID | Data | Meaning |
|---|---|---|
TIMG | string | Image file, or image sequence prefix, for an image map |
TFLG | short | Texture options: bit 0 X axis, 1 Y axis, 2 Z axis (only one of the three), 3 world coordinates, 4 negative image, 5 pixel blending, 6 antialiasing |
TSIZ | 3 floats | Texture size in x, y, z |
TCTR | 3 floats | Texture centre; only needed when not 0 |
TFAL | 3 floats | Falloff; only needed when not 0 |
TVEL | 3 floats | Velocity; only needed when not 0 |
TCLR | 4 bytes | Texture colour, as in COLR, for colour textures |
TVAL | short | Texture value for diffuse, specular, reflection or transparency textures; 256 is 100% |
TAMP | float | Bump amplitude; 1.0 is 100% |
TFRQ | short | Number of noise frequencies or wave sources |
TSP0, TSP1, TSP2 | float | Texture-specific parameters, such as contrast, turbulence or wavelength, in the order their buttons appear on the control panel |
Example
In the description’s example, the “Triangle” surface is:
SURF 0x0044 "Triangle"
COLR 4 F0 B4 00 00 yellow: red 240, green 180, blue 0
FLAG 2 00 00
DIFF 2 00 9A 154 of 256, about 60%
SPEC 2 00 CD 205 of 256, 80%
GLOS 2 01 00 256, high glossiness
REFL 2 00 33 51 of 256, 20%, reflecting the backdrop
TRAN 2 00 66 102 of 256, 40%