POVCAD 1.0b by Alfonso Hermida Pi Square BBS (301)725-9080 3/27/93 NOTE: POVCAD is written in Visual Basic 2.0 for Windows (Microsoft Corp). To run it you'll need the runtime module VBRUN200.DLL. ------------------------------------------------------------------------- Copyright (c) 1993 by Alfonso Hermida. All rights reserved. The program POVCAD.EXE is distributed "As is". The author assumes no reponsibility for damages resulting from the use of this program. The program has been tested but no software is "bug-free" so...use at your own risk! ------------------------------------------------------------------------- Distribution: Feel free to distribute POVCAD.EXE and it's companion file POVCAD.DOC for non comercial purposes. Distributors may charge up to $5 for this program. If you wish to distribute this program with a comercial software please contact the author at the BBS number given above or by mail: Alfonso Hermida, 9346 Kings Grant Rd, Laurel, MD 20723. This program is distibuted as Shareware. You may use this program for a period of 30 days at which you must either register this software or stop using it. Registration entitles you to support thru the BBS. Registration cost is only $15 and helps continuing work to improve this software. To register send your check or money order to the above address with your name, address, phone number and a password(for BBS access). Check at the end of this document for registration form. -------------------------------------------------------------------------- THANKS! I want to take the opportunity and thank a lot of people and BBS that have helped POVCAD become such a success. I would like to thank Albert Waltner, Peter Jack, Curtis Olson for Beta testing and all the helpful comments. Dan Farmer was kind enough to upload the file to COMPUSERVE. Steve Anger gave me some help with the smooth triangle problem I was having (it turns out that the POVRAY version I was running had a bug!). There were some great BBS such as: * You Can Call Me Ray BBS (Chicago) * The Graphics Alternative BBS (California) * Trace of Reality BBS (Virginia) * Monsoon BBS (Maryland) And for other specific thanks, check the BUG LIST at the end of this document. Finally, all of you who were so kind to register their copies. This proves that Shareware is alive and well. ---------------------------------------------------------------------------- What's POVCAD? POVCAD is a small solid object modeling tool to create scene files for raytracers. It's based primarily on the POV(Persistence of Vision) raytracer written by the Persistence of Vision Group. POV is a copyrighted freeware raytracer. If you would like to get in contact with them, contact Compuserve (800)848-8990, Comart forum Raytracing section 16, or call YCCMR BBS (708)358-5611, which is a raytracer specific BBS. With POVCAD you're able to create visually the scene file and have a pretty good idea (geometry-wise) of how the objects are positioned in 3D space. There is no support for textures and color visualization since POVCAD is a wire frame-based program. Nor, you'll see the results of any constructive solid geometry operation (boolean operation..for short). POVCAD supports the following objects: * planes * cylinder * cone * sphere * ellipsoid * torus * box * height_field * Raw data files (loading) * Sweep (solid of revolution) * light_source and operations such as union, difference,intersection and composite objects. Textures can be selected from a list without need of typing. The scene view can be changed between isometric,YX,YZ and ZX. A session list shows the steps you took to create any image and you may select any of the objects from the list by clicking on it. An interesting feature is the ability to create or read data files with path information for animation software. You can create linear interpolated data, circular motion, parabolic, helix or just freehand mode, where you sketch the path with the mouse. POVCAD does not do animation but it plots the path files so you can see how things look on the screen. The data can be transformed like any object in POVCAD. In the File menu, there is an option to save the session file and to Export to POV (that is to create the POV session file). AN IMPORTANT NOTE: All rotations and translations are absolute(measured from the origin). Therefore, if an object has been translated to (1,1,1) and you change the x to 1.5, it will be (1.5,1,1) and not (2.5,1,1). My best suggestion is that you play with it for a while to get a better understanding of the program. Creating an Object To create an object is easy. Here are the steps: 1) Click on the Object menu and click again on the object you would like to create. All objects start at the origin, except the sphere which asks for the center coordinates. 2) To rotate/translate or scale the object, click on Xform and select the appropiate transformations. The way this program was developed, rotations are ALWAYS applied first THEN the translations. Keep that in mind. 3) If you need to edit/delete an object, click on Session and click on the object to be modified. On the bottom right part, the current object is shown, with it's texture. If the object is already there, you can operate on it without having to click on Session. NOTE:The LAST object created is ALWAYS the current object. If you wish to tranform it, just go directly to Xform or Texture (if you want to put a texture to it). To delete an object, either select it (thru the Session menu) or just go to Edit if it's the last object drawn and click on Del. NOTE: The format of RAW data files is: x1 y1 z1 x2 y2 z2 x3 y3 z3 x4 y4 z4 x5 y5 z5 ....... ...... ect .............. where each line represents a triangle. Usually I use Steve Anger's RAW2POV program to create objects with RAW data files. RAW2POV will optimize A LOT the image, while POVCAD will just convert the data to triangles and that's it! Creating Solids of Revolution (Sweep command) 1) Click on the PointOff button (to enable point creation) 2) Select a View different than Iso (i.e. YX,ZX or YZ) 3) Click on the window and draw a contour (up to 25 points) 4) Select the Sweep command from the Objects menu 5) give a filename.ext (the data will be saved in RAW format) 6) indicate sweep angle and number of segments * If you wish to erase the points and start all over use the Del Points command in the Edit menu. * SnapOn forces the points to fall in the intersections of the grid lines, while GridOff let's you select any place on the screen. Creating Constructive Solid Geometry Let's use an example to explain this topic: We'll assume we want to create a cylinder with a hole in the middle. Since the operation is a difference: 1) click on CSG and then select "difference". 2) create the cylinder and position it. 3) create a sphere (the hole) and position it. 4) Click on CSG and then "Close". Close is the command to tell the program that the current CSG operation has ended. The Session list would look like this: DIFFR CYL ........ SPH ........ ENDF Where: DIFFR = difference operation CYL ... = cylinder definition and transformations SPH ... = sphere definition and transformations ENDF = tells the program that this is where the difference operation ends Now let's assume that you want to create a union of 2 cylinders each one with a hole in it: This is how the Session list would look like: comments: UNION 1) union operation starts here DIFFR 2) difference operation starts here CYL .... 3) cylinder #1 SPH .... 4) sphere #1 END 5) clicked on CSG then on Close DIFFR 6) Start another difference CYL .... 7) cylinder #2 SPH .... 8) sphere #2 END 9) clicked on CSG then Close ENDF 10)clicked on CSG then Close (click on TEXTURE to add one to the object) As you can see, the software uses END and ENDF to distinguish between intermediate CSG operations and the final CSG operation...in this case the UNION was the final and the DIFFR were the intermediate. The same idea applies to all CSG operations. Composite is not a CSG but it was the best place to put it. * TEXTURES ON CSG OBJECTS * To put a texture on a CSG object click on ENDF(using the Session command) to make it the current object (you'll see ENDF at the bottom right part of the screen) then click on TEXTURE to add the one that you want. Transforming CSG /Composite objects At this point it is NOT possible to transform (XFORM) the whole set of objects. You may XFORM any of the individual objects that compose a CSG object. Quick Comment If you want to clip an object with 2 planes do the following: 1) Click on "intersection" 2) create the object to be clipped 3) create plane #1 4) create plane #2 5) rotate plane #2 so that the normal is facing oposite to plane #1's normal. (When a plane is created, the normal is ALWAYS in the + direction of the axis.) Also you must translate plane #2 so they're not in the same place. Example: plane#1: PLANE_Y,Translate_Y = .5 plane#2: PLANE_Y,Translate_Y = -.5,Rotate_Z = 180 Plane #1's normal is pointing in the +Y direction, while plane #2's normal is in the -Y direction (due to rotation about Z of 180 degrees) Any object placed in the origin will be clipped at Y=0.5 and Y=-0.5 . Try it and see! Creating PATH data files for your animations This feature allows you to create data files of paths that may be used in animations programs. Simply select the Path menu and select which curve to create. These data files can be XFORMed in the same fashion as any of the objects supported by POVCAD. To create a curve, select the corresponding curve and you'll be asked for a filename to save the data. This is done to reduce memory requirements on your system. The following is a brief description: 0) Load and SAVE Load read any 3D point ASCII file and converts it into a path, i.e. lines will be drawn to connect the points sequentially. Your data file SHOULD NOT have an extension *.PTH since this is used by POVCAD to save the final path files. SAVE converts your data file, i.e. filename.ext into filename.PTH. Initially, filename.ext was a set of 3D points that you created yourself or thru POVCAD. Since you may want to rotate, scale or translate the data, POVCAD takes those operations and changes your data. In order to keep the original data intact, POVCAD saves the new data with the PTH extension. The EXPORT to POV function in the FILE menu also creates the *.PTH files. If you haven't created any 3D objects and you don't need to create a POV file, simply use the SAVE function in the PATH menu, to save your animation files. To merge 2 or more data files, drop to DOS or load a texteditor and simply append one file to the other to create more complicated path data files. It's that simple! (gasp!...I hope it works) 1) Freehand Converts a set of points created on the screen to a path. Maximum number of points is 25 (at this point at least) 2) Linear Click 2 points (more than that will be discarded) on the screen. The routine will subdivide the line segment into a set of points. 3) Circular Creates a circular path. No points have to be created with the mouse. 4) Parabolic Follows the curve Y = aX^2 where a is the parabola coefficient and the value of Y is the height. The value of Z is zero but you may create this curve from any view. The routines will swap the axis to reflect the view you're in. 5) Helix Creates a "spring". The curve follows : x = a cos(2*pi*t) y = a sin(2*pi*t) z = t Therefore Z is the "height" of the function. This depends on the current view setting. After creating the curves you may use them to animate your raytraced images. POVCAD simply creates the curves and shows them with the geometry so you have a better understanding of how things might look. Remember, you can scale, rotate and translate the data like any other object! have fun! Creating LightSources To create a light_source object, click on the Light command in the main menu. Enter the origin coordinates of the light_source (x,y,z). To add a color to the light_source, select it (Session) then click on the Color command in the main menu. You may select any color or edit the string "red # green # blue #" by replacing the "#" with appropiate numbers. If you wish to move the light_source, click on XFORM and modify the translate parameters. The rotation angles do not apply to light_sources. The scale factors will only affect the size of the light_source symbol (resembles a 3D axis) in POVCAD, POV does not require a scaling factor. How does POVCAD save the objects? POVCAD saves 3 files for every session: {(4) is optional } 1) *.CAD This is the object definitions file 2) *.TEX file with the textures of each object 3) *.WRL world definition of the session 4) *.PTH data files to be used in your animation programs *.CAD file structure: This is the format that POVCAD uses for those of you that want to create external programs to deal with them. The file is an ASCII file with double quotes at the begining and end of each statement: rx,ry,rz = rotations about each axis (absolute) tx,ty,tz = translations on each axis sx,sy,sz = scale factors for x,y and z **** IMPORTANT: Each parameter is separated by 1 space. This is important if you're writing utilities for POVCAD. This space is REQUIRED. 1) Plane: "PLN axis rx ry rz tx ty tz sx sy sz" Example: "PLN X 0.0 0.0 0.0 0.0 0.0 0.0 1 1 1" 2) Cylinder "CYL radius height rx ry rz tx ty tz sx sy sz" Example: "CYL .2 1 0.0 0.0 0.0 0.0 0.0 0.0 1 1 1" 3) Cone: "CON radius height rx ry rz tx ty tz sx sy sz" Example: "CON .2 1 0.0 0.0 0.0 0.0 0.0 0.0 1 1 1" 4) Sphere: "SPH radius rx ry rz tx ty tz sx sy sz" (tx ty and tz are the center of the sphere) (sx sy sz must have the same value) Example: "SPH .5 0.0 0.0 0.0 0.0 0.0 0.0 1 1 1" 5) Ellipsoid: "ELI xradius yradius zradius rx ry rz tx ty tz sx sy sz" Example: "ELI .5 .2 .3 0.0 0.0 0.0 0.0 0.0 0.0 1 1 1" 6) Torus: "TOR radius_major radius_minor rx ry rz tx ty tz sx sy sz" Example: "TOR .7 .2 0.0 0.0 0.0 0.0 0.0 0.0 1 1 1" 7) Box: "BOX rx ry rz tx ty tz sizex sizey sizez" (the Box is a unit cube that has been scaled to size) Example: "BOX 0.0 0.0 0.0 0.0 0.0 0.0 1 2 .1" 8) HeightField "HFL filename.ext rx ry rz tx ty tz sx sy sz" (POVCAD draws a pyramid to represent it, with dimensions x=1 y=1 z=1, so it must be scaled properly. Check POV's docs on height_field.) Example "HFL mountain.gif 0.0 0.0 0.0 0.0 0.0 0.0 1000 1000 3245" 9) RAW: "RAW filename.ext rx ry rz tx ty tz sx sy sz" (Consider using Steve Anger's RAW2POV, it's more efficient. Don't say I didn't tell you about it!) Example: "RAW sweep.dat 0.0 0.0 0.0 0.5 1.3 0.0 1 1 1" 10) Sweep (same as RAW only that the SWP keyword appears instead of RAW) 11) Path "PTH filename.ext 0.0 0.0 0.0 0.0 0.0 0.0 1 1 1" This command points to a file with the format: p1.x p1.y p1.z p2.x p2.y p2.z ....ect ..... which was created with POVCAD or that you made up yourself. 12) Light Source "LTS 0.0 0.0 0.0 X Y Z .25 .25 .25" Comments: * The first three number are not used at all. * X Y Z refer to the light source position * the three .25 values are scaling factors that only affect the drawing on POVCAD. You may change those numbers to suit your needs by using the XFORM command (scale x,y,z). * The light_source color is in the *.TEX file. The *.TEX file structure: The *.tex file has a line for every item in the *.cad file. Some places may be empty but the file length is the same as the *.cad file. If you created light_sources, the colors will appear here also. The *.WRL file structure: This file has 4 values (if it's not found in your directory, POVCAD assumes a world definition of (-1,-1)-(1,1) ): WXleft WYbottom WXright WYtop These values correspond to the YX plane view. The *.PTH file structure This is a straight ASCII file with a list of 3D points: p1.x p1.y p1.z p2.x p2.y p2.z ... ect... The data has already been transformed by any operations you might have done inside POVCAD. Other Stuff -------------------------------------------------------------------- Limits At this point up to 100 objects may be created. You may do complicated objects by MERGEing files. This will change on future versions. CSG/COMPOSITE Objects You can not XFORM the whole CSG/COMPOSITE object...you may XFORM any of the components. World Coordinates Definition: POVCAD starts with (-1,-1)-(1,1) => (lowerleftcorner)-(upperleftcorner). Click on View and then World to change that or use the ZoomIn/Out icons to scale up or down. When you ZoomIn the world = world/scalefactor and when you ZoomOut the world = world * scalefactor. Pan You can Pan(scroll) in all direction by clicking on the arrows. You may change the Pan Step Size to move faster or slower. Experiment with it. Copy The Copy function will create an exact copy of the current object. That means that it will be also in the SAME place as the original. Then XFORM will be shown and select the transformation necessary to put the new object where it should be. Click on redraw to refresh the screen if necessary. Files The Export to POV creates a POV format file of the current scene. The default name is POVCAD.OUT...the name can be changed. It also creates any path files (*.PTH) that are in memory. AutoRedraw ON/OFF There's an icon to turn on/off the autoredraw feature. With the option on ON the drawing is sent to a buffer first and then appears on the screen. With the option on OFF the screen will be redraw everytime that you select the TEXTURE, SESSION or XFORM windows. Experiment which one works best for you. The important point is that in ON you pay a price with memory. Check with your system, you decide. Things you must do on your own (Sorry!...at least for now) --------------------------------------- 1) "spotlight" light sources and camera will be missing from the files. 2) If you forget to add textures to the objects you must add it later. (you can always reload the session file and put them in) Suggestions Create a standard view file with lightsources and camera and put somewhere the statement #include "myscene.pov" to include your scene. That's what I do and works OK for me. Your Suggestions I do welcome your comments and suggestions! Registered users have a better chance of seeing their comments incorporated in the program. If you like it or not let me know! BUG LIST (ugh!) [Check Pi Square BBS for the latest updates!] --------------- Ver 1.0a 2/8/93 (thanks to Bill Martin!) - (fixed) error in height_field definition (was totally wrong!) - added "object { }" and "color" keywords to light_source object - error on cone definition (not sure what the problem is :( ) Ver 1.0b 3/27/93 - Cone_Y was changed to QCone_Y since Cone_Y was used in an old version of the SHAPES.INC include file. If you have the old version, replace QCone_Y with Cone_Y. - (fixed)The 3D axis was not appearing at the beginning of the program. - The name of the file now appears at the top of the Window (caption). If no file is present, the caption "POVCAD version#" will appear. - When a POV file is created with the EXPORT function, the name of the file, date and time of creation will appear on the top. (thanks to Phil Long!) - (fixed) The copy function was not copying the texture to the new object. - (fixed) When opening the texture window and color window, you may click on the texture or color word to accept it...no need to click on [OK]. (thanks to Bill Martin!) - I added a scroll bar at the bottom right area of the screen, near the current object and texture info box. Once an object is created, it will appear in the info box. If you have more than one, simply scroll thru each one...no need to use the SESSION dialog box anymore unless you want to see more than one object at a time. The object that appears in the box is the current object and may be XFORMed at any time. ------------------------------------------------------------------------ REGISTRATION FORM FOR POVCAD 1.0b (c) Alfonso Hermida 1993 COMPLETE THE REQUIRED INFORMATION Send check or money order to Alfonso Hermida 9346 Kings Grant Rd Laurel MD 20723 Name :_________________________________ Date:_________ Address:________________________________________________________ ________________________________________________________ ________________________________________________________ Phone :__________________________________ Your registration entitles you to support thru Pi Square BBS. Write a temporary password to add your account to the BBS: BBS password: _________________________ Registered users of a given version do not have to register for minor revisions. For example, if you registered version 1.0, then 1a,1b,1c are minor revisions, and version 2.0 will be a major revision. Would you be interested in the source code? Yes[ ] No[ ] (written in Visual Basic 2.0) Comments:__________________________________________________________ ___________________________________________________________________ ___________________________________________________________________ ----------------------------------------------------------------------