 |
lowpolycoop.com we like you. >:D password to join the forum is: ca5997c7
|
| View previous topic :: View next topic |
| Author |
Message |
scotths
Joined: 12 Aug 2005 Posts: 1044 Location: Albany, CA, USA
|
Posted: Fri Aug 12, 2005 4:06 am Post subject: Tutorial: Creating Basic DTS Files with Blender |
|
|
CREATING BASIC DTS FILES WITH BLENDER
On indie projects the most reliable and consistent tool we have found for creating game-ready DTS files for the Torque engine is Blender and the Blend2DTS exporter. This first tutorial will go into the basics of creating static shapes that can be used in the Torque Game Engine. I will leave more advanced topics for future tutorials.
SETTING UP THE EXPORTER
Probably the most difficult step in getting this tool to work is actually getting the exporter to work at all. The good news is that you may need to do it only once. The bad news is that this is the one part of the step that is not platform independent and the method I used to get it working on OSX is not the same as what you would do for Windows or Linux. I will need to dig up some information on this so that I can properly explain it, but for now Terry or I can walk you through the setup steps. When it gets all set up, the Torque file format will show up in the FILE > EXPORT menu.
IMPORT FILE
Blender can import files that have been created and saved in many different formats. Unfortunately, it does not import MAX files and my experiments with the 3DS import python script have proved insufficient. Terry has had good results using the MD5 importer that can be had from the doom3world site and I have also heard that the obj and dxf formats work well.
1. Open Blender
2. Choose FILE > IMPORT and find the file extension that matches with your file format.
3. Find your file in the file browser window, select it and hit the import button.
4. If you are cool and already work in Blender, then just open your .blend file.
SCALE OBJECT
The next step is to make sure that the object is the right size in comparison to to other objects that will end up in the Torque environment. Initially we tried setting up a standard of how units relate to meters in the torque world, but discovered that there were some inconsistencies with the way the camera in TGE shows characters, making it so that the base human-sized character needs to be larger than the "real" dimensions would suggest. So, the best bet in Blender is to create a simple object that is the same height as the base human model and use that as a scale around which to build. It will be hard to be precise, just use this as a visual comparison starting point.
The base human model is just under 2.4 blender units tall. If you want to see how it compares to your model, add a cube that is that height.
1. Switch your 3D view to the front view [NUMPAD1]. Also, switch to wireframe mode.
2. Position the 3d cursor by clicking in a convenient spot in the view with the LMB.
3. Make sure your mouse cursor is over the 3d window front view. Press the SPACEBAR. A menu will appear at the point that your mouse cursor is.
4. Select ADD > MESH > CUBE.
5. A cube will appear at the point where the 3d cursor is.
6. This cube is 2 units tall.
7. Right now the cube is in edit mode with the vertices being selectable purple or yellow dots. Press the TAB key to get back to object mode. The cube should now have a purple outline.
8. Press the N key. Type 1.2 into the field that says Z Scale -- you may need to SHIFT-LMB select to get into the field. ENTER.
9. Your cube is now the height of our standard male character once you finish creating your DTS file.
10. Position the cube near your object for easy reference. If the cube is still selected, press the G key, move the cube and left click when it is in the right place.
11. Select your mesh with the RMB. It should now have a purple outline.
12. Press the SKEY and move your mouse until you get the right size in comparison to how tall an average human is. Precision will be difficult to achieve. The closest I can get to being accurate, if you have an item that you know should be a certain size, use 1.3 blender units for a meter in the virtual world.
13. A unit is the demarcation on the grid that has the bold line, containing 10 smaller grid divisions, which are the lighter lines on the grid.
14. Select the cube you used for comparison with the RMB. Press the XKEY to delete it and hit ENTER to answer yes to the question.
Good, now your mesh is the right size for the SLO engine.
ADD NODES
Now, you will need to add some special objects to your scene that will help the exporter tell Torque what to do with the things in your file.There are many more options than I am going to give you here, but this setup will allow you to get a static model into the game. Blender refers to these objects as empties -- other modelling programs call them nodes or nulls, your Torque programmer will probably refer to them as nodes. I like to arrange them in a certain configuration in the 3d window so that it's obvious to me what's what, but it does not matter where in the 3d space the empties reside.
1. Make sure you are in the front view by pressing NUMPAD1.
2. Position the 3d cursor slightly above your mesh.
3. Press the SPACEBAR. In the menu that appears, select ADD > EMPTY
4. Move the empty up in the z direction a little bit by pressing the GKEY, moving the empty and clicking when you have the correct position.
5. If the empty looks way too big for your window and it is getting in the way, then scale it by pressing the SKEY. The empty has no real dimensions, you are only scaling the way it looks on screen.
6. Repeat the steps above two more times. Move the empties so that they are in a configuration similar to the one below, kind of like a pyramid. Like I said earlier, it's not absolutely necessary, but it helps me to see the hierarchy more easily.
7. Select the topmost empty by with the RMB.
8. In the buttons window, which is the one at the bottom of the screen if you are using the standard window setup. Make sure you have the edit tab selected.
9. Name the object by clicking in the button that now has the word empty (or empty.001 or empty.002, depending on which one you selected). Type the following word, making sure to capitalize:
Shape
10. Select the left most empty. Name it:
Detail32
11. Select the rightmost empty. Name it:
Col0
ADD A COLLISION MESH
In order for players to be able to bump into your chair, table or wall, you will need to tell Torque explicitly what to do with your model. To do this, you will be adding another mesh to your scene that will define the 3D area that other models can collide into. This is known as the collision box or collision mesh. Here's how to add it.
1. It is easiest to work in wireframe from the frontview. Set those if they are not set.
2. In the front view (NUMPAD1) position the 3D cursor as close to the visible center of your mesh as you can.
3. You may need to switch to the side view NUMPAD3 to position the cursor in the y direction.
4. Press SPACEBAR and in the contextual menu select ADD > MESH > CUBE. A cube will be added at the 3D cursor.
5. You are currently in edit mode and all the vertices are selected, which you can tell by the fact that they are yellow.
6. You will now resize the cube. In the front view, press SKEY to scale the box in all dimensions until you generally get close to enclosing your mesh within the box. Click with LMB to accept change.
7. Now adjust the size in each direction. Press SKEY and then ZKEY to scale in the z direction, click LMB to accept. Repeat for the x and y directions until you have a box that completely surrounds your mesh -- it is not absolutely necessary to be precise, but get as close as you want. The important point is to make your collision mesh as simple as possible, a cube is best.
8. Hit the TABKEY to exit edit mode and return to object mode.
9. In the buttons window, select the name of the object, which is now probably Cube or Cube.001 and change its name to something that starts with Col -- I usually call it ColMesh0 for sake of consistency.
10. While you're at it, select your main mesh with the RMB and rename it to something descriptive.
LINK NODES AND MESHES
Now comes the all important part, linking your objects together in the way the exporter requires you. It is important to follow these steps in order or else things will not link properly. When setting parent/child relationships you need to select things in a specific order for the parenting setup to happen correctly -- the object you select first will be the child, the one you select second will be the parent.
1. Select your mesh with the RMB.
2. Select the Detail32 empty by holding down the SHIFTKEY and clicking the empty with the RMB.
3. The two objects are actually highlighted in slightly different shades of purple but it is really hard to tell the difference -- that's why I say do things in the proper order because it is hard to get feedback from blender on which object will be the child and which the parent.
4. Establish the parent/child link. Press CTRL-P. There will now be a dotted purple line connecting the two. The image below shows how you could do it with menus.
5. Deselect everything by pressing the AKEY.
6. Select Detail32 with the RMB. Then select Shape. Press CTRL-P to link them.
7. Now start on the collision nodes. Select ColMesh0 with the RMB. Select Col0. Press Ctrl to link them.
8. Deselect all AKEY, select Col0, select Shape, link with CTRL-P.
9. Great, your nodes are all linked up now.
LOAD AND CONFIGURE EXPORTER
There are a couple of ways to load this up and both depend upon the fact that you have properly set up blender to run the script (see above). Here is the easiest way.
1. In the menu at the top of your blender environment select FILE > EXPORT > TORQUE DTS EXPORTER.
2. Select CONFIGURE in the popup menu.
3. One of your windows will now switch to a scripts window. Which one it is kind of depends on where your mouse is on the screen, but I haven't necessarily seen a definite pattern. In the window will be the interface for the exporter. If you don't see all of the buttons, press CTRL-UPARROW to make the script interface full screen.
4. The tab that first appears has to do with exporting animations, which we will not be doing in this tutorial, so leave everything as-is here.
5. Press the Mesh button. There are a few options here that deal with the mesh. I'm not really sure what each of them does, but for now just leave them alone -- I do. If I find out more about them I will edit this tutorial.
6. Press the export button.
7. Wait. The script is working. You may not know it, but it is working and may take a few seconds to finish. On OS X it appears to do nothing for about 3 seconds and then the swirling rainbow cursor appears until it's done. I suppose if you have a console window visible, you could track the progress.
8. Hide/minimize your window. Find your blender file in its directory. There should now be a file right next to it with the same name, but with dts as an extension -- ie. myfile.blend is next to myfile.dts
MOVE OR COPY FILES TO SHOW
See Terry's great tutorial on how to set yourself to see the models in the show tool or as a static shape in the Torque world editor. On OS X, I just take the dts file and move it to the show directory under my copy of the demo that is set up for the show tool.
LOAD UP SHOW
Fire 'er up. Open the show tool and check out your beautiful grey model.
NEXT
Next time around I will go into getting your textures to export and later I will describe how to export animations. I'll need to learn and experiment a little more myself before I can describe either method to you with any authority, so give me a little while before I get it out.
Happy Blending!
Thanks
Scott |
|
| Back to top |
|
 |
