Page 174
Quick Nav Bar
<<   Previous Contents
Selection
Op Index
Parent User Notes
Index
Glossary
Next   >>


Ray Trace

Quick Reference to Scripting Command
a=RAYTRACE(ANTIALIAS, recursion levels, "tracepath","tracefile") [0==no antialiasing]
Items in CAPS are 0/1 switches or switches with more options than 0/1.


Produced with the Ray Trace operation


Ray Trace Dialog

Beginning with WinImages F/x R6, WinImages includes a very powerful ray tracing engine. The intent here is to provide a means to define some otherwise almost impossible to create effects at superior levels of quality to be further used within WinImages F/x.

You can map images onto spheres, create realistic looking water (and many other substances!), and much, much more with just a few lines of our easy to learn ray tracing language. You can also, with additional effort, define very complex objects indeed, such as the faceted, refractive gems we provide as one example of some fairly interesting objects.

We've provided control of many useful characteristics - reflectivity, refraction, transparency, roughness, and much more. You can "bump map" surfaces for a compelling look when you need an organic effect - waves are a good example of that. You can use image maps to give character to objects, and you can bump map those as well. If you use images that have active alpha channels in them, you'll be able to control the transparency of an object with the image map itself, which can lead to some amazing results.

In short, this is a very capable tool. While you can certainly use it for such relatively mundane tasks as wrapping an image onto a sphere in high quality, as the images on this page amply demonstrate, that's just the tip of the iceberg!

Ray tracing is an art; the more you use it, the better at it you'll get. If you're new to the idea, then take your time, look at the examples we've provided, and be prepared to spend many hours experimenting. Your investment in time will be well rewarded, we promise you.

WinImages F/x's ray tracing operation uses concepts that are common throughout the ray tracing community, so things you learn here will also apply to other programs in various ways.

We look forward to seeing some of your creations!


For those of you new to Ray Tracing, we suggest you refer to our Ray Tracing Tutorial, where we provide an overview and some examples to get you started.

Ray Trace Controls

Anitaliasing

This set of radio buttons allows you to control the quality of the ray tracing operation. Direct Trace is fastest, and 25x Antialiasing provides the highest quality. It is best to design in Direct mode, then set the desired final quality. Image improvement beyond 4x anitaliasing is progressively more subtle; don't assume you need a high degree of antialiasing for every image - it simply isn't true.

Trace File

This selects the Trace File that controls the scene to be traced. The trace file contains a script that describes the objects in the scene, the lighting for the scene, and any animated parameters for the scene. Trace files are written using SceneScript; see below for details.

This may be edited manually or by using the browse button.

Trace Path

This selects the directory where the trace file exists on your computer.

This may be edited manually or by using the browse button.

Note:

Keep this in mind...
Both the path and filename are saved when dragged into the timeline, this means that separate "SceneScript" files can be chosen for different frames in the timeline.

Recursion

This controls how many times a light ray bounces from surface to surface. More levels results in increasing realism in the scene, particularly where transparent and refractive objects are encountered. Fewer levels result in higher speed. So, like the Anitialiasing setting, design with a low setting, and use a high setting for final quality work.

Ray Trace Language: "SceneScript"

When WinImages F/x ray traces a scene, it uses a "scene file" which describes the content to it, so it knows what and where to create objects, lights and empty space.

These scene files use a straightforward language called SceneScript that allows you to do anything from a very simple job to some enormously complex ones. What you create, of course, is up to you!

Most importantly, SceneScript is designed to be human-readable. While automated generation of SceneScript files was certainly part of the design goal, SceneScript files were also, in keeping with the design philosophy of all of WinImages F/x's other various control files, designed to be directly editable by you. For now, hand-written SceneScript files are the basis for all ray tracing using this operator. However, we do have another product, a separate 3D object editor, in development as R6 is being released. This will generate SceneScript files directly, and it is our intent to make it available to WinImages F/x users as soon as possible. Keep an eye on http://www.blackbeltsystems.com/ for news on this and other exciting developments.

Here's how scene files work. SceneScript files are processed first line first, last line last. For the most part, any setting or value you create remains set until set otherwise. So if you do this:

<color 1 1 1>
<color 1 0 1>

Then the effective color is 1,0,1, which is magenta, rather than 1,1,1, which is white. There is only one effective color at any one point in the SceneScript language stream.

This allows you to set up common elements of a scene, or part of a scene, first, and then they will be inherited just that way until you specifically change them.

This behaviour also allows you to use a group of settings (called a "trait") that are almost what you want, and then over-ride the elements that don't suit the needs of the moment. For instance, if you built a trait for water, you might set the color to blue as part of the trait. But perhaps today you're doing green water… so you use the trait normally, then right after applying it, you set the color to green, something like this:

<apply "water">
<color 0 1 0>

SceneScript follows a very flexible format. Items inside angle brackets (< and >) are considered items to be interpreted. Anything outside these brackets is completely ignored. That allows you to place commentary anywhere in any SceneScript file, which will be very helpful, we assure you.

Any amount of whitespace (blank lines, tabs, spaces) can appear anywhere outside of a language element, and they can appear within language elements wherever a space is shown in the language reference. For instance, the following two lines both work fine, just the same way:

<color 1 1 1>
     <color     1  1 1>

If a language element is not understood, it will be ignored.

When a language element requires more than one parameter, any that are left out are either set to zero (if they are numbers) or set to an empty string if they are text items. Generally, you should try to provide all parameters to keep from causing confusion.

SceneScript also has extensive, very easily managed provisions for animation of objects. Using the <keys> language element, you can replace any numeric parameter with a variable that is adjusted on a per frame basis for the length of the animation. These are literally "keyframed" values. They may be single static values, linearly interpolated values specificed for 2 or more frames, or even values that are interpolated using smooth splines! You can also use the <keys> statement to specifiy a single unchanging value to be used in place of any numeric parameter; this allows you to place objects along a baseline for example, and change that baseline later.


Language Reference

ambient
ambithresh
apply
atmosphere
axis
/axis
brilliance
btile
bumpdrama
bumpmap
bumpscale
color
color0
color1
color2
color3
color4
color5
depthmap
diffuse
dmap
expressions
imagemap
imagescale
keys
lib
libpath
lightsource
normalize
object
pop
position
pull
push
radius
reflectivity
refraction
rotate
rotation
roughness
scale
seed
smooth
specular
splined
stack
structure
/structure
texturemap
texturemap2
tile
trait
/trait
translate
translucency
transparency
unstack
uvtexture
viewlocation
viewtarget
vtx0
vtx1
vtx2

Language ElementPurpose
<ambient EXP>

This language element may be used inside a <trait> block.

