By common computer graphics convention in 2D displays, the X-axis is normally the horizontal (left-right) axis, and the Y-axis is the vertical (up-down) axis. 3D graphics extends this by adding the Z-axis, or depth-axis, which is commonly viewed as coming out of, or receding into, the screen. Note that in WinFrame, the observation point, or camera view-position, can be changed. Figure 1 below, illustrates the relationship of the axes, as viewed when the camera position is placed in the positive X-Y-Z quadrant.
![]() |
When used to view terrain-maps or outdoor landscapes, the X-axis typically represents the East-West coordinate, the Z-axis represents the North-South coordinate, and the Y-value represents (up-down) altitude.
The camera setup must be done first, before anything else.
<set_camera>
<frustum fov="", near_field="", far_field="" />
<position x="", y="", z="" />
<pointat x="", y="", z="" />
</set_camera>
Example:
<set_camera>
<frustum fov="45.0", min="2.5", max="12000.0"/>
<position x="0.0", y="1200.0", z="-4900.0"/>
<pointat x="0.0", y="0.0", z="-2350.0"/>
</set_camera>
Where: View_angle (fov=field-of-view) is in degrees. (Frustum is the viewable volume
in front of the virtual camera, or viewing location.)
Near-field is the closest range from the camera that objects will be visible.
Far-field is the farthest range.
Convention is to assume coordinates are in meters.
X-axis is initially left-right (for camera position x=0 with z=negative).
Y-axis is up-down (positive y is up).
Z-axis is into screen.
The pointat operator specifies where the camera is pointing at.
Camera settings can be changed throughout simulation.
If unsure about these settings, experiment. Frustum can be varied
interactively under the Meta-menu.
2. Defining Object Types:
<def_obj> type_name
...
</def_obj>
Where "..." is the list of components out of which the new object-type is composed.
Objects may be constructed from any combination of triangles, quadrilaterals (quads), images, image-slices,
simple objects (lines, text, spheres, boxes, cylinders, disks), and other sub-objects.
Triangles, quads, and images are described in this section. The other component types are described in subsequent sections.
Triangles & Quads:
Colored surfaces of arbitrary shape can be constructed out of the basic building blocks: triangles and quads.
The color of subsequent triangles and/or quads is set by the <col r="" g="" b="" t=""/> tag.
In def_obj, color can be set anywhere, and remains until changed. It should be set once before drawing triangles or quads.
Color is specified by r,g,b and t, where t is transparency (1=solid, 0=clear, 0.5=translucent, etc.), by:
<col r="" g="" b="" t=""/>
Triangles are specified by:
<tri> <vrt x="" y="" z="" /> <vrt x="" y="" z="" /> <vrt x="" y="" z="" /> </tri>
Example: - Define an object out of triangular polygons.
<def_obj> BuildingT36
<col r=0.19 g=0.27 b=0.28 t=1/>
<tri>
<vrt x=118.03 y=0 z=-259.674/>
<vrt x=157.36 y=0 z=-259.674/>
<vrt x=157.36 y=206.467 z=-259.674/>
</tri>
<tri> <vrt x=118.03 y=206.467 z=-259.674/>
<vrt x=118.03 y=0 z=-259.674/>
<vrt x=157.36 y=206.467 -259.674/>
</tri>
<tri> <vrt x=118.03 y=206.467 z=-312.025/>
<vrt x=118.03 y=206.467 z=-259.674/>
<vrt x=157.36 y=206.467 z=-259.674/>
</tri>
</def_obj>
Quadrilateral polygons (Quads) are specified by the <quad> construct:
<quad> <vrt x="" y="" z="" /> <vrt x="" y="" z="" /> <vrt x="" y="" z="" /> <vrt x="" y="" z="" /> </quad>
Note there are four vertices per a quad. Special care must be taken, when using quads, to not cross the vertices, like an hour-class shape.
Open GL does not support that.
A key point to note is that, by default, triangles and quadrilaterals are visible only from their front side. (This is advantageous for rendering efficiency, since many objects are viewed from only one side. For example the walls of any solid object, such as a boat or a building, as viewed from outside.) The front side is determined by the pointing direction of the vector norm of the vertices, - also called the winding. If you get the winding (order of the vertices) wrong, you may notice your triangle is viewable from the wrong side. Simply reverse the winding by flipping a pair of vertices in the case of a triangle, or by re-ordering three vertices of a quad.
A simple way to avoid the wrong-side problem is to use two-sided polygons. These are also useful when you are describing a thin surface which actually can be viewed from both sides. Use the variants <tri2> and <quad2> accordingly.
Images/Textures:
Instead of just colored surfaces, you can define objects by mapping arbitrary images to the quadrilaterals.
This produces rich textures and realistic views, while often reducing the total polygons for drawing scenes with
better qualities.
Instead of <tri>, <col>,and <quad>; use:
<image> image_filename <vrt x="" y="" z="" /> <vrt x="" y="" z="" /> <vrt x="" y="" z="" /> <vrt x="" y="" z="" /> </image>For examples and further information, see also More info about defining images.
Mixing Object Types:
Mixtures of <tri>, & <quad>,and <image>, as well as any of the
simple shapes (disk, box, cylinder, sphere) described below, can be all used in any combination.
Also, other object types can be instantiated within new definitions to create compound objects through hierarchical
construction.
Scaling and Offsets:
Scale:
<scale> SC </scale>
Offset:
<offset x="XX" y="YY" z="ZZ"/>
Where SC is the scale amount, and XX, YY, ZZ are the offset amounts for x
y, and z axes, respectively. These commands scale or offset all subsequent
objects by the designated amounts. This can be used to fit objects
which were defined with greatly differing sizes into common scenes.
Also allows changing the centers for better rotations.
Examples:
<scale> 2.0 </scale>
<offset x=10.0/>
<offset x=10.0 y=-30.0/>
3. Instantiating Objects:
<inst_obj name="" kind="" x="" y="" z="" xang="" yang="" zang="" />
...
Where name sets the instance-name of the object. All object instances must have a unique
instance-name. This becomes the handle to the object for future commands, such as moves,
rotations, etc.. And where kind specifies the type of object to instantiate. (This
must be a previously defined type-name.) And where x,y,z set the initial position, and the
remaining xang, yang, and zang set the initial xAxisAngle, yAxisAngle, and zAxisAngle angles
in degrees.
The above is useful for instantiating the initial objects immediately. To schedule new
objects to be added at later times, use inst_obj_at.
<inst_obj_at name="" kind="" T="" x="" y="" z="" xang="" yang="" zang="" />
Where T is instantiation time.
Example
<inst_obj name="Building_37" kind="BuildingT36" x="0" y="0" z="0" xang="0" yang="0" zang="0" />
Instance Scaling - <scale> SC </scale>
- Affects the instantiation positions.
- Is obeyed when encountered anywhere between objects.
(Except within an object's definition where it is local.)
- Remains set to whatever, until re-set back to 1.0.
- Does not affect an instance of an object's defined size,
but does scale the position values of the instantiated object.
Options
face="camera" - Causes object to always face camera. Good for text attached to
objects. Keeps it readable from any angle. Also good for 2D
animatrons, keeps 2D image or object always facing camera for
simulated 3D look.
4. Moving Objects:
moveobject
<mo obj="" T1="" T2="" x="", y="", z="" />
<mo_rel obj="" duration="" x="", y="", z="" />
rotateobject
<ro obj="" T1="" T2="" xang="", yang="", zang="" />
<ro_rel obj="" duration="" xang="", yang="", zang="" />
orbitobject
<orbity obj="" T1="" T2="" xcntr="", ycntr="", zcntr="", ang="" />
<orbity_rel obj="" duration="" xcntr="", ycntr="", zcntr="", ang="" />
<orbitx obj="" T1="" T2="" xcntr="", ycntr="", zcntr="", ang="" />
<orbitx_rel obj="" duration="" xcntr="", ycntr="", zcntr="", ang="" />
<orbitz obj="" T1="" T2="" xcntr="", ycntr="", zcntr="", ang="" />
<orbitz_rel obj="" duration="" xcntr="", ycntr="", zcntr="", ang="" />
The _rel, or relative versions of the movement commands instruct the
viewer to move the object for the duration specified, beginning whenever the command
is received by the viewer. These permit non-synchronized/real-time simulations to
drive the viewer. They are time-relative, or relative to the current time.
The moveobject command (mo) causes the named object-instance to move to the
specified (x,y,z) location during the specified time duration from where-ever it
was at the start of the duration. It will move at whatever velocity is required
to reach the (x,y,z) point at the end of the duration.
The rotateobject command (ro) causes the named object-instance to rotate
about its own x, y, or z axis by the specified angular amount during the specified time
duration. All angles are specified in degrees. It will rotate at whatever rate is
needed to rotate the specified amount in that time-duration.
The orbitobject command (orbitx, orbity, oribtz) causes the named object-instance
to orbit the center-point specified by (xcntr,ycntr,zcntr), from it's initial location.
The distance between the center-point and the initial location defines the radius of
the orbit. It will orbit by the specified angular amount during the specified time
duration. This command can be used to produce curvilinear trajectories by using
angles less than 180-degrees, or can be used to produce multiple orbital passes by using
angles that are many multiples of 360 (IE. much greater than 360). All angles are
specified in degrees. Orbital motion can be specified relative to each axis independently.
For example, orbity causes an orbit around the y-axis in which the object will move
in the x-z plane. A simultaneous orbitx at the same rate will cause a y-displacement -
in combination creating a slanted orbit.
5. Drawing Lines or Radio Beams:
Lines between Points in Space -
DrawLine
<drawline x1="" y1="" z1="" x2="" y2="" z2="" t1="" t2="" r="" g="" b="" thickness=""/>
<drawline_rel x1="" y1="" z1="" x2="" y2="" z2="" duration="" r="" g="" b="" thickness=""/>
Beams between Points in Space -
BeamXYZ - (Same as DrawLine but with thickness = 3.0)
<beamxyz x1="" y1="" z1="" x2="" y2="" z2="" t1="" t2="" r="" g="" b="" />
Beams between objects -
Beam
<beam obj1="" obj2="" t1="" t2="" r="" g="" b="" />
Beam offsets -
BeamOffset
<beamoffset y=?? />
Raises or lowers the point that beams are drawn to/from objects (as drawn via the <beam obj1 obj2 ... command).
The value offsets the attachment point in the Y-dimension (usually up/down). The beam command normally
draws to an object's defined origin point. However, many vehicle object definitions start at y=0.0
(where the tires meet the road), and work upward from there. If left alone, beams will be drawn to
the bottom of the object, and will often be obscured by terrain. Instead, you may wish the beam to be
drawn toward the top of the vehicle, where the antenna is. Accomplish this by providing a positive Y offset.
This is a global offset.
Conical Beams between objects -
ConeBeam
<conebeam obj1="" obj2="" t1="" t2="" r="" g="" b="" bw=""/>
Where bw is the beam-width. The default value of 1.0 corresponds to a 30-degree cone-beam.
Smaller values make narrower cones, and vice-versa.
6. Comments:
You may place comments within geometry files, or use the comments to comment-out
sections of a geometry file. The comment construct is:
<comment> whatever
...
</comment>
7. Including Files:
You may reference other files from within a geometry file.
The include construct is:
<include> filename </include>
8. Requesting Time:
This command is intended for use from live programs connected by sockets to WinFrame3D.
Often it is useful to synchronize, or have some notion as to the progress of the
viewer from a simulation which may not run in real-time. For example, the simulation
may either not want to get too far ahead, or fall behind the real-time clock which
governs the viewer. In such cases, the interactive program can ask the WinFrame3D
viewer for the time by sending the following command on the socket.
<time/>
WinFrame3D will respond with the current time in seconds since the start of the viewer
as a floating-point number character string. This is the same time reference which
governs the display (ex. T1 and T2). The string is sent back over the same socket
on which the command was received.
Example:
{
char tmpst[100];
send_soc( soc, "<time />\n"); /* Ask what time it is. */
send_soc( soc, "<nop />\n"); /* Send nop to flush socket. */
if (recv_soc( soc, tmpstr, 100 ) < 0) printf("socket error\n");
if (sscanf( &(tmpstr[3]), "%f", &Tnow )!=1) printf("error reading time (%s)\n", tmpstr);;
}
9. Fog Control -
By default, fog is normally "on", it's density is set to 0.0002, and it's color is
r=0.3 g=0.3 b=0.5.
- Fog can controlled by the following command-line options.
- Disable fog by: -fogoff or: -nofog
- Increase or decrease fog-density by: -fogdensity 0.0002
- Change fog color by: -fogcolor r g b
For example: -fogcolor 0.3 0.3 0.5
- Fog can be controlled within files by the following tags:
- Disable fog by: <fog density="0.0" />
- Enable fog and set density to xx by: <fog density="xx" />
- Change fog color by: <fog color="r g b" />
- Fog can also be controlled interactively on the Meta-menu.
See Other WF3d Command Line Options.
10. Background Color - <bgcolor r=0.3 g=0.3 b=0.6/>
- Normally background color is r=0.3 g=0.3 b=0.6.
- This command changes the background color to whatever you want.
- Example: <bgcolor r=0 g=0 b=0/>
(Makes black background.)
11. Adding Text -
<text name=? x=? y=? z=? xang=? yang=? zang=? r=?, g=?, b=?, scale=? thickness=?> YOUR TEXT HERE </text>
Defines and instantiates a named text object. It can be moved, rotated, shifted, etc..
Example:
<text name=textitem1 x=120 y=200 z=45 scale=10 thickness=2 r=1 g=0 b=0> This is the text. </text>
The name is required, but the other parameters are optional. Scale controls the size of
the text, and defaults to 1.0. Thickness controls the thickness or boldness, and defaults
to 1.0. The x,y,z values set the location of the text, relative to the lower left corner of the
text string. The r,g,b values control the text color, range between 0.0 and 1.0, and default
to a lime color. The xang, yang, and zang cause the text orientation to be rotated around the
x, y, or z axis, respectively, by the specified angle in degrees. If the angles are set to
zero or left-out, by default the string advances from left-to-right along the x-axis, and up-down
along the y-axis. The rotation angles can be used to change from the default orientation,
Other Options
face="camera" - Causes text to always face camera. Good for text attached to
objects. Keeps it readable from any viewing angle.
12. Camera Positioning -
You can move and point the camera via the following file or socket commands.
These can be used to pan the camera at predetermined rates and times.
<camera_move t1 t2 x, y, z />
<camera_move_rel duration x, y, z />
and
<camera_point t1 t2 x, y, z />
<camera_point_rel duration x, y, z />
13. Removing Objects -
Removing Object Instances:
<rmobj name=?? T=?? />
Name is the instance-name of the object to be removed.
T designates the time the object will be removed.
Relative times may be specified with rmobj_rel.
(The time will then be interpreted relative to when the command arrived to the viewer).
Example:
<rmobj name=tank1 T=10.5 />
<rmobj_rel name=tank1 T=3.5 />
Removing Object Definitions: (This also removes all instances automatically.)
<rmdef kind=?? T=?? />
Kind is the type-name of the object-definition to be removed.
T designates the time the object will be removed.
Relative times may be specified with rmdef_rel.
(The time will then be interpreted relative to when the command arrived to the viewer).
Example:
<rmdef kind=Tank_T72 T=10.5 />
<rmdef_rel kind=Tank_T72 T=3.5 />
14. Spheres, Cylinders, Disks, Boxes -
Several basic geometric shapes can be quickly defined through the following convenience functions.
See also: WF3d