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. - Ray Trace example: Pyramid

Not much has been done with triangles up to this point. Triangles can come together to form something as simple as this pyramid to anything you can imagine. Most professional computer animation is constructed of triangles.

The image on the left is a brick texture we can use for an imagemap of the triangles. But image mapping on a triangle assumes a right triangle when it scales the image. This can be corrected for our pyramid, which uses equilateral triangles, by shearing the image 45°, as has been done with the image on the right. Now the imagemapping will un-shear the mapped image back to its original upright position.

Library:  <libpath "c:\w3\"  <lib "textures.w3d" Random Numbers:  <seed 35 The following keys act as variables for the easy manipulation of the pyramid. At any time, the corner points (A,B,C,D) or the apex (E) can be moved just by altering these keys. No other searching or altering is necessary in the script. Each key starts in frame 1 and sets the following value for all succeeding frames; basically that means a constant value during timeline generation:  <keys "Ax" 1 -3  <keys "Ay" 1 0  <keys "Az" 1 3  <keys "Bx" 1 3  <keys "By" 1 0  <keys "Bz" 1 3  <keys "Cx" 1 3  <keys "Cy" 1 0  <keys "Cz" 1 -3  <keys "Dx" 1 -3  <keys "Dy" 1 0  <keys "Dz" 1 -3  <keys "Ex" 1 0  <keys "Ey" 1 5  <keys "Ez" 1 0  <keys "av" 1 .5 Each of the following four triangles will be bound to two corner points and the apex defined by the keys above. This allows for complete control over the shape of the pyramid. Here is the pyramid object:  <normalize  <structure  <apply "matte"  <ambient av  <vtx0 Ax Ay Az  <vtx1 Bx By Bz  <vtx2 Ex Ey Ez  <color0 0 0 1  <color1 0 0 1  <color2 0 0 1  <imagemap "c:\imagemaps\brick1.jpg"  <object tri "tri_1"  </structure  <structure  <apply "matte"  <ambient av  <vtx0 Bx By Bz  <vtx1 Cx Cy Cz  <vtx2 Ex Ey Ez  <color0 0 0 1  <color1 0 0 1  <color2 0 0 1  <imagemap "c:\imagemaps\brick1.jpg"  <object tri "tri_2"  </structure  <structure  <apply "matte"  <ambient av  <vtx0 Cx Cy Cz  <vtx1 Dx Dy Dz  <vtx2 Ex Ey Ez  <color0 0 0 1  <color1 0 0 1  <color2 0 0 1  <imagemap "c:\imagemaps\brick1.jpg"  <object tri "tri_3"  </structure  <structure  <apply "matte"  <ambient av  <vtx0 Dx Dy Dz  <vtx1 Ax Ay Az  <vtx2 Ex Ey Ez  <color0 0 0 1  <color1 0 0 1  <color2 0 0 1  <imagemap "c:\imagemaps\brick1.jpg"  <object tri "tri_4"  </structure Ground:  <normalize  <structure  <apply "brightmatte"  <vtx0 10000 0 10000  <vtx1 10000 0 -10000  <vtx2 -10000 0 10000  <color 1 0.9 0.8  <color0 1 .8 .2  <uvtexture "dunes" 2 .01 0  <object rect "sand"  </structure  <object bound Light:  <normalize  <position 5000 500 2500  <color 1 1 1  <object light "light_1" Camera moves in a circle on the x-z plane:  <viewlocation !cos(loopv(cframe(0))*6.281835)*14 6 !sin(loopv(cframe(0))*6.281835)*14  <viewtarget 0 0 0

See also: Mathematical Expressions

Keyboard Navigation
, Previous Page . Next Page t TOC i Index o Operators g Glossary
WinImages F/x, 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 6, Level A

Valid HTML 4.01 Loose

This manual was generated with wtfm
wtfm uses aa_macro and SqLite
aa_macro uses python 2.7
Page 245