EXP may range from 0.0 to 1.0. It represents the amount of light that is applied to an object when no light source directly shines upon that object. Another way to look at this is it means that this amount of illumination will apply to the object even when there are no lights. Use this term for the amount of illumination you want in shadowed areas of objects. The ambient amount is added to other light sources.
<ambithresh EXP>

This language element may be used inside a <trait> block.

EXP may range from 0.0 to 1.0. Note that a value of 0.0 is a special case that disables the feature.

<ambithresh> is the threshold which when exceeded by any of the three color components for a texture (of any kind) causes the ambient level to go to 100% (1.0) for that point.

To explain the use of this, imagine the following situation:

You're rendering a space station. On the one side, it is illuminated by the sun. On the other, it is very dark, being entirely in shadow. This is accomplished by setting the ambient term for the object to a low value.

You want to render windows on the station, some of which you desire to appear to be illuminated. These are placed on the bitmap texture for the station, along with other surface details. On the dark side, then, the windows should show brightly, though the rest of the surface texture is in the dark. However, under normal circumstances, with the ambient term set low, as these pass into the shadowed side, they darken with everything else.

Enter the <ambithresh> language element.

Draw the texture with the surface details using colors that are no more than (for instance) 75% brightness, or 192 in decimal or C0 in hex. Where you draw the windows, draw them in a color that is fully "on", such as full white (1 1 1 / 255 255 255 / FF FF FF) or yellowish (1 1 .5 / 255 255 127 / FF FF 7F). Now use <ambithresh .8> to tell the system that ambient is to be adjusted to 100% for those specific areas.

When you render the space station, those windows will glow just as brightly as they pass around the shadow side, while the rest of the surface detail, which is below the threshold, renders in shadow normally. The example images here make the benefits in this situation very plain.

This technique applies to any apparent self-lighting issue; office buildings, fireflies, spaceships, pilot lights on control panels, etc.

<apply "TRAIT"> This allows you to apply any named trait. A trait is defined by surrounding one or more language elements with the tags <trait> and </trait>. For instance, the following defines a useful matte surface characteristic:

<trait "matte">
<ambient .1>
<diffuse .7>
<brilliance 1>
<specular 0>
<roughness 0>
<transparency 0>
<translucency 0>
<reflectivity 0>
</trait>

To use all of these characteristics just like this, you would place the following in your scene:

<apply "matte">

This is the same as writing those characteristics out the longer way, but easier to look at and understand.

<atmosphere EXP> IOR (EXP) can reasonably vary from about 1.0 on upwards. IOR stands for "Index Of Refraction" and represents a controlling element for how much a light ray will bend when it transits the interface between the atmosphere and objects that have a differing IOR. This setting is related to the <refraction> language element, which lets you define an IOR for objects that exist in the atmosphere. The atmosphere, as we mean it here, is the otherwise empty space that you're creating objects in. Here are some reference IOR values for your use:

MediumIOR
Vacuum1.0
Air1.0003
Ice1.309
Water1.333
Alchohol (Ethyl)1.36
Flourite1.434
Glass1.46 to 1.66
Turpentine1.472
Glycerine1.473
Rock Salt1.544
Quartz1.544
Ruby1.72
Zircon1.923
Diamond2.417

<axis X Y Z "Name">

This language element may be used inside a <trait> block.

Each of X, Y and Z may be an expression.

The <axis> language element is the basis for controlling to positions of objects, singly or in groups. Each <axis> is matched by a </axis> command. Objects (and other <axis> commands) defined between these two elements are relative to the position of the previously defined <axis>.

This means you can do things like this:

<axis 0 0 0 "sun"> this defines a center location for the sun
Define the sun object here
  <axis 2 0 0 "earth"> this defines a position 2 to the right of the sun
  Define the earth object here
    <axis .5 0 0 "moon"> this defines a position .5 to the right of the earth
    Define the moon object here
    </axis>
  </axis>
</axis>

Within the above axis commands, you could place spheres, apply rotation commands, and use the <keys> language element to animate those rotations - you'd have your own little solar system going in no time.

The <axis> language element is affected by the use of the <translate> and <scale> language elements, which must preceed the <axis> element when you want them applied to one or more axis's (rather than, or as well as, to objects.)

This language element is also used in conjunction with the 3d <texturemap> element and the </axis> closure. In this regard, an <axis> is used to provide a central point of reference for a texture that is to cover two or more objects. For instance, if you wanted to build something out of triangles and apply a wood texture to them, you'd need to use an axis to give the 3d wood texture a spatial reference.

Here is an example of proper use:

<translate -0.75 -1 0>

<axis 0 0 0 "tp">
<apply "glossy"> for wood and marble
<apply "woodcolor">
<texturemap "wood" .0025 1 25>

</axis>

This language element may be used inside a <trait> block.

Used with the <axis> language element. See <axis> for details.
<brilliance EXP>

This language element may be used inside a <trait> block.

Brilliance enhances the effect of light as it nears a direct reflection. This tends to produce "hot spots." EXP might reasonably range from 1 to 50 or so, with 1 being the kind of result you'd want for a matte surface, and 30 being a very "hot" reflective hot spot as light hits the object and bounces almost straight back. Below 1, unrealistic optical effects occur.
<btile X Y>

This language element may be used inside a <trait> block.

Both X and Y may be EXP.

This statement allows you to tile a bumpmap texture 2 or more times across an object. The default situtation is once each way. The X and Y tilings are independent.

See also the <tile> language element.

<bumpdrama EXP>

This language element may be used inside a <trait> block.

EXP may range from 0 to anything you like. Useful settings will depend on the values in the bump maps you're using. If the bump map goes from 0 to 255 (in other words, if the full dynamic range of a greyscale bump map is utilized,) then useful values will normally be in the 1 to 100 range. Your milage may vary! See also the <bumpmap> language element.
<bumpmap "IMAGEFILE" | "source">

This language element may be used inside a <trait> block.

This allows you to specify an image already loaded (or to be loaded) into WinImages F/x that will be used to disturb the apparent surface angle of any object that it is attached to. For IMAGEFILE, the complete path and filename must be specified. If the image is already loaded within WinImages F/x, then it will be used from there. If not, it will be loaded and then used.

If you specify the explicit "source" command instead of an image file, the currently assigned source image will be used as the bump map. An additional benefit of this approach is that in the timeline, you can use an animation as the source input to the raytrace operator, thereby allowing you to use an animated image as a bump map.

Using WinImages F/x's "Save Project" menu item in the File Menu in conjunction with the various types of image maps can very useful, because it saves the settings of all the effects, as well as saving all images that were loaded when you use "Save Project."

You can then later use "Load Project" to immediately load all of the components of a ray tracing project, including all image and bump maps. Images that are not loaded at trace time will be automatically loaded, however.

See also the <bumpscale>, <imagescale>, <imagemap> and <bumpdrama> language elements.

<bumpscale X Y>

