VED (Vector Editor) v1.1 by Bodies In Motion
VED v1.1 Vector Editor by Tumblin / Bodies In Motion Contents ======== 1. What's new in this version 2. Introduction to VED 3. Guidlines for Using the Editor 4. Keyboard Commands 5. Crash Course in Making an Object 6. Credits 7. Programming Information 8. History and Future of VED _____________________________________________________________________________ 1. What's new in this version ------------------------------ - additional mouse support for selecting points that make polygons - scale objects - some cosmetic touches here and there - shows a logo object at beginning (if its in current directory) _____________________________________________________________________________ 2. Introduction to VED ----------------------- VED is our vector editor. We created this tool to easily (??) make 3D light-source shaded polygon objects for use in our demos. What we originally had in mind was some sort of editor that would allow us to make these kinds of objects as, manipulate them, and instantly see the results. I will tell you up front (this is Tumblin at the keys), this editor is not the best editor, nor does it have lots of cool features (yet :). You might have better luck creating objects in some other kind of editor. This might sound kinda dumb, but when I started creating this editor, I actually had no experience in using any other 3D modeller programs (eg. 3DS, Moray, etc.) So when I made this thing, I only had my own concept of how one would make objects interactively in this manner, and wasn't sure how I was going to do it. Well, after some time and experimentation, I came up with my own method of "vector editing". Lets take a look at how to use our editor. ----------------------------------------------------------------------------- 3. Guidelines for Using the Editor ----------------------------------- The way in which you go about constructing 3D objects is in the following manner: -> First you create all the "dots" (or vertices - where the corners of the polygons will join) in the object. (actually, you don't have to create *all* of them at this stage, or any other stage, just enough to get you started, and give yourself a rough outline of your object). -> Secondly, you switch to either Wireframe Mode or Polygon Mode, turn on the vertex highlighting (you will see why in a minute), and begin joining the vertices to make polygons by repeatedly invoking the "Create Polygon" command. The way that you do this step is you type in how many vertices are going to be in the polygon, and then click on the "dots" that make them up with your mouse. You must select them in counter clock wise order, when looking at the visible side of the polygon. You do it this way so that something called "backface removal" can work correctly. The rendering software uses this technique to decide whether the polygon will be visible or not... you don't want to draw polygon that you can't see... its too slow). After you select all of the vertices for your particular polygon, you will be given a color chart with the colors listed on it. Type in the color that you would like to use. Thats it! You will have a need to rotate the object around so that you can get a chance to "see" all the polygons' visible sides. Some times you may want to "zoom in" on the object to get better access to vertices that may be rather close together. Up next, the most important part... the key commands that make this baby do its thing! ----------------------------------------------------------------------------- 4. Keyboard Commands --------------------- If you havn't noticed already, VED is, at present, almost totally keyboard driven. This means that you are going to have to learn some weird keys to do all the different commands. But don't worry, they aren't that bad. Most of them are chosen because of the name of their functions. Just think of what it is that you are trying to do, and you'll come up with the right key stroke (: Here is a list of the different key commands and what they are for (I will enclose them in [] characters to make them stand out as the actual key that you have to hit to make them work): The arrow keys on the keypad are used to move the dots around. Your NumLock key must be tured on. So: 8 moves up 2 moves down 4 moves left 6 moves right - moves into screen + moves toward you [f] - File menu. This one will bring up the file menu, where you have the opportunity to start a new object, load in a new object, save your current object, run the dos shell (so you can do some temporary task and the return), and last but not least, quit out of VED. [m] - Mode menu. This is one of the more important keys. It lets you change from the three different modes: dot mode, wireframe mode, and polygon mode. Dot mode will display the object's dots (or if you like, vertices). Wireframe mode will display the object with straight lines that bound each polygon. There is no hidden line removal in this mode. Its great for helping you adjust your object's dot positions or for "debugging" your objects. Polygon mode will display your object in fully light-source shaded solid filled polygons. [v] - Change view. This menu will let you select which side of the object you want to look at. It lets you look from above, below, left, right, front, and back. This is a very useful tool for helping you position your vertices when the screen starts to get a bit cluttered up. It also helps out when you want to make things look symetric. [o] - Options menu. This will ask you a few questions about what you want enabled or disabled in the editor. It will allow you to: - turn on/off the information panel accross the top of the screen - turn on/off the visibility of the vertices (ie. dots) - turn on/off polygon highlighting (highlighted polygons are always purple) - turn on/off the visibitlity of the vertex numbers - toggle between coarse or fine dot movement The defaults are y,n,n,n,y , respectively. [n] - Next dot. Selects the next defined dot (vertex). It will cycle through all the dots that have been currently defined. [p] - Previous dot. Selects the previously defined dot (vertex). It will cycle through all the dots that have been currently defined. [c] - Create new dot. This will create a new dot (vertex) at the current position. [e] - Erase current dot. This will erase the current dot, and the previously defined dot will become the current dot. WARNING: make sure you do not delete dots that are currently attatched to a polygon, because it could crash the system (sorry). [E] - Erase all dots. This will erase all the dots in the object. [N] - Next polygon. Selects the next defined polygon. It will cycle through all the polygons that have been currently defined. This won't help you very much unless you have polygon highlighting enabled. [P] - Previous polygon. Selects the previously defined polygon. It will cycle through all the polygons that have been currently defined. This won't help you very much unless you have the polygon highlighting enabled. [C] - Create new polygon. This will create a new polygon. You will be asked to enter the number of vertices that will be in the polygon. Then you must enter the vertex numbers in counter-clockwise order when the polygon is viewed from the visible side. WARNING: make sure you enter the correct order, or you could crash the system (sorry again). [U] - Undo current polygon. This will erase the current polygon, and the previously defined polygon will become the current polygon. This will only undefine the polygon, and the vertices will still remain in your object. Use this one if you screwed up when you used C (create polygon) and managed not to crash the system. [x], [y], [z] - Turn on rotation on x, y, z axis, respectively. [X], [Y], [Z] - Turn off rotation on x, y, z axis, respectively. [A] - Turn on all three axis of rotation. [R] - Reset all rotation angles to 0 and turn off all rotations. [<] - Move object away from you (along the z axis) [>] - Move object towards you (along the z axis) [.] - Reset the object to default distance (z=origin) [S] - Scale object. This one lets you scale the object by multiplying all of its dots by a ratio. The value you must enter must be a value that is positive and cannot equal zero. So if you entered 2.0, you would have increased the object to 200% of its current size, if you entered 0.5, you will have shrunk the object to 50% of its current size. Note, that if you did the above scaling operations in sequence, you would end up having the object restored to it original size. ----------------------------------------------------------------------------- 5. Crash Course in Making an Object Okay, here is how you could make a simple cube right after you run the editor for the first time: 1) type "ved11" to execute the editor 2) hit a key after the title appears to begin your editing session 3) hit "o" for options 4) answer the questions in this order: y,y,n,y,y (this means the following: information panel - on visible dots - on visible vertex numbers - off polygon highlighting - on coarse dot movement - on 5) now move the point to a corner with your keypad's arrow keys (make sure Num-Lock is on). 6) press "c" to create a new dot 7) repeat steps 5 and 6 until you have all 8 dots positioned in the correct place to make it look like a cube 8) now press "C" to create a polygon 9) press "y" to answer the question "do you want to create a polygon?" 10) now position your mouse cursor over the dot and left click on it 11) repeat step 10 by clicking on the dots that make up the polygon in *counter clockwise order*. This is VERY important! 12) once you have selected the last vertex in the polygon, you will be shown a list of colors... type in the color you want to assign to the polygon and press ENTER. 13) repeat steps 8 through 12 until all of the polygons are connected. You will have to spin the object around to make all of the sides visible. [see section 3 for instructions on how to do this] 14) save the object by pressing "f" for file menu and then select "s" for save object. Then just follow the on screen instructions. That's pretty simple, isn't it? ----------------------------------------------------------------------------- 6. Credits Coding, design: Terry Sznober (aka Tumblin / Bodies In Motion) tumblin@mi.net Additional design and ideas: Craig Galbraith (aka Rush / Bodies In Motion) j5oa@jupiter.sun.csd.unb.ca Docs: Tumblin, and Joe Goguen (aka Lord Feff / Bodies In Motion) f1d9@spitfire.unb.ca We used the following products to produce this editor: XLIB 6.1 graphics library, Deluxe Paint Animation, Turbo C++ 3.0, TASM 2.0. Lots of public domain source code and tidbits of information from numerous places on the internet. ----------------------------------------------------------------------------- 7. Programming Information First up, the file format: ------------------------- VED uses a very simple file format that I call .V10 (standing for VED v1.0 file format). I will describe it here. It is in binary format, and contains only integers. Here's what the complete format looks like: The first int tells you how many vertices are in the object. The next series of ints is a list of all the vertices. They are stored as groups of 3 ints and represent the x,y,z coordinates of each vertex. Then the next int tells you how many polygons are in the object. The next series of ints is the polygon definitions. Repeat the following for each of the polygon: First int is the number of vertices in the polygon. This is followed by a list of which of the vertices make up this particular polygon. They are simply indices into the list of vertex triplets, and are listed in counter clock-wise order when the polygon is visible. Finally, the last int in the polygon definition is the color of the polygon. Thats it. Here's a little example of a 3d cube to clarify: (I'm using a coordinate system that looks like this: -x to +x = right to left -z to +z = bottom to top -y to +y = inside screen out into your face Although in the editor, you use this coordinate system: -x to +x = left to right -y to +y = bottom to top -z to +z = inside screen out into your face) --------- 8, | number of vertices in object +200,-200,+200, | vertex 0 (x,y,z) (left top back) +200,-200,-200, | vertex 1 (x,y,z) (left bottom back) -200,-200,-200, | vertex 2 (x,y,z) (right bottom back) -200,-200,+200, | vertex 3 (x,y,z) (right top back) +200,+200,+200, | vertex 4 (x,y,z) (left top front) +200,+200,-200, | vertex 5 (x,y,z) (left bottom front) -200,+200,-200, | vertex 6 (x,y,z) (right bottom front) -200,+200,+200, | vertex 7 (x,y,z) (right top front) 4, 0,1,5,4, 1, | polygon 0: 4 vertices, ... , color 1 (left) 4, 4,5,6,7, 2, | polygon 1: 4 vertices, ... , color 2 (front) 4, 7,6,2,3, 3, | polygon 2: 4 vertices, ... , color 3 (right) 4, 3,2,1,0, 4, | polygon 3: 4 vertices, ... , color 4 (back) 4, 0,4,7,3, 5, | polygon 4: 4 vertices, ... , color 5 (top) 4, 5,1,2,6, 6, | polygon 5: 4 vertices, ... , color 6 (bottom) --------- Since the colors are dependant to the editor, you will have some coding to do if you want to use colors other than the ones that VED 1.0 uses. (This is not as difficult as it seams). Next up, Calculations: --------------------- Now, here are the calculations that are performed on each vertex to display it on the screen (in pseudo code, and assuming you're using a mode-x 320x240x256 screen): /* rotate around x-axis */ work_z = old_y * cos(x_angle) - old_z * sin(x_angle); work_y = old_y * sin(x_angle) + old_z * cos(x_angle); work_x = old_x; /* rotate around y-axis */ temp_x = work_x * cos(y_angle) - work_z * sin(y_angle); temp_z = work_x * sin(y_angle) + work_z * cos(y_angle); work_x = temp_x; work_z = temp_z; /* rotate around z-axis */ temp_x = work_x * cos(z_angle) - work_y * sin(z_angle); temp_y = work_x * sin(z_angle) + work_y * cos(z_angle); work_x = temp_x; work_y = temp_y; /* project and convert to screen coordinates */ screen_x = (work_x / (work_z - 1024)) * 256 + 160; screen_y = (work_y / (work_z - 1024)) * 256 + 120; ----------------------------------------------------------------------------- 7. The History and Future of VED This is the second release of VED, now in version 1.1 The main change was in the way in which polygons are created. I got rather tired of always having to type in the vertex numbers and thought that it would be rather cool and simple just to be able to move a mouse cursor near the vertex and click on it. I think I have come up with a way to make the process less cumbersome. There is just one problem... if you select the same vertex twice or get them in the wrong order, things can screw up for you and crash the computer. I know that there are many things in here I could add, change, and optimize. I just have to get around to doing it. Perhaps I will try to make as much of it mouse driven as possible... it seams to help get things done so much faster. I have some neat ideas for a whole new and more professional look. We are not sure of what will become of VED. We may release some bug fixes later on. Perhaps we will release a more powerful version with lots of bells and whistles. Maybe even a superior object file format. Who knows. So stay tuned! ----------------------------------------------------------------------------- signed, Tumblin, Rush, Lord Feff, Nid Bodies In Motion '95
[ back to the prod ]