|--------------| | 3DO Tutorial | | v1.00 | |--------------| |--------------------------------| | by: Frank A. Krueger | | 72730.1262@compuserve.com | | August 15, 1995 | |--------------------------------| Due to an overwhelming desire for information on the creation of 3DOs, and my recent understanding of them, I have decided to write this tutorial. You do not need any experience as a programmer, or an artist, to create 3DOs. With that said, let's get going. ---------------------------------------------------------------------------- What you will learn: You will get an understanding of the structure of the 3DO, you will learn to draw one by hand, and how to use a CAD program to make them. What you will need: A pencil and graph paper, an ASCII text editor (like the one you are using), some knowledge of DF's inner workings and A good imagination. If you wish to use a cad program, you will need one that can output to RAW, OBJ, 3DS, DXF, NFF, GEO, or TPO, and the program WCT2POV, which can be found in the GRAPHDEV forum as WC2POV.ZIP. You should also get the program 3doshow, which is in the GAMES forum on CIS as CARGO95.ZIP. ---------------------------------------------------------------------------- Now a short glossary: 3DO - An ASCII file (text), which the game Dark Forces uses to draw the Three Dimensional Objects (a.k.a. Kyle's ship and others) in the game. ORIGIN - The place where the X,Y, and Z coordinates all meet. POLYGON - A closed plane figure. QUADRILATERAL - A geometric shape with four sides, and four vertices. TRIANGLE - A three sided geometric shape which also has three vertices. VERTEX - A points where two or more lines meet (a corner on a cube). <<< Lesson 1: >>> Now onto the fun stuff. We are going to design a 10' x 10' x 10' cube, from scratch, to go into dark forces. Just so you know, I think of the units in Dark Forces as feet ('), they're pretty close to it. First thing to do, is imagine yourself standing on an endless plane. You are standing at the origin of the plane at the coordinates 0x, 0y, 0z, dead center. To your left is the -X coordinates, to your right the +X. In front of you are the +Z coordinates, and behind you the -Z. Above you is the -Y coordinates, and below the +Y. Here is a drawing if you don't get it: -y +z | / @ - You | / | / |/ -x----------@----------+x /| / | / | / | -z +y Let's draw the cube now. We want the cube's origin to be directly in its center. So that means that we have to draw out from 0x, 0y, 0z. Draw a 3-D picture of a cube like this: __________ /| /| / | / | /__|______/ | | | | | | |______|__| | / | / | / | / |/ |/ ---------- Take a look at it. Now if the ORIGIN is in the center, that would mean that each side is five units away from the center. Sketch that drawing on a piece of paper. Now what we need to do is number each vertex starting with 0, an write down its X,Y, an Z coordinates, here we go: 0: -5, -5, -5 1_________2 1: -5, -5, 5 /| /| 2: 5, -5, 5 / | / | 3: 5, -5, -5 0/__|_____3/ | 4: 5, 5, 5 | | | | 5: 5, 5, -5 | |7_____|__|4 6: -5, 5, -5 | / | / 7: -5, 5, 5 | / | / |/ |/ 6----------5 If you don't understand what we just did, take a look at it for awhile longer, don't worry it'll come to you. Just two more things to do before we write the file. First we have to fill out a questionnaire! Here it is: What do you want to call your 3DO? How many objects are in it? How many vertices are there? How many polygons? Simple huh? My answers were: CUBE I chose this because, well, that's what it is 1 There is only one object, the cube 8 there are eight (remember to count zero as one) 6 6 squares make up a cube, and a square is a polygon Now we have to assign 4 vertices to each polygon, so Dark Forces knows where to place the corners of the squares. First thing to do is number the polygons, here we go: __________ /| /| / | 0 / | /__|______/ | | | 1 | 5| | 4 |______|__| | / 3 | / | / 2 | / |/ |/ ---------- That may look a bit confusing so I'll explain. #0 is the top square, #1 is the back square, #2 is the bottom square, #3 is the forward square, #4 is the left square, and #4 is the right square. Now lets name each vertex for the different quads. There is but one rule when you do this, name the vertices clockwise. Here's my list: 0: 0, 1, 2, 3 1: 1, 2, 4, 7 2: 7, 4, 5, 6 3: 0, 3, 5, 6 4: 0, 1, 7, 6 5: 3, 2, 4, 5 Now lets get on to writing the file. First I'll show you what it would look like, then I'll explain how I got all the values. 3DO 1.20 # # This cube was designed by Frank Krueger # 3DONAME CUBE OBJECTS 00001 VERTICES 00008 POLYGONS 00006 PALETTE DEFAULT.PAL TEXTURES 0 #------------------------------------------------- OBJECT "CUBE" TEXTURE -1 VERTICES 8 # num: 0: -5.000 -5.000 -5.000 1: -5.000 -5.000 5.000 2: 5.000 -5.000 5.000 3: 5.000 -5.000 -5.000 4: 5.000 5.000 5.000 5: 5.000 5.000 -5.000 6: -5.000 5.000 -5.000 7: -5.000 5.000 5.000 QUADS 5 # num: 0: 0 1 2 3 181 FLAT 1: 1 2 4 7 181 FLAT 2: 7 4 5 6 181 FLAT 3: 0 3 5 6 181 FLAT 4: 0 1 7 6 181 FLAT 5: 3 2 4 5 181 FLAT #-------------------------------------------------------------- Explanation in chronological order: 3DO 1.2 - Not really sure what this is, but it works with newer 3DOs # - This is a comment block. DF ignores everything to the right of it. 3DONAME - The 3do name OBJECTS - The number of objects in the 3do VERTICES - The number of vertices in the 3do POLYGONS - The number of polygons in the 3do. Remember in a 3DO a polygon is either going to be a Quadrilateral or a Triangle. PALETTE - The filename of the file that lists all of the colors in DF. I'd recommend using DEFAULT.PAL, it has a good range of colors. TEXTURES - This is where we would name the .BM files if we were going to use them to texture our object, more about that later. OBJECT - What the name of the object is TEXTURE - Tells DF which texture number to use, -1 turns it off, again more about it later. VERTICES - The number of vertices in the object that you are working on 0:-7: - The vertex number and its location. Don't put commas in, and make sure that all the numbers are separated by at least 2 spaces. QUADS - The number of Quadrilaterals in the object we are working on. 0:-7: - The quad number, and a clockwise list of its vertices. Same style as the Vertices. COLOR - This is the number of the color of the quad. It goes on the same line as the quad it modifies. To get the number of the color you want, you'll need FMECAD. Simply copy the file DEFAULT.PAL to the FMECAD directory, rename it to BEMYPAL.PAL, start FMECAD choose a color and write its number down. FILL - The type of fill (the way colors are drawn) for Dark Forces to use. It can either be FLAT which is flat, GOURAUD which is round looking, or TEXTURE which would tell DF to use the texture you named for that group. Well now that was fun! It's just going to get more and more tedious . Let's test the file now. If you have CARGO95.ZIP, you're in good shape. Just put the 3DO in the same directory that you installed 3DOSHOW, and type "3doshow cube.3do". If it works great, if not, go back and look to see if you did anything wrong. If you don't have CARGO95, your going to have to do it the hard way. Just download any other home made 3DO, and follow its instructions to install but change the filename to cube.3do, and make sure it's in the Dark directory, and make sure it is at least 5 units off the ground since you are placing its origin. Well all done with lesson number 1! Hope you learned a lot, and now have a basic understanding of the 3DO! <<< Lesson 2: >>> Now we are going to use our newly found talent and create a 10' texture mapped pyramid. Don't worry it'll be a breeze, now. Lets get going. Now first thing we do is sketch out a 3-D picture of what we're doing. Lets see... /|\ / | \ / | \ / | \ / | \ / | \ /______|______\ \ | / \ | / \ | / \ | / \|/ Well kinda... Anyway, do you remember what to do next? Right, number the vertices and write there locations, but instead of having the origin in the middle of the pyramid, we will make it at the bottom. I twill be designated with an X. Here we go.. 0 /|\ / | \ / | \ / | \ 0: 0, -10, 0 / | \ 1: -5, 0, 5 / | \ 2: 5, 0, 5 1/______|______\2 3: 0, 0, -5 \ | / \ X / \ | / \ | / \|/ 3 That's right, only 4 vertices. Do you see how I got those values? Remember everything is measured AWAY from the origin. And since we're making this a perfect pyramid all the triangles are Equilateral, so it was easy to come up with values. Now it's time for that questionnaire! What do you want to call your 3DO? How many objects are in it? How many vertices are there? How many polygons? You should have gotten the answers: pyramid, 1, 4, 4. If not, go back and look your drawing over. Now lets name each of the triangles' vertices. /|\ / | \ / 1| \ / | \ / 0 | 2 \ / | \ /______|______\ \ | / \ | 3 / \ | / \ | / \|/ That definitely looks confusing. #0 is the left tri, #1 is the back, #2 is the right, and #3 is the bottom one. Now lets name the vertices, clockwise of course: 0: 1, 0, 3 1: 1, 0, 2 2: 0, 2, 3 3: 1, 2, 3 Last thing we need to do now is pick a good .bm to texture the pyramid. To do this I would recommend you use DFUSE to preview the e pictures. I have chosen IF3.BM, it's a nice plated metal texture. It'd be hard for me to explain how to use the textures, so I'll just show you, and you'll understand. 3DO 1.20 # # A Pyramid by Frank Krueger # 3DONAME PYRAMID OBJECTS 00001 VERTICES 00004 POLYGONS 00004 PALETTE DEFAULT.PAL TEXTURES 1 TEXTURE: IF3.BM #0 #------------------------------------------------------------------ OBJECT "PYRAMID" TEXTURE 0 VERTICES 4 # num: 0: 0.000 -10.000 0.000 1: -5.000 0.000 5.000 2: 5.000 0.000 5.000 3: 0.000 0.000 -5.000 TRIANGLES 4 # num: 0: 1 0 3 47 TEXTURE 1: 1 0 2 47 TEXTURE 2: 0 2 3 47 TEXTURE 3: 1 2 3 47 TEXTURE #-------------------------------------------------------------------- Could this stuff be any easier? I'm not quite sure why DF makes us select a color even when we use a texture, I think it might be in case someone didn't have enough memory to load the texture map, it could resort to the plain color. But, for safety, select a color which is the same over all hue as the texture. All done with lesson 2!!! I told you this stuff is a breeze... <<< Lesson 3: >>> Now onto using a CAD program. This is, most probably the easiest, but slowest way of creating complex 3DOs. This is just my technique, if you know of a better one please send it to me. First I would suggest getting the program, Midnight Modeler. It has the Power and ease of AutoCAD and is at a price anyone can afford (it's freeware). It can be found in the GRAPHDEV forum as MNM.ZIP. Now lets say you wanted to create a sphere. Doing this by hand is practically impossible, unless of course you've had 10 years of math, and about ten days to do calculations. Here are my steps to making a sphere 3DO: 1.) Go into MNM (Midnight Modeler) and create a sphere with a radius of 6. Read the documentation to learn how to do this. Don't worry, I said the program is easy to use and I meant it. 2.) Go up to the file menu, and choose Export to DXF. 3.) Exit and go into the program WCVT2POV. Choose FILE > OPEN > AutoCAD DXF > then choose the file you exported. 4.) After it loads the file, go to FILE > SAVE AS, and choose an OBJ file format. Give the file a name and let the program save it. 5.) Open up the new OBJ file in a text editor. Now there are two ways of going about this, choose the one which you like best, but PLEASE read them both: a.) Go to the very beginning of the file and hit to move all the lines down one position. Go to the top line, and type "0: 0.00000 0.00000 0.00000" (without the quotes). Then use the arrow keys moving line by line downward changing the Vs to 1:, 2:, 3: etc. After you have gotten to the end of the Vs, look at the last number you wrote, add one to it, and write the new number down on a piece of paper, that is the number of VERTICES in the 3do. Now is a good time to choose SAVE AS and rename the file as a 3DO. If there are any lines left that don't start with "f", delete the text on that line but keep a the blank line there. Now go down and start numbering all the "f" lines starting with 0:, 1:, 2:, etc. Again, look at your last number and add one and that's the number of TRIANGLES in your 3do. Now's a good time to save the file. Ok, you have all the essential info down now, just fill in the rest of the file like we did when we wrote them manually. All set, you now have an upside-down sphere. That's what I forgot to tell you, draw your objects upside-down in MNM, since it considers +Y to be up, and -Y to be down. DON'T FORGET THIS! It can really mess up your drawings.. b.) This is definitely the most tedious way, not even sure why I'm including it :). Go to the beginning of the file and changing the Vs into 0:, 1:, 2:, etc. Add one to the last number to see how many vertices you have. Delete any other lines, but keeping their space, except for the F lines. Start Changing the Fs to 0:, 1:, 2:, etc. Again, add one to the last number you wrote, this is the number of TRIANGLES there are in your 3DO. Now go to where the Fs began, there should now be a 0: there. Say this is what you see: 0: 1 2 3 1: 2 5 8 2: 1 3 9 --etc.-- You would change the lines to: 0: 0 1 2 1: 1 4 7 2: 0 2 8 --etc.-- You just subtract 1 from each nuber to the right of the TRIANGLE number, keep going to the end of the file. Then go through and add the rest of the info that the file needs. Also, make SURE the file you drew was upside-down. Good-luck... <<< Credits and other info >>> There is another great source for information on 3DOs (besides this file ), the LucasArts 3DOs. They are a great place for learning. Try editing 'em, see what different combinations of commands do. Hopefully after people see how easy it is to create 3DOs, Libraries will be filled with hundreds of files, each greater than the other. That is my dream, to make Dark Forces be even more great with ships flying over head, and AT-STs running over the place. I suggest getting the level PAULLEV.ZIP. It's not only a great level, but comes with a file describing how to animate your 3DOs. Well I see it's getting late now, better wrap it up. Some additional credits - Richard Gold for inspiration and help Yves Borckmans for DFUSE Carlos Gomez for CARGO95 LucasArts for Dark Forces Dark Forces is a Copyright of LucasArts Entertainment Company. Use this file at your own risk, author will not be held accountable for damage, however unlikely, to your system.