This language element may be used inside a <trait> block.

Each of X and Y may be an EXP.

This allows you to scale a bumpmap as it is applied to an object such as a rect using the <bumpmap> language element. <bumpscale 1 1> means no scaling, and <bumpscale 2 2> would result in a bumpmap that was twice as large, while <bumpscale .5 .5> would result in a bumpmap that was 1/2 as large. <bumpscale 2 1> would result in a bumpmap that was twice as large on the X (horizontal) axis, but normally sized on the Y (vertical) axis.

<color R G B>

This language element may be used inside a <trait> block.

Each of R, G and B may be an EXP.

Sets the full-object color (using <color> is the same as using all three <color0>, <color1> and <color2> statements to set all three colors to be the same) of all objects, until the next color statement (unless the object is imagemapped or texturemapped, see the <imagemap> and <texturemap> language elements for more on that):

Parameters are:

R=0.0 to 1.0, G=0.0 to 1.0, B=0.0 to 1.0

Here are some reference colors for you:

ColorR G B values
Black0 0 0
Blue0 0 1
Cyan0 1 1
Green0 1 0
Magenta1 0 1
Orange1 .5 .25
Red1 0 0
White1 1 1
Yellow1 1 0
<color0 R G B>

This language element may be used inside a <trait> block.

Each of R, G and B may be an EXP.

Sets the color of vertex 0 of triangles until the next color0 statement. Also used in <texturemap>:

Parameters are:

R=0.0 to 1.0, G=0.0 to 1.0, B=0.0 to 1.0

Here are some reference colors for you:

ColorR G B values
Black0 0 0
Blue0 0 1
Cyan0 1 1
Green0 1 0
Magenta1 0 1
Orange1 .5 .25
Red1 0 0
White1 1 1
Yellow1 1 0
<color1 R G B>

This language element may be used inside a <trait> block.

Each of R, G and B may be an EXP.

Sets the color of vertex 1 of triangles until the next color1 statement. Also used in <texturemap>:

Parameters are:

R=0.0 to 1.0, G=0.0 to 1.0, B=0.0 to 1.0

Here are some reference colors for you:

ColorR G B values
Black0 0 0
Blue0 0 1
Cyan0 1 1
Green0 1 0
Magenta1 0 1
Orange1 .5 .25
Red1 0 0
White1 1 1
Yellow1 1 0
<color2 R G B>

This language element may be used inside a <trait> block.

Each of R, G and B may be an EXP.

Sets the color of vertex 2 of triangles until the next color2 statement. Also used in <texturemap>:

Parameters are:

R=0.0 to 1.0, G=0.0 to 1.0, B=0.0 to 1.0

Here are some reference colors for you:

ColorR G B values
Black0 0 0
Blue0 0 1
Cyan0 1 1
Green0 1 0
Magenta1 0 1
Orange1 .5 .25
Red1 0 0
White1 1 1
Yellow1 1 0
<color3 R G B>

This language element may be used inside a <trait> block.

Each of R, G and B may be an EXP.

Sets the color of ghost color0 for the <texturemap2> language element until the next color3 statement.

Parameters are:

R=0.0 to 1.0, G=0.0 to 1.0, B=0.0 to 1.0

Here are some reference colors for you:

ColorR G B values
Black0 0 0
Blue0 0 1
Cyan0 1 1
Green0 1 0
Magenta1 0 1
Orange1 .5 .25
Red1 0 0
White1 1 1
Yellow1 1 0
<color4 R G B>

This language element may be used inside a <trait> block.

Each of R, G and B may be an EXP.

Sets the color of ghost color1 for the <texturemap2> language element until the next color4 statement.

Parameters are:

R=0.0 to 1.0, G=0.0 to 1.0, B=0.0 to 1.0

Here are some reference colors for you:

ColorR G B values
Black0 0 0
Blue0 0 1
Cyan0 1 1
Green0 1 0
Magenta1 0 1
Orange1 .5 .25
Red1 0 0
White1 1 1
Yellow1 1 0
<color5 R G B>

This language element may be used inside a <trait> block.

Each of R, G and B may be an EXP.

Sets the color of ghost color2 for the <texturemap2> language element until the next color5 statement.

Parameters are:

R=0.0 to 1.0, G=0.0 to 1.0, B=0.0 to 1.0

Here are some reference colors for you:

ColorR G B values
Black0 0 0
Blue0 0 1
Cyan0 1 1
Green0 1 0
Magenta1 0 1
Orange1 .5 .25
Red1 0 0
White1 1 1
Yellow1 1 0
<depthmap MIN MAX> MIN and MAX may be EXP. EXP can be any distance from the eyepoint. This statement changes the output of the raytracer from a realistic scene to one that is white where the scene's objects are closer than MIN, black where objects are more distant than MAX, and a grey value in between.

If both MIN and MAX are the same value, then the scene will be analyzed for the minimum and maximum object depth, and the greyscale result will reflect those as the MIN and MAX values. This doesn't work well for animations, because objects that move can change the effective depth of the scene.

Example output:


Normally traced object


Same object with <depthmap 4.5 9>

Tip:

...a little something from the propeller-heads at Black Belt Systems
You can use <depthmap> to create all kinds of depth related effects such as illumination or depth of field. Here's an example using the same object where we have created the illusion of depth of field using a layered image.

The above image shows three layers: original image, blurred image, and a depthmap image. These layers combine to create a master which blends from the blurred image to the original image at a rate controlled by the <depthmap> statement.

Here is the layered image setup. Both the original and the blurred copy of the original are in normal mode. The depth map is in Inverted Grey Mask mode and Localstack is on for it so that the masking will only affect the blurred copy. If the unblurred image were higher in the layer stack, you'd want to use Grey Mask mode instead of Inverted grey Mask. Note the use of factor set to 200 to increase the effect of the depthmap layer.

In the above example, because the top layer was a blurred copy, the blend occurs between blurred and non-blurred. If instead it had been a copy where you had darkened the image, then the object would get darker, the further it was from the viewpoint. Again, you can apply this to any effect.

Here's another example where we used variance instead of blur.

<diffuse EXP>

This language element may be used inside a <trait> block.

EXP controls how much an object responds to direct lighting. Its effect is modified by the <brilliance> language element. This is the conceptual opposite of the <ambient> term, which illumiates without reference to a light source. <diffuse> illuminates only in reference to light sources.
<dmap "T" P1 P2 P3>

This language element may be used inside a <trait> block.

T is a quoted name for a decision mapping method. P1, P2 and P2 may be EXP.

Decision mapping allows you to use a decision metric (such as a checkerboard) to decide whether to apply the <texturemap> or <texturemap2> language element on a particular point for any object.

For instance, you can set up <texturemap> to generate marble; then set up <texturemap2> to generate wood. Then, using the checkerboard decision map, you can create a checkerboard that alternates between marble and wood.

