Models that are not built from primitives are written as a list of vertices followed by faces that name them. The banana, the table and the head from RenderWare’s demonstration disc, and the glyph files of Live3D, are written this way.
Vertex lists and numbering
Each Vertex command defines one point and gives it the next
number, counting from 1. The first Vertex of a clump is vertex 1. The
numbers are those of the clump or prototype the command is in: in
TRIAD.RWX the prototype X defines 24 vertices and the prototype Y 18, and the
faces of each count from 1 within their own prototype. That every clump also has its
own list is how this viewer reads it; each sample file but TRIAD has
one clump with vertices, so none shows it.
A face names vertices that already exist. A vertex defined after the face is not available to it, and the viewer reports a number that is not defined at that point. The sample files always define the vertices first.
The point is put through the transform in force when the Vertex command
is read, which is how this viewer reads it. No sample file moves anything between its
vertices and its faces, so it makes no difference to them. See
Transforms.
Vertex 0.262260 -0.961560 -0.017030
Vertex 0.270550 -0.931970 -0.016160
Vertex -4 6 -1
Vertex and three numbers, with any amount of white space between (the banana pads its numbers with two spaces). Written values run from whole numbers to six decimals.An Active Worlds form adds texture coordinates: Vertex x y z UV u v. No
sample file uses it; the viewer reads the two numbers and does not draw textures.
Triangle, Quad and Polygon
| Command | Arguments | Example from a sample file |
|---|---|---|
Triangle | three vertex numbers | Triangle 1 10 2 (TABLE.RWX) |
Quad | four vertex numbers | Quad 17 18 2 1 (BANANA.RWX) |
Polygon | the number of corners, then that many vertex numbers | Polygon 4 10 9 8 7 (glyph 033, “!”) |
The vertex numbers are in order round the face. A quadrilateral or a polygon need not be
flat or convex, and the corners are not limited to a number the files show: the glyph
for “@” (064.RWX) has a polygon of 120 corners. The viewer cuts every face
into triangles to draw it, so a quadrilateral is two triangles and a polygon of
n corners at most n − 2. A polygon whose count is not the number
of vertex numbers after it is reported.
Each face is drawn in the material in force at its command. Both BANANA.RWX and
the glyph files change Color and Surface between faces, and
the Live3D glyphs repeat LightSampling and Color before
every polygon, so that each polygon carries its own. See
Materials.
Tag is an Active Worlds addition: a number attached to the faces
that follow it or, written after the vertex numbers (Quad 1 2 3 4 Tag 100),
to one face, which a world uses to tell parts of an object apart for clicks and
animation. This is from memory of its documentation, no sample file uses it, and the
viewer keeps the number without using it.
Which side of a face is the front depends on the order of its corners, and as far as the author remembers
RenderWare draws one side unless a double-sided material mode (MaterialModes
Double) is set; no sample file shows it. This viewer draws both
sides of every face and shades them alike, so a face that RenderWare would hide
appears here.
Concave polygons and holes
The Live3D glyphs are flat letters, so most faces are concave: the “Y” of
089.RWX is a single polygon of 13 corners shaped like the letter. A letter
with a hole, such as “0” (048.RWX, one polygon of 42 corners) or “@”, is
written as one polygon that goes round the outside, crosses to the hole along a
bridge, goes round the hole and comes back by the same bridge. Vertices at the two
ends of a bridge are defined twice, at the same position, so the polygon passes through
each point twice.
A renderer has to be able to fill such polygons: the viewer here cuts them into triangles by clipping ears, flattening the polygon along the axis its normal points along, and lets the doubled points through, so the hole stays open. A hole joined by a bridge in a test polygon (a 4 × 4 square with a 2 × 2 hole) comes out with the exact area of 12.
The files call themselves “Extruded Text”, but each holds only a flat outline: in all
94 glyph files every vertex has z 0, so any depth is added by the program that draws
them (this viewer shows them flat). The letters in TRIAD.RWX are a
different case: they list vertices at z −1 and z 1, a polygon for each end and quads
between them, so those letters are solid.
Not described
Checked against the 99 distinct sample files only; these points are inferred or untested.
- Reference: per-clump vertex lists, and vertices being transformed when defined, are how the viewer reads it; no sample file shows either.
- Reference: the UV form of Vertex and Tag are from memory; no sample file uses them.
- Reference: which side of a face is the front, and the double-sided mode, are unverified.
- Viewer: draws both sides of every face, ignores Tag and UV, and cuts every face into triangles by its own method.