This is a child page. You can use Parent in the quick nav bar at the top or the bottom of the page to navigate directly back to the parent of this page. Some child pages are more than one level deep, and in that case will require more than one Parent click to reach the outermost document level. |
The <object> language element is the one that actually places items into the rendering space. Generally speaking, you set up the elements you want to apply to the object first, and then define the object.
When placing triangles, an additional modifier may be placed after groups of such triangles: See the <smooth> language element for details.
There are five types of objects you can place. Most have their own specialized geometric preconditions that must be set up before the object is placed. Here they are:
Object | Usage | Geometric Precursors |
---|---|---|
Rectangles | <object rect "name"> | <vtx0 X Y Z> <vtx1 X Y Z> <vtx2 X Y Z> Rects are set up just like triangles, the upper right corner is not specified. |
Triangles | <object tri "name"> | <vtx0 X Y Z> <vtx1 X Y Z> <vtx2 X Y Z> |
Spheres | <object sphere "name"> | <position X Y Z> <radius Number> |
Lights | <object light "name"> | <position X Y Z> |
Bounds | <object bound> | None |
In simple terms, the objects you use to construct images are the triangle (tri), sphere, and rectangle (rect). You illuminate these with lights, and tell the raytracer where groups of objects (except lights — they don't need or use bounds) are with one (or more) bounds.
Bounds are of special interest; you need at least one at the end of a scene file. You can use more than one. In many cases, you benefit from using more than one. A bound groups objects for the raytrace engine — in technical terms, it places them inside "bounding spheres."
If objects that are grouped in a small region — such as all of the triangles that make up one of the gem library composite objects — have their own bound statement, the ray tracer will run much faster. This is because it knows that unless a light ray hits that bounding sphere, it doesn't need to consider the triangles for the gem at all. This is because they are inside the sphere. The number of mathematical operations per ray are greatly reduced by this approach.
Some ray tracers don't handle bounding — some handle it automatically. This one puts you in the driver's seat. If it's all magic to you, just put one <object bound> at the end of each scene file you create and don't worry about it!
So, as a simple example, to create a scene with one plain red rectangle, you could do this...
...and then follow it up with a light:
Objects (except bounds) follow the <axis> and </axis> language elements. Because of this, you can translate, scale, and texture groups of items as one. You can also co-locate lights with one or more objects (and specify an object as a light source!) so that moving sources of illumination may be defined.