 |
lowpolycoop.com we like you. >:D password to join the forum is: ca5997c7
|
| View previous topic :: View next topic |
| Author |
Message |
Khaine
Joined: 17 Jan 2006 Posts: 68
|
Posted: Fri Jan 27, 2006 1:05 pm Post subject: Tutorial: Texturing Basic DTS Files With Blender 2.4 |
|
|
TEXTURING BASIC DTS FILES WITH BLENDER 2.4
27/01/2006
In this tutorial we are going to unwrap and texture an object ready for use in the Torque Game Engine. We will only be covering the details necessary to export a model with a basic texture, so topics such as transparency etc won’t be covered. That can be the focus of a separate tutorial.
THINGS YOU WILL NEED:
1. Blender 2.4+ (http://blender.org)
2. DTS Exporter 0.90 (http://projects.blender.org/frs/?group_id=95)
3. An image manipulation program
4. Completed the Creating a Basic DTS File With Blender tutorial.
INSTALLING THE EXPORTER
To install the exporter simply follow the instructions that are supplied with it.
CHECKING THE MESH
Once you have followed the above tutorial you should have a mesh that can be successfully exported to Torque, albeit without any textures. If you don’t want to go through the above tutorial, or would rather be able to follow along exactly, then I have put together a .zip that has all the necessary files needed to complete the tutorial which you can download here (Helmet_Tutorial.zip 191KB).
The first step in texturing your model is to actually check that all of the faces normals are facing the right way. If not, you may get some strange things happening where faces seem to be missing. To check your mesh go through the following steps:
1. Start Blender.
2. Open your model (or 01-Start.blend in the .zip file).
3. Make sure you are in Solid mode, select the collision mesh (the cube) and move it to the side out of the way.
4. Select your model (RMB) and enter UV Face Select Mode (FKEY). Your model should turn white.
5. Rotate around your object looking for any missing faces. If you are using the supplied model you will notice that there just happens to be a face missing on the front of the helmet (gee, what a coincidence).
6. If you do have missing faces, we’re going to have to flip some normals. Enter Edit Mode (TAB) and Select All (AKEY). To flip the faces outwards press (CRTL+NKEY) and then accept the prompt.
If you are following this with your own model you may still have some faces missing. If this is the case, exit Edit Mode (TAB), select the faces that are causing problems individually, re-enter Edit Mode (TAB) and try Recalculate Outside (CTRL+NKEY) or Recalculate Inside (SHIFT+CTRL+NKEY) until you get the desired result.
7. Deselect All (AKEY). Back in UV Face Select Mode, your model should now be completely white.
CREATE THE SEAMS
In this tutorial we are going to be unwrapping using the LSCM UV Calculation. No using cubes, spheres, etc here. To do this we need to manually create a series of seams around the mesh that lets the unwrapper know where to cut the mesh. Image cutting a tennis ball in half and then squishing the two sides down flat. That is effectively what seams and the unwrapper do.
1. Enter Edit Mode (TAB).
2. Select the loop of edges around the bottom.
3. Press (CTRL+EKEY) and in the pop-up select Mark Seam. You will notice that the selected edges get an orange highlight.
4. Deselect the edges (AKEY) then select the loop of edges down the centre of the mesh, not including the edge on the bottom.
5. (CTRL+EKEY) and Mark the Seam.
6. Continue doing this around your model creating seams wherever you think it will help. If your using the supplied file, you want it to look something like this:
If you open up 02-Seamed.blend that is included in the .zip file you can see what my model looks like with all of its seams marked.
UN-WRAP
Now for an easy step, unwrapping the model. This is as easy as clicking a button:
1. Go back to Object Mode (TAB) and make sure you are in Front View (NUMPAD1). You should still be in UV Face Select Mode, if not press (FKEY).
2. Split your 3D Window in half vertically and change the right window to UV/Image Editor.
3. Now on to actually unwrapping your model. First, Select All (AKEY), press (UKEY) and from the menu that pops-up select LSCM.
4. Presto! If you look in the UV/Image Editor window you will see that your model has been unwrapped.
You could theoretically now save the map and be done with it. I wouldn’t recommend it however, and suggest you continue on with the following steps.
EDITING & SAVING THE UV MAP
Though the model may now be unwrapped, there are still several things that can be done to improve the map. At this stage what you are looking to do is make the most efficient use of your texture space as possible. One thing to keep in mind while editing your map is that the more space an area has, the more detail it can have in its texture. With this in mind, if you look at the UV map as it is, there are a couple of shapes that are repeated. These are the two sides of the helmet, the horns, and the rings around the base of the horns.
For this tutorial we are going to make our texture symmetrical. To do this we need to move any duplicate areas on top of each other. This will make each duplicate area use the same part of the texture, thus obviously making them look the same. The advantages of doing it like this are; you only need to texture half the model (the other half is the same), and since there are now less pieces on the UV map, each one can take up more room thus enabling it to receive extra texture detail. So lets edit:
1. Since it is the easiest part to work with, we will first select the circle that represents the bottom of the helmet and move it out of the way.
2. Select one of the areas that represents the rings around the bottom of the horns and using Grab and Rotate, place it on top of the duplicate area as close as you can.
3. Repeat the above step for the areas that represent the sides of the helmet and the areas for the horns. If, at any stage, you find that no matter how much you move and rotate a given area it just wont fit over its duplicate exactly, you will need to select every vertex and move it in to place individually.
4. Once you have placed each duplicate area on top of each other, move the areas around and scale them so that they make the most efficient use of the space as possible. Mine looks like this:
5. To save your UV map click on “Save UV Face Layout…” in the UVs menu.
In the options panel that appears change the Size to 512 (or any other power of 2 of your choice – 64, 128, 256, etc), choose where you want to save the file, then click EXPORT. Your UV map has now been saved.
IMPORTANT: It is imperative that your UV map's and definately your final texture's dimensions are a power of 2. If not, your texture will not work properly in torque.
03-Unwrapped_First.blend in the .zip file is my model at this stage.
CREATING THE TEXTURE
Creating the actual texture for this model is beyond the scope of this tutorial, but if you search hard enough there are plenty of tutorials on the internet you can find dedicated to creating textures.
That being said I am going to give you a couple of little hints that should help you in your endeavours. Following is a neat trick that enables you to test your UV map to see how well it is going to work. What we do is create a simple checkerboard texture that we then apply to the model. We can then look for any areas where the texture looks stretched or just plain bad. We can then adjust our UV map as needs be before saving it again. This saves us from going through the process of creating a texture, only to find out that our UV map is buggered, having to edit it, and then create our texture all over again. So, to create our checkerboard texture:
1. Open your image editing program of choice. Personally I recommend The GIMP (The GIMP). It’s free, and has plenty of functionality. If you choose to use Gimp, you can follow the next couple of steps. If not, figuring out how to do them in your program of choice shouldn’t be too hard.
2. Create a new file that is 512x512 in size.
3. Choose a foreground colour that you like (I’m partial to blue myself).
4. Fill the whole area with your colour.
5. Select Filters->Render->Pattern->Checkerboard…
6. Click OK.
7. You should end up with a texture that looks like this:
8. Save your texture as “Checkerboard.jpg” in the same directory that your model and UV map files are in.
Once you have created this texture you can then use it again on every other model you make. You can get my Checkerboard.jpg texture in the .zip file.
To test our UV map reload blender, and do the following:
1. Reload you model if need be (or open 03-Unwrapped_First).
2. In the UV/Image Editor window select Image->Open.
Select your Checkerboard.jpg file and click Open Image (Note: You may need to zoom out a bit after opening your texture).
3. In the 3D View window change the viewport shading to Textured. You can now see what your model looks like with the checkerboard texture applied.
Not that you can’t really tell at the moment, but our texture perfectly fits our model. You would notice it with a proper texture.
If you rotate around your model a bit you will notice a couple of things. The first is that in some areas the squares are bigger or smaller than in other areas. This relates to how much space the area takes up in the texture. Basically, the smaller the squares the more texture space it has. And the more texture space it has, the more detail it has.
Following from this, the next thing you will notice is that the squares (in the texture) are a lot bigger at the tips of the horns than they are at the base. This will have the effect of the final texture looking stretched at the tips (or squished at the base – depending how you do your texture). Optimally we would like the squares to be a uniform shape all along the horns. This illustrates the whole point of doing this testing stage. If we hadn’t, we probably would have been really annoyed when the horns didn’t look very good.
To fix this we have several options. We could remove the seam that we have on the horn, and create some new ones, unwrap the model again, and edit it again. Or, we could move some vertices around on the UV map. Option two is easier, but sometimes you have no choice but to do option one. Luckily for us we can get away with option two:
1. In the UV/Image Editor window select and move the vertices that represent the ring around the horns out of the way.
2. Using Border Select (BKEY) select the top vertices of the horns (there are actually two there remember – one on top of each other).
3. Move them up a ways. Once you have moved them, you will see your model update in the 3D View window. This is a really cool way of seeing how well you are progressing.
4. Deselect (AKEY) and select the next row of vertices and move them up a bit.
5. Continue selecting rows of vertices and moving them up and down until all the squares on the horns look to be about the same size. What you really need is a pretty even amount of space between each row.
6. You may also need to scale in each row of vertices to get the squares looking like squares on the model.
7. Once done, scale the horns back down, move them and the rings at their base back into position and you should be done.
You can now export your UV map again, safe in the knowledge that any texture you make should work just fine.
If you would like to see what my final UV map looks like, open up 04-Unwrapped_Final.blend and Helmet.tga.
Now is when you would create an actual, decent texture using the UV map as a guide and then apply it to your model. As I said earlier however that is beyond the scope of this tutorial. So instead, the checkerboard IS my texture.
EXPORTING TO DTS
Before we can export our model there are just a few more things that we need do for it to work properly. We need to create a material and set it up so that our texture will work in Torque.
1. Make sure the 3D View window is in object mode, and make sure the bottom window is a Buttons Window. Make sure it is in Shading mode (F5).
2. In the Material panel click Add New.
3. Still in the Material Panel, click in the name field and change the name to whatever your texture’s name is (without extension). For example, I am using the Checkerboard.jpg texture as my texture so I changed the name to “Checkerboard”.
This is really important. Whatever name you type here is the name of the file that Torque will try to load for its texture, so the names must match. If they don’t, you wont have a texture in Torque.
4. Bring up the Texture buttons (F6) and in the Texture panel click Add New.
5. In the Texture Type pull-down list select Image.
6. In the 3D View, ensure you are in Object Mode and select the Collision mesh (the cube). Move it back over so that it completely covers your model (may be easier to do in Wireframe mode).
7. Save your work as “Helmet.blend” (my completed model can be found in the .zip file as 05-Helmet.blend).
That’s it! After all that we are now finally at the stage where we can export to torque. With the suggested exporter, exporting to DTS is really easy:
1. Select File->Export->Torque Shape (.dts)…
2. You may need to resize some windows to be able to see the exporter properly.
3. In the Torque Exporter Plugin panel click on the “General” tab. If you want to change the output directory you can do so here. It’s not really necessary though.
4. Click the “Export” tab.
Assuming everything has worked correctly you have now successfully exported a textured model ready for use in the Torque Game Engine. You can now exit Blender.
CHECKING YOUR DTS FILE
Okay, we’ve textured our model, set everything up and exported. Now it’s time to make sure that it actually exported correctly.
First we want to check the log file that the exporter automatically generates. Navigate to the folder where you exported your DTS file. You should see a text file called “Helmet.txt”. If you open it up you can have a look through it and see if there were any problems. If all is good, we should not have any errors.
Now for the big test… checking it in ShowTool Pro. First up, either copy your Helmet.dts file and <TEXTURE>.jpg file into a directory where ShowTool Pro looks for DTS files or set up ShowTool Pro to search the directory where your files currently are. Either way, start up ShowTool Pro and load your file. If you can see your model with your texture then everything has worked. Here is a screenshot of what mine looks like:
CONCLUSION
Congratulations! You should now hopefully have a textured object ready to be used in Torque. As a finishing note I would like to point out that this tutorial did not mention anything about any “fancy” texture options. Info on this can be found in the exporter documentation. Speaking of the exporter, I recommend keeping a close eye on it as new versions are being released quite regularly (at least they are at this point in time – 27/01/06).
Happy Blending,
Khaine _________________ "The good shall fall" - Khaine
Last edited by Khaine on Tue Feb 07, 2006 2:30 pm; edited 1 time in total |
|
| Back to top |
|
 |
scotths
Joined: 12 Aug 2005 Posts: 1044 Location: Albany, CA, USA
|
Posted: Fri Jan 27, 2006 6:21 pm Post subject: |
|
|
Thank you again, Khaine. I read it over again and love how useful this is going to be for everyone. Superb.
Scott |
|
| Back to top |
|
 |
terrym
Joined: 12 Aug 2005 Posts: 421 Location: Sydney, Australia
|
Posted: Fri Jan 27, 2006 10:53 pm Post subject: |
|
|
nice work
*thumbs up* |
|
| Back to top |
|
 |
rodrigo Guest
|
Posted: Mon Jan 30, 2006 2:22 pm Post subject: DTS exporter |
|
|
Excellent tutorial
You know something about exort bump and normal maps in Blender DTS exporter?  |
|
| Back to top |
|
 |
Khaine
Joined: 17 Jan 2006 Posts: 68
|
Posted: Wed Feb 01, 2006 1:21 pm Post subject: Re: DTS exporter |
|
|
Thanks for the comments guys. It's always encouraging when people have nice things to say about stuff that you've done.
| rodrigo wrote: | You know something about exort bump and normal maps in Blender DTS exporter?  |
I don't really know too much, but I could probably put some stuff together that would help get you started if you like? _________________ "The good shall fall" - Khaine |
|
| Back to top |
|
 |
eric256 Guest
|
Posted: Tue Feb 07, 2006 4:55 am Post subject: Emap.bmp |
|
|
Hey,
Great tutorial!
I followed it mostly (used my own mesh) and the export goes okay, but then it when i load it using the Toque show tool it comes up with the mesh, but the texture is wrong and it says failed to load emap.bmp when I named all the textures (and shapes and anything near it) cylinder and the texture is cylinder.png.
Any ideas what I might have goofed up?
Thanks,
Eric |
|
| Back to top |
|
 |
Eric256 Guest
|
Posted: Tue Feb 07, 2006 5:19 am Post subject: Learned my Lesson |
|
|
Okay. So i followed the tutorial...mostly. lol
It is extremly important that textures be powers of 2. The default UV map size of 500 will not work. Yes i know its in the tutorial, yes I still managed to do it wrong.
So if you get finished and your object still doesn't have a texture then check the size of your texture
Thanks for the great resource. |
|
| Back to top |
|
 |
scotths
Joined: 12 Aug 2005 Posts: 1044 Location: Albany, CA, USA
|
Posted: Tue Feb 07, 2006 5:54 am Post subject: |
|
|
Cool, that was going to be one of five suggestions I had. I'd love to see your model -- you can post it in "General" if you want. Also, you can post a request for a tut if you want.
scott |
|
| Back to top |
|
 |
Khaine
Joined: 17 Jan 2006 Posts: 68
|
Posted: Tue Feb 07, 2006 2:37 pm Post subject: |
|
|
Thanks for your feedback Eric. I have added a note into the tutorial so that hopefully no one else falls into the same trap.
If anyone else has found any other trouble areas, or any areas that they think could be explained better please let me know so that I can make the tutorial better. _________________ "The good shall fall" - Khaine |
|
| Back to top |
|
 |
Willman Guest
|
Posted: Fri Mar 03, 2006 6:46 pm Post subject: |
|
|
| nice tut, thanks, i will be using this soo much, thanks again! |
|
| Back to top |
|
 |
scotths
Joined: 12 Aug 2005 Posts: 1044 Location: Albany, CA, USA
|
Posted: Fri Mar 03, 2006 6:58 pm Post subject: |
|
|
Welcome back! I'm glad you still needed to know about this,
Scott |
|
| Back to top |
|
 |
Anonymous Guest
|
Posted: Mon Apr 17, 2006 5:30 pm Post subject: |
|
|
I really enjoyed this tutorial. UV unwrapping in Blender is still one of those things that seems to work accidentally for me.
I have a question about overlapping complementary polygons on the texture. In the tutorial, you spoke of grabbing and rotating but wouldn't you also need to mirror? If so, would you always use the X-axis to mirror?
Thanks.
Great site. I followed a link here from the Ogre3d forums. |
|
| Back to top |
|
 |
scotths
Joined: 12 Aug 2005 Posts: 1044 Location: Albany, CA, USA
|
Posted: Mon Apr 17, 2006 6:01 pm Post subject: |
|
|
Hey Macada, welcome to our little home. I like to refer to unwraping in Blender as UVooDoo. Looking through Khaine's tut here I would say the short answer to your question is yes. In the situation he is describing you would need to mirror as well as grab and rotate. The uv space is actually quite flexible and uses many of the same transform features and keyboard shortcuts as the 3D windows do, so don't be afraid of moving things around a bunch. Which axis to mirror on would I think depend on where the seam of symmetry is located. One way to make sure that your two islands are perfectly matched up is to take each set of overlapping verts (with the bkey border select) and weld them together with wkey and then 1key, and then continue across the whole island one set at a time. Painstaking I know.
Another way to work is if you know that your model will be symetrical would be to build the mesh in mirror mode, unwrap just a half and then duplicate and stitch up your model. The uvs will travel with the duplicated faces giving you a perfectly aligned set of coordinates. It's hard to explain, but once you've seen it, you would get it.
Feel free to check out the other tuts -- there are other UV tips scattered throughout.
Scott |
|
| Back to top |
|
 |
Anonymous Guest
|
Posted: Wed Apr 19, 2006 1:56 pm Post subject: |
|
|
| scotths wrote: | | Which axis to mirror on would I think depend on where the seam of symmetry is located. |
Gotcha. If the seam is horizontal, then Y mirror. If vertical, then X. Makes sense.
| Quote: | | One way to make sure that your two islands are perfectly matched up is to take each set of overlapping verts (with the bkey border select) and weld them together with wkey and then 1key, and then continue across the whole island one set at a time. Painstaking I know. |
Sounds great. I'll have the experiment with this one.
| Quote: | | Another way to work is if you know that your model will be symetrical would be to build the mesh in mirror mode, unwrap just a half and then duplicate and stitch up your model. The uvs will travel with the duplicated faces giving you a perfectly aligned set of coordinates. It's hard to explain, but once you've seen it, you would get it. |
That's pretty much how I'm working now. I keep a centerline on the model and duplicate, flip, align, and remove doubles.
Appreciate the tips. |
|
| Back to top |
|
 |
HanClinto
Joined: 08 Jun 2006 Posts: 135 Location: Indiana, USA
|
Posted: Thu Jun 08, 2006 3:57 pm Post subject: |
|
|
Wow -- excellent tutorial. Thanks so much!
--clint |
|
| 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
|