andrew Guest
|
Posted: Fri Nov 25, 2005 7:09 pm Post subject: material... |
|
|
| how do u get textures that will stay on in torque? |
|
| Back to top |
|
 |
scotths
Joined: 12 Aug 2005 Posts: 1044 Location: Albany, CA, USA
|
Posted: Fri Nov 25, 2005 7:51 pm Post subject: |
|
|
Hi Andrew,
Thanks for stopping by. Alas, that is a question that many of us have asked. I think it is time that I finally finish up part 2 to this and talk about textures. I've been hesitating because I did not want to misinform anyone with my less than complete knowledge, but I will sit down and get textures right once and for all.
Hook up with me on msn some late night (US Pacific Time) and we can try to go through it together if you can't wait.
Hopefully I can get it done by the end of the weekend.
Scott |
|
| Back to top |
|
 |
scotths
Joined: 12 Aug 2005 Posts: 1044 Location: Albany, CA, USA
|
Posted: Tue Nov 29, 2005 5:41 am Post subject: |
|
|
All right, I admit I am delayed on getting the texture tut going. There are still a few points I am not 100% sure about. I know how to make it work, but only in a step-by-step fashion from a fresh model. There are a few dead-end alleys that exist in the process if you make a wrong turn, and I want to be able to explain those as clearly as possible.
So, um, bear with me, it will be coming. I'd rather have it be right than have it be done soon.
Scott |
|
| Back to top |
|
 |
Anonymous Guest
|
Posted: Mon Dec 19, 2005 9:20 pm Post subject: |
|
|
Hiya,
When you've generated your UV textured DTS and placed it into Torque make sure the UV map is in the same directory as the DTS.
Another thing to watch for is keeping the textures in aspects of multiples of 2; that is .. 256x256, 128x64, 256x128 ..etc. Throw in one texture that is wonky and you can dance till the cows come home, but you'll never see it mapped to the DTS.
The better file flavours to use are JPG and PNG.
~Cheers |
|
| Back to top |
|
 |
scotths
Joined: 12 Aug 2005 Posts: 1044 Location: Albany, CA, USA
|
Posted: Mon Dec 19, 2005 9:30 pm Post subject: |
|
|
Hey, thanks for the additions. I think I will go ahead and add that into the OP -- it's been a while since I added anything to it. I've still been meaning to write that texturing tut, too.
Scott |
|
| Back to top |
|
 |
willman256 Guest
|
Posted: Thu Dec 22, 2005 11:49 am Post subject: |
|
|
hey great tutorial, a great help to what im doing. but a couple of problems along the way
when i make new empties and try and rename them it doesn't let me, it only lets me rename the first empty i created and even when i deselect all the objects and just select one empty it still wont let me rename it what do i have to do?
and also by accident i got rid of the menu on the bottom window so it looks like this
how do i get the menu back? |
|
| Back to top |
|
 |
Anonymous Guest
|
Posted: Thu Dec 22, 2005 12:16 pm Post subject: |
|
|
| ok, dont worry about my previous post, ive sorted that out, but how do i get textured objects into blender and into torque with the texture? |
|
| Back to top |
|
 |
scotths
Joined: 12 Aug 2005 Posts: 1044 Location: Albany, CA, USA
|
Posted: Thu Dec 22, 2005 2:33 pm Post subject: |
|
|
OK, time for the texturing tut. Stay tuned......
Scott |
|
| Back to top |
|
 |
Anonymous Guest
|
Posted: Thu Dec 22, 2005 2:52 pm Post subject: |
|
|
| yes, i really need this tutorial! |
|
| Back to top |
|
 |
3dots Guest
|
Posted: Sat Jan 14, 2006 6:09 pm Post subject: Thanks! |
|
|
| Hi, great tutorial! I am really looking forward to the texture-tutorial! |
|
| Back to top |
|
 |
nibbuls
Joined: 19 Dec 2005 Posts: 447
|
Posted: Sat Jan 14, 2006 6:30 pm Post subject: |
|
|
Aye! As am I.  |
|
| Back to top |
|
 |
Guest
|
Posted: Wed Jan 18, 2006 1:30 pm Post subject: |
|
|
I would just like to say that this is a great tutorial. I have only just recently started with Blender, and one of my major concerns was whether or not I would be able to export to Torque. So finding this was awesome.
Looking forward to the texturing tutorial. |
|
| Back to top |
|
 |
scotths
Joined: 12 Aug 2005 Posts: 1044 Location: Albany, CA, USA
|
Posted: Wed Jan 18, 2006 2:43 pm Post subject: |
|
|
It is in the works. I swear.
Scott |
|
| Back to top |
|
 |
scotths
Joined: 12 Aug 2005 Posts: 1044 Location: Albany, CA, USA
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|