The following decision maps are supported:

NameP1P2P3Details
checker Size n/a n/a Switches back and forth in a classic checker pattern
noise variance threshold gain applies noise as a switch

Expressions Anywhere in a SceneScript file, an algebraic expression may be used where EXP is called for. Expressions may be simply a number or a variable name...

3.225
yrotation

Or they may be a compound mathematics expression, denoted by an initial exclamation point:

!2+2

Compound expressions may contain one or more numbers and/or one or more variables (see the <keys> language element for more on variables) and one or more instances of certain mathematical functions.

Variables must be defined prior to use; otherwise, they evaluate to zero. Expressions may not contain any whitespace at all, no exceptions whatesoever; in other words, this is legal...

!sin(3+sqrt(rad(2.5)))

...but none of the following are legal:

!sin( 3+sqrt(rad(2.5)))
!sin(3 +sqrt(rad(2.5)))
!sin(3+ sqrt(rad(2.5)))
!sin(3+sqrt( rad(2.5)))
!sin(3+sqrt(rad(2.5 )))
!sin(3+sqrt(rad(2.5) ))
!sin(3 + sqrt( rad( 2.5 ) ) )

Compound expressions are evaluated in this order:

  • Parenthesis, variables and functions.
  • Unary + and - signs
  • Powers: (symbol: ^)
  • Times, division, and modulus (*, / and %, respectively)
  • Addition and subtraction

Here are some examples, using the Y value of translate command and two example variables defined using the <keys> language element:

<keys "yrot" 1 0 120 357>
<keys "pi" 1 3.141592653>

<translate 0 0 0>
<translate 0 !2+2 0>
<translate 0 !45.5+yrot 0>
<translate 0 !10*yrot 0>
<translate 0 !sqrt(yrot)^2 0>
<translate 0 !pi/2 0>
<translate 0 !sqrt(pi/2) 0>

Aside from these arbitrary examples, let's go through one where the need for a compound expression is clear.

Imagine you have a cylinder that you want to be part of a model of a space station. You're going to use this in four places; as four "spokes" that lead to the rim of the station. Accordingly, you need to rotate instances of the cylinder into the correct positions for the four spokes. So far, so good - that's easily done with the <rotate> language element.

You could render a single frame with appropriate set of 90 degree values, and it would look fine.

Now consider the idea of animating the station. We want to make it spin around the same axis that the cylinders are defined around. But you already are using the <rotate> element to control the cylinders - so you can't use it again to rotate them from there.

Here's the solution (and it's easy):

Instead of this, which specifies a single non-moving rotation of 90 degrees for a cylinder:

<rotate 0 90 0>

Use this...

<keys "yrot" 1 0 120 367>
<rotate 0 !90+yrot 0>

...which gives you the constant 90 degree offset you need, and adds the animated rotation value to that. The cylinder is initially oriented by the 90 degree term, and rotated appropriately by the variable yrot. Nice, eh?

Available functions for use in compound expressions include:

FunctionDetails
abs(expression)Absolute Value
acos(expression)Arc-Cosine
asin(expression)Arc-Sine
atan(expression)Arc-Tangent
ceil(expression)Ceiling (nearest whole number > expression)
cframe(0)Returns current frame as number 1 to tframes()
cos(expression)Cosine
cosh(expression)Hyperbolic Cosine
deg(expression)Converts radians to degrees
exp(expression)Exponential
floor(expression)Floor (nearest whole number < expression)
hyp(expression,expression)Hypotenuse of X, Y
linv(expression)Takes frame number as parameter, returns linear value 0 to (tframes(0)) as 0-1
log(expression)Natural Log
log10(expression)Log, base 10
loopv(expression)Takes frame number as parameter, returns linear value 0 to (tframes(0)+1) as 0-1
rad(expression)Converts degrees to radians
sin(expression)Sine
sinh(expression)Hyperbolic Sine
sqrt(expression)Square Root
tan(expression)Tangent
tanh(expression)Hyperbolic Tangent
tframes(0)Returns total number of frames in the sequence
Note that all transcendental functions expect arguments in radians
<imagemap "IMAGEFILE" | "source">

This language element may be used inside a <trait> block.

This allows you to specify an image already loaded (or to be loaded) into WinImages F/x that will be used to supply the coloration of any object that it is attached to.

For IMAGEFILE, the complete path and filename must be specified. If the image is already loaded within WinImages F/x, then it will be used from there. If not, it will be loaded and then used.

If you specify the literal parameter "source" instead of a complete path and filename, then the currently assigned source image will be used as the image map, instead of a file being loaded from an image. An additional benefit of this approach is that in the timeline, you can use an animation as the source input to the raytrace operator, thereby allowing you to use an animated image as an image map.

Using WinImages F/x's "Save Project" menu item in the File Menu can be very useful, because it saves the settings of all the effects, as well as saving all images that were loaded when you use "Save Project." You can then later use "Load Project" to immediately load all of the components of a ray tracing project, including all image and bump maps, as long as they were loaded at the time you saved the project.

The ray trace command will load required images automatically if they are not already loaded at execution time.

Images used for imagemaps may contain alpha channel information (use TRIM, Targa, and TIFF files to save images with alpha information.) If they do contain alpha information, then the transparency of the alpha channel is applied to the object, which can be very useful.

Note:

Keep this in mind...
Transparent image map regions still filter colors

You should be aware that even when an imagemap is 100% transparent due to a fully-on alpha (A) channel transparency for a pixel, the RGB color of the pixel(s) involved is still used to filter scene elements viewed through the transparent pixel(s).

This means that if pixels in the image are full white (255,255,255) then objects will be filtered through a "clear" surface. If the color of the transparent pixel is red (255,0,0) then objects seen through the pixel(s) will be red. Transparent colors multiply the colors further out along a ray, so white is essentially 1,1,1 and will result in the color completely passing through, while red as described just previously is 1,0,0 and will only pass red information - 0 multiplying anything being 0, the green and blue channels will be forced to black.

The color you always want to avoid having in a transparent pixel is black: 0,0,0. Black will result in no color passing through, and this will render useless any transparency in the map image.

See also the <texturemap>, <imagescale>, <bumpmap>, <bumpscale> and <bumpdrama> language elements.

<imagescale X Y>

This language element may be used inside a <trait> block.

Each of X and Y may be an EXP.

This allows you to scale an image as it is applied to an object such as a rect using the <imagemap> language element. <imagescale 1 1> means no scaling, and <imagescale 2 2> would result in an image that was twice as large, while <imagescale .5 .5> would result in an image that was 1/2 as large. <imagescale 2 1> would result in an image that was twice as large on the X (horizontal) axis, but normal sized on the Y (vertical) axis.

<keys "name" A B[ C D]> "name" is required. A, B and the optional C,D... E,F... pairs may be EXP.

The <keys> language element is the means used to implement object animation through control of parameter values as they relate to frames of an animation.

Values are pairs: A, a frame number (this is treated as an integer value), followed by a B, a floating point numeric parameter. Note that expressions are allowed in <keys> statement values, which enables <keys> to use one another's values. However, in order to use a value from one <keys> statement inside another, that value must have been defined prior to it's use, or it will evaluate to zero.

Warning:

Careful!!!
There are specific restrictions on the first parameter, the name of the variable. It may be up to 30 characters in length, and must be placed in quotes. Variable names must be alphabetic, numerals are not allowed. Variable names should not begin with the characters "e" or "E".

Ideally, you would know the exact length of the animation you plan, and set the keys up for the exact frames you want. However, this is not always possible (and there are other reasons why the keys might not be exact... such as needing to generate a shorter animation to see if the general motion is correct - a lot of time can be saved that way.) So WinImages F/x will check the framenumber in the last frame of each <keys> statement. If the last frame is not the same as the animation length being generated, all frames in the tween will be scaled to be as close as possible to the correct frame number (proportionally speaking) in the current animation. it is always better to have a longer tween specification than the animation length, rather than a shorter one, as the correction can be more accurate. We'll point out a practical example below.

<keys> allows you to provide a list of keyframed values that may be used in place of any numeric parameter in any other command (not inside other keys commands!)

You can put one or more values in a variable. Here is an example of a single value use by name. Note the specification of the frame where the value starts, followed by the value:

<keys "yrotation" 1 180>

Here is an example of how to set up a linearly interpolated value with several keys designed specifically for a 120 frame animation:

<splined 0>
<keys "yrotation" 1 0    60 45    120 357>

Here is an example of the same keys, splined:

<splined 1>
<keys "yrotation" 1 0    60 45    120 357>

Both of the above examples set up a rotation parameter that slowly changes from 0 to 45 degrees from frame 0 to frame 60 (half way through the animation) and then changes from 45 degrees to 357 degrees in the last half of the animation, from frame 60 to frame 120.

You might then use this in the scene as follows:

<rotate 0 yrotation 0>

Note the lack of quotes when using the keyframed variable; you only use quotes to define the variable.

It is very important that you begin each keyframe set with frame 1, and if there are more than one key in the set, it is critical that the last key specifies the last frame of the animation. You can place keys anywhere in between, at any or all frames.

Further detail on the automatic length corrections...

In the above example, which was designed for 120 frames, WinImages F/x can and will automatically rescale all the frame numbers when the actual sequence length in the program differs from the <keys> statement. For instance, if you set up for a 60 frame timeline and filmstrip, all the frame numbers will be scaled by 1/2. Frame 120 will be applied in frame 60, frame 60 at 30, and so forth. If you set up for an animation, frame 120 will be applied at frame 240, and so on. While the correction is made as best as possible, it is still best to design the <keys> so that they are exact for the target length of the animation - this allows you the most precise control of all your parameters.

There is a fairly simple method you can use to explicity control frame numbers over a large number of keys statements; it is practical as long as there aren't a large number of key frames. Basically, instead of using a number to specify the frame numbers, you can use variables instead. For instance:

<keys "yr" 1 0 90 300 120 357>

...sets up a 120 frame key with a keyed frame at 3/4ths. But so does this:

<keys "lastframe" 1 120>
<keys "tqframe" 1 90>
<keys "yr" 1 0 tqframe 300 lastframe 357>

...with the benefit that when you change the "lastframe" and "tqframe" variables, the "yr" variable changes too. In the case where a number of parameters are being changed and keyed against the 3/4ths point and the first and last frames, this mechanism could be used to explicitly change the keyframe values for all keys involved. This in turn ensures that the calculations for the keys are precise at all times.

See also the <splined> language element and the Expressions section of the documentation.

<lib "LIBRARYFILE">

This language element may be used inside a <trait> block.

This allows you to specify a file that contains useful definitions, such as textures or colors you commonly use. See also the <libpath> language element.
<libpath "PATH"> This allows you to specify a path where the scene file will "look" for library files. For instance, if your scene files are normally kept in:

c:\scenes\

...and you have a scene file called "myscene.w3d", then the following language snippet illustrates reasonable usage:

<libpath "c:\scenes\">
<lib "myscene.w3d">

Together, these work to build the full name:

"c:\scenes\myscene.w3d"

The benefit of using the <libpath> language element is that if you keep your library elements in one location, you can avoid typing the path to them all the time, which both reduces the work you have to do and the potential for annoying errors.

<lightsource 0/1>

This language element may be used inside a <trait> block.

The parameter is an integer, either 0 or 1.

This language element allows you to define an object as a light source; this means that you can put a light inside it, and the light will come through the object. This is useful for making suns, light bulbs, candles, panel lamps, any object that would emit light.

Normally, objects in the tracer block light - so for the special case where one is to emit light, you need to use <lightsource 1> to make it work. You should remember to use <lightsource 0> to turn the option back off, or else make use of the <stack> commands to save and restore the environment so that all objects defined afterwards do not pass light also.

<normalize> This is a shortcut language element that is exactly equivalent to:

<scale 1 1 1>
<rotate 0 0 0>
<translate 0 0 0>

A commonly encountered scenario is to build an object centered around zero, and then scale, rotate and translate it away. In order to build the next object around zero, a convenient method is to use <normalize>.

Note:

Keep this in mind...
You might also want to look at the stacking commands for another way to control these and other elements of the environment: <stack> and <unstack>.

For instance, we provide a library file that contains a fair number of triangles that define a cut gem as a unit. These are defined around zero, so that once placed in the scene file, they may be placed anywhere using <rotate>, <scale> and <translate>. Once this is done, <normalize> resets the language for the next such definition. Here's how that looks:

<apply "diamond">
<rotate -45 0 0>
<scale .5 .5 .5>
<translate 1 3 0>
<color 1 1 1>
<structure>
<lib "dia8.w3d">
</structure>
<normalize>

Now, you don't have to use <normalize>, as setting all three of the above mentioned language elements to new, reasonable values prior to a objects being defined will have the desired result, but many times you won't be rotating, or scaling, etc., and then using <normalize> will be very convenient. We like to use it after every object definition, just so we know where we are when we start...

<object TYPE "NAME"> 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...

<apply "matte">
<vtx0 -.5 -.5 0>
<vtx1 .5 -.5 0>
<vtx2 -.5 .5 0>
<color 1 0 0>
<object rect "test rectangle">
<object bound>

...and then follow it up with a light:

<position 45 45 45>
<color 1 1 1>
<object light "light one">

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 specifiy an object as a light source!) so that moving sources of illumination may be defined.

<position X Y Z>

This language element may be used inside a <trait> block.

Each of X, Y and Z may be an EXP.

This sets the X, Y and Z center position for spheres. See also the <object> language element.

<radius EXP>

This language element may be used inside a <trait> block.

EXP sets the radius for spheres. See also the <object> language element.
<reflectivity EXP>

This language element may be used inside a <trait> block.

EXP sets how reflective a surface is. 0.0 is not at all, and 1.0 is 100% reflective.
<refraction EXP>

This language element may be used inside a <trait> block.

EXP represents an IOR that can reasonably vary from about 1.0 on upwards.

IOR stands for "Index Of Refraction" and represents a controlling element for how much a light ray will bend when it transits the interface between the object and the atmosphere, when the atmosphere (or another object contained within this one) has a differing IOR. The gems to the right demonstrate varying degrees of refraction and internal reflectivity to good effect.

If you want to create transparency that does not refract - for instance, when you're using a texture with an alpha channel on a rectangle, and where it's clear, you want it to "dissapear" rather than act as a transparent substance - then just ensure that the IOR for the plane is the same as the IOR for the atmosphere and it'll work as you expect. If you have a differing IOR, it'll act like a clear material that refracts, instead.

This setting is related to the <atmosphere> language element, which lets you define an IOR for the atmosphere. The atmosphere, as we mean it here, is the otherwise empty space that you're creating objects in.

Here are some reference IOR values for your use:

MediumIOR
Vacuum1.0
Air1.0003
Ice1.309
Water1.333
Alchohol (Ethyl)1.36
Flourite1.434
Glass1.46 to 1.66
Turpentine1.472
Glycerine1.473
Rock Salt1.544
Quartz1.544
Ruby1.72
Zircon1.923
Diamond2.417

<rotate X Y Z>
or
<rotation X Y Z>

This language element may be used inside a <trait> block.

Each of X, Y and Z may be an EXP.

Each EXP sets the rotation for an <axis>, rect, sphere or tri <object>. Rotation is defined in degrees, and may be fractional (for example, 45.5 degrees is OK.) Rotation does not affect lights, because they are "round featureless point sources" which means that they don't have a direction, per se.

When defined prior to the instantiation of an axis, like this...

<rotate 0 45 0>
<axis>
Define objects affected by the axis;
</axis>

...then the rotate command affects the <axis> itself. In order to rotate the object within the axis, rather than the <axis> proper, you would do this instead:

<axis>
<rotate 0 45 0>
Define objects affected by the axis;
</axis>

See also <axis>, <scale> and <translate>.

<roughness EXP>

This language element may be used inside a <trait> block.

EXP can vary from 0 upwards. 0 is a very rough surface, and 100 is a comparatively smooth surface. This value is used in controlling how light reflects from a surface, especially as the light reflection approaches a direct (180 degree) reflection. For a highly polished object, use a large value. FOr a rough object where you want a large degree of diffusion of light, use a small value.
<scale X Y Z R>

This language element may be used inside a <trait> block.

Each of X, Y, Z and R may be an EXP.

This scales the objects or axis' that it is applied to. Set this first, then define the object(s). For most uses, objects should be defined around zero. Axis are scaled relative to parent axis, or to the world co-ordinate space if there is no parent axis. There are two ways to use this language element; in the XYZ form and the XYZR form.

The R parameter only applies in the case where the <scale> language element is applied to a sphere, when it scales the radius of the sphere independently of the position from the parent axis or world space. Otherwise you may use the XYZ form of the command, the R is not required. However, note that when the R is not supplied, it is set to zero, which will make spheres shrink out of view, so when making spheres, be sure to use XYZR.

Examples:

<scale 1 1 1> results in an object of exactly the size it is defined with it's geometric elements. <scale 1 .5 1> results in an object that is only 1/2 as large on the Y axis, but normally sized on X and Z. <scale 2 2 2> results in a double-sized object.

See also <translate> and <rotate>.

<seed EXP> EXP may be an any number, however, it is evaluated as an integer, meaning that any fractional part has no effect on the random number generation.

This language element is used to "seed" the random number generator that underlies the texture engine. See the <texturemap> language element for details on textures.

It is suggested you use this once, at the head of each scene script. This will ensure repeatable behaviour from the texture generator.

<smooth> The <smooth> language element takes a group of triangles within a <structure> and </structure> element pair and analyzes them for shared vertexes. When triangles are found to share vertexes, they will be smoothed as long as the angles between the triangles are less than 85 degrees. This means that a 90 degree turn in a triangulated surface will remain sharp, while a surface made in a "slower" curve will be smoothed.

Smoothing is done using a process related to bump-mapping; the geometric details of the triangles are not modified, only how light reflects off of them is. This means that the edges of objects seen in profile will retain the precise edges defined by the original set of triangles. Only surfaces that are not seen in profile will appear smoothed.

Keep in mind that the <smooth> language element must appear after the object definitions for the triangles, and before the closing </structure> language element.

<specular EXP>

This language element may be used inside a <trait> block.

EXP sets the amount of light that "burns" to the light color near the highlight of an object. A value of 1 will result in a highly specular surface, while a value of 0 will result in no specular highlight display.

This works in conjunction with the <metal> language element. If the object is set to be metal, then the light color is filtered by the surface color of the object. If the object is not set as metal (generally meaning, it's a non-conductive surface) then the specular highlights will tend to the color of the light without filtering by the surface color.

<splined 0/1>

This language element may be used inside a <trait> block.

The parameter is an integer, either 0 or 1.

This turns splined variable interpolation on and off for use with the <keys> language element. See <keys> for more information.

<stack> The <stack> command, or it's synonym <push>, is used to take a complete copy of the current environment and save it on a stack of such information. The information stack may be up to 1024 deep; if you get over 1024 levels deep, further stacking commands have no effect.

Typically, <stack> or <push> is used to save the current state, unusual and/or extensive changes are made for a particular object or group of objects, and the the <unstack> language element (or it's synonyms, <pop> and <pull>) are used to restore the previous state.

This is a classic "programming stack", in the sense that the first thing you push onto it will be the last thing pulled off.

Here is the general concept:

Set up initial set of conditions
Create the objects that use those conditions
<stack> (a copy of the current conditions is saved)
Modify the initial conditions as extensively as you like
Create objects using the modified conditions
<unstack> (copy taken off the stack overwrites the changes)
Create further objects using initial conditions

<structure> This term should be used before every group of objects that are conceptually one item; the group should then be followed by the </structure> element. The <structure> language element pairs tell the ray trace engine that each differing object (rect, triangle, sphere) between them is a member of the same physical object. This is used in the refraction of light and calculation of translucency, and so it is particularly important to use this with "solid" items (such as the gems we provide as an example.)

To explain a little more, when you make a complex object that is to have the appearance and lighting behaviour of being solid, you construct it out of the relatively simple primitive objects the tracer can render: Triangles, spheres and rectangles. In the case of our faceted gem examples, the objects are made up of a fairly large number of triangles, placed and sized precisely where the faceted surfaces of a gemstone would be.

Because refraction takes place when light transits from an objct of one IOR (index of refraction) to an object (or non-object) with a differing IOR, the tracer must know when light is entering and leaving a specific multi-primitive object in order to correctly adjust the light rays. In the case of these gems, light can enter the object through a facet and it can exit the object though a facet; in both instances, the IOR is known to change, so the light ray is bent (refracted) appropriately.

It is entirely possible for an object to have internal structures of the same (or different) IOR and/or translucency; if that is the case, the renderer knows what to do based on which structure the objects belong to.

With all that in mind, the following shows how to use the <structure> and </structure> language elements:

<structure>
series of geometric items that make up one physical object
</structure>

<structure>
series of geometric items that make up another physical object
</structure>

Remember: If you don't want light to bend, make sure you set the IOR of your objects to the same value as that of the atmosphere!

See also: The </structure> language element

</structure> This term should be used after every group of objects that are conceptually one item.

See the <structure> languge element for details.

<texturemap "T" P1 P2 P3>

This language element may be used inside a <trait> block.

Each of P1, P2 and P3 may be an EXP.

The <texturemap> language element allows you to apply procedural textures to objects. This has priority over imagemaps, so if you texturemap, any imagemap will not appear. Bump mapping works with texturemaps. T is the name of the specific texture. P1, P2 and P3 are the parameters (if any) to the texure being used; if a texture uses less than the available parameters, you do not need to specify the remaining ones.

The texturemap language element uses the three color statements (<color0>, <color1> and <color2>) to source colors to be used in the various textures. Not all textures use all the colors; colors used are indicated.

In the following table, the suggested numbers are for a sphere of radius 4. As object sizes in the rendering space change, the textures may change as well, requiring readjustment of parameters. However, texture behaviour is independent of rendering resolution.

Note:

Keep this in mind...
If you desire to use a texture as a 3d "global" texture over more than one object, you must use the <axis> language element. The <axis> and </axis> language elements give the 3d texture engine a point of reference.

See also the <seed> language element.

Name P1 P2 P3 Description
specks threshold
0.0-1.0 - try .99
n/a n/a Creates speckles of color1 against color0
sinex Amplitude 0-1 Frequency 1-n n/a Creates sine(x position) of color1 against color0
sinexy Amplitude 0-1 Frequency 1-n n/a Creates sine(x position) of color1 against color0 and sine(y position) of color2 against color0
cloud Turbulence - try 8 Scatter - try .01 Threshold - try .66 Creates clouds against sky ranging from c0 at base of sky to c1 at dome of sky
marble Complexity - try .01 Turbulence - try 15 n/a Creates Marble of color1 (vein) against color0 (matrix)
wood Complexity - try .0025 Turbulence - try 1 Burl - try 25 Creates Wood of color1 (pith) against color0 (skin)
sediment Complexity - try .05 Disturbance - try .05 Zonedensity - try 50 Creates Sedimentary layers of color2 (layers) against color0 at base (matrix) and color1 at max altitude (matrix)
iris cycles (try 20.7) color mix amplitude Color 2 distance Creates radial iris color1 against color0 from center shifting to color2 at edge.
checker X distance Z distance n/a Creates checker texture of color0 and color1.

<texturemap2>

This language element may be used inside a <trait> block.

This statement is exactly like the <texturemap> language element, except it uses the <color3>, <color4> and <color5> statements to control the colors it generates.

<texturemap2> works with decision mapping to allow you to have two color textures active and mixing for any object. See the <dmap> language element for details on decision mapping, and the <texturemap> language element for details on using textures.

<tile X Y>

This language element may be used inside a <trait> block.

Both X and Y may be EXP.

This statement allows you to tile a bitmap texture 2 or more times across an object. The default situtation is once each way. The X and Y tilings are independent.

See also the <btile> language element.

<trait "NAME"> This allows you define named traits. A trait is defined by surrounding one or more language elements with the tags <trait> and </trait>. For instance, the following defines a useful matte surface characteristic:

<trait "matte">
<ambient .1>
<diffuse .7>
<brilliance 1>
<specular 0>
<roughness 0>
<transparency 0>
<reflectivity 0>
</trait>

You can use this trait using the <apply> language element.

The following language elements are recorded when used within a <trait> </trait> defining pair:

<ambient EXP>
<ambithresh EXP>
<axis X Y Z "Name">*
</axis>
<brilliance EXP>
<btile X Y>*
<bumpdrama EXP>
<bumpmap "IMAGEFILE">
<bumpscale X Y>*
<color R G B>*
<color0 R G B>*
<color1 R G B>*
<color2 R G B>*
<color3 R G B>*
<color4 R G B>*
<color5 R G B>*
<diffuse EXP>*
<dmap "T" P1 P2 P3>*
<imagemap "IMAGEFILE">
<imagescale X Y>*
<lib "LIBRARYFILE">
<lightsource 0/1>
<position X Y Z>*
<radius EXP>
<reflectivity EXP>
<refraction EXP>
<rotate X Y Z>*
<rotation X Y Z>*
<roughness EXP>
<scale X Y Z>*
<specular EXP>
<splined 1/0>
<texturemap "T" P1 P2 P3>*
<texturemap2 "T" P1 P2 P3>*
<tile X Y>*
<translate X Y Z>*
<translucency EXP>
<transparency EXP>
<uvtexture "T" P1 P2 P3>*
<vtx0 X Y Z>*
<vtx1 X Y Z>*
<vtx2 X Y Z>*

* Each of X, Y, Z, R, G, B, P1, P2 and P3 may be an EXP.

</trait> See: <trait>, above
<translate X Y Z>

This language element may be used inside a <trait> block.

Each of X, Y and Z may be an EXP.

This moves an <axis> to the specified position by adding the values provided to the X, Y and Z positions of the axis the object is based on. If the object is not defined within the scope of an <axis>, then this language element has no effect.

See also <axis>, <scale>, and <rotate>.

<translucency EXP>

This language element may be used inside a <trait> block.

EXP describes the distance over which an object becomes opaque as a ray passes through it. Zero is a special case; when set to zero, translucency is not evaluated (the object is perfectly clear if transparent.)

If you have a sphere of radius 1, then setting translucency to 2 (the distance of the diameter) is equivalent to saying that the sphere is opaque when viewed through the center, and more transparent towards the edges. You should keep in mind that when an object is translucent, but has a different index of refraction than the medium from which a ray enters and/or leaves it (EG, the atmosphere's IOR is 1.0 and the sphere's is 1.5) then the rays warp around inside the object and take longer paths, so the translucency of the object becomes a great deal more apparent.

Translucency has interesting effects inside objects that involve multiple internal reflections, such as a faceted gem. A significant amount of translucency will cause the gem to become darker along long reflective paths; the net result is typically that the edges appear clear and show the sparkle that one would expect, but that the deeper view into the gem darkens. This is exactly how most gems behave in real life - only the very finest of colored gems exhibit extreme clarity. This is why extremely clear rubies and emeralds can be worth more than diamonds by carat weight.

See also: Language elements <transparency>, <refraction> and <atmosphere>

<transparency EXP>

This language element may be used inside a <trait> block.

EXP sets an object's transparency. 0.0 is fully opaque, and 1.0 is fully transparent.

When an object is partially transparent, the color of the object (or the color of the image map at the relevant point on the object) "filters" the color of the light rays. One lurking "gotcha" is if you make a plane, bump map it (for water, for instance) and make it reflective, it'll work fine... but then, if you make it transparent - at all - sometimes it will turn completely black. Why? Because the color of the plane is black, and that's what filters the light. The solution is to simply make the color of the plane white (<color 1 1 1>) and then the transparency will work as expected. Likewise, if you make the water green or blue, that will work also. Just don't forget to make it some color!

<unstack> This language element is used to recover information that has been stored on the stack using the <stack> command or it's synonym, <push>.

Available synonyms for <unstack> are <pop> and <pull>.

See the <stack> language element for details.

<uvtexture "T" P1 P2 P3>

This language element may be used inside a <trait> block.

T is a quoted name for the uvmapping technique. P1, P2 and P3 may be EXP].

<uvtexture> allows you to apply procedural texture to objects that will affect how the objects react to light.

The following UV textures are available:
Name P1 P2 P3 Details
dunes Variation 1 Variation 2 Amplitude Creates a texture ideal for sand dunes
waves Amplitude Complexity Complexity over time Creates waves over time. This texture is set to create a seamless moving wave effect over the period of the timeline. So if you set the timeline for 30 frames, it will loop in 30. If set for 120, then it will take 120 frames to return to the start.
sines X amplitude Z amplitude Frequency Creates sine waves.

<viewlocation X Y Z> X, Y and Z may be EXP.

<viewlocation> tells the ray tracer where you are looking from. If not set, the view location is 0x, 0y, 14z.

See also the <viewtarget> language element.

<viewtarget X Y Z> X, Y and Z may be EXP.

<viewtarget> tells the ray tracer where you are looking. If not set, the view target is 0x, 0y, 0z, which is the center of the ray tracer's universe.

See also the <viewlocation> language element.

<vtx0 X Y Z>

This language element may be used inside a <trait> block.

Each of X, Y and Z may be an EXP.

Sets the X, Y and Z positions for the first vertex of a triangle. See also <vtx1> and <vtx2>. Triangles are defined in a counter-clockwise order. Without rotation, <vtx0> can be thought of as the lower left corner. Vertexes are also used to defined rectangles. Treat the rectangle definition as a triangle, without the upper right corner having to be specified.

<vtx1 X Y Z>

This language element may be used inside a <trait> block.

Each of X, Y and Z may be an EXP.

Sets the X, Y and Z positions for the second vertex of a triangle. See also <vtx0> and <vtx2>. Triangles are defined in a counter-clockwise order. Without rotation, <vtx1> can be thought of as the lower right corner. Vertexes are also used to defined rectangles. Treat the rectangle definition as a triangle, without the upper right corner having to be specified.

<vtx2 X Y Z>

This language element may be used inside a <trait> block.

Each of X, Y and Z may be an EXP.

Sets the X, Y and Z positions for the third vertex of a triangle. See also <vtx0> and <vtx1>. Triangles are defined in a counter-clockwise order. Without rotation, <vtx0> can be thought of as the upper left corner. Vertexes are also used to defined rectangles. Treat the rectangle definition as a triangle, without the upper right corner having to be specified.

Examples

A Red Ball

Scene file for WinImages R6
Author - Ben Blish
For Black Belt Systems
January 2nd ... / 2000

Note that indentation shown is a matter of personal style; the author likes to flush objects left as shown here so there is a visual cue when the preceeding characteristics are instantiated in a specific object. Anything that works for you is fine, of course. Remember that if something isn't within a pair of angle brackets, the ray tracer ignores it.

Normally, we'd just include this trait from the library, but as an example, we'll just put it right here in the trace file:

<trait "matte">
    <ambient .1>
    <diffuse .7>
    <brilliance 1>
    <specular 0>
    <roughness 0>
    <transparency 0>
    <reflectivity 0>
</trait>

This sets up rotation, scaling and translation as "off":

    <normalize>

Here is the object we're going to trace:

Matte ball:
    <position 0 0 0> <radius 3>
    <apply "matte">
    <color 1 0 0>
<object sphere "My Sphere">
    <normalize>
<object bound>

And here is the light that makes it show up!

Light:
    <position 50 50 -75>
    <color 1 1 1>
<object light "light_1">

<viewlocation 0 0 14>
<viewtarget 0 0 0>

    <atmosphere 1.0>

Tri-Color Triangle

Scene file for WinImages R6
Author - Ben Blish
For Black Belt Systems
January 2nd ... / 2000

This simple scene demonstrates how to use the color0, color1 and color2 elements with a triangle. Note that there is no light - we don't need one, because right after applying matte, I turned up the ambient to 1, so the object is essentially lit by magic photons from the beginning of the universe, when WinImages was just a knot of cosmic string, waiting to... never mind. :-)

<trait "matte">
    <ambient .1>
    <diffuse .7>
    <brilliance 1>
    <specular 0>
    <roughness 0>
    <transparency 0>
    <reflectivity 0>
</trait>

Tri-color triangle:
    <apply "matte">
    <ambient 1>
    <vtx0 0 0 0>
    <vtx1 10 0 0>
    <vtx2 0 10 0>
    <color0 1 0 0>
    <color1 0 1 0>
    <color2 0 0 1>
<object tri "test">
<object bound>

<atmosphere 1.0>

<viewlocation 0 0 14>
<viewtarget 0 0 0>

See Also:

More Example Files

The W3D Sample Pages for basic W3D files you'll find useful.

Conversion Utilities

The 3D Exploration product, which can convert many 3D file formats to W3D.
The RAW Triangle to W3D Utility Converter


Quick Nav Bar
<<   Previous Contents
Selection
Op Index
Parent User Notes
Index
Glossary
Next   >>
Page 174

WinImages F/x, WinImages Morph and all associated documentation
Copyright © 1992-2007 Black Belt Systems ALL RIGHTS RESERVED Under the Pan-American Conventions

WinImages F/x Manual Version 7, Revision 5, Level B

HTML Documentation Management System © 1992-2007 Black Belt Systems