Author Topic: Guide to exporting Blender models for Blockland  (Read 16733 times)


Download Blender 2.5 (Version 2.57b, latest as of 15th June)
Download Blender 2.49 (Version 2.59b, old and should only be used for exporting)

Blender DTS Exporter 0.97 (Version 0.97beta3, latest as of 15th June)
Mirror for Blender DTS Exporter 0.97 (Version 0.97beta3, latest as of 15th June)

General Blender help thread
Polygon Toolkit (For advanced users only)

Before I start I must make one thing very very clear. I have said this so many times it's not funny anymore. I swear if you dare come here complaining how the DTS exporter is not working in Blender 2.5 I will calmly fly over to your country, locate your house and proceed tear your testicles off and feed them to you. If you happen to be female then I will command you to grow male genitalia.

Okay now are you reading this very carefully? Good. Now please never ask again why the exporter isn't working in 2.5.

THE BLENDER DTS EXPORTER. ANY VERSION OF IT.
ONLY. WORKS.
IN BLENDER 2.49.

Now let's continue.

Rejoice. The guide everyone has been waiting for. I should have written this forever ago but I'm a lazy forget. In this not-too-sure-of-the-quality-guide I will not only cover the usage of the Blender DTS Exporter but also how to properly prepare your Blender models for exporting. I'm not much for preambles so let's get rollin'.

I assume you have read the General Blender help thread so please do not ask questions about Blender or modeling in this thread. This thread is purely about exporting not about using Blender



Table of Contents

1. Preparing your Blender model for exporting
- Materials
- Bones (Armatures), empties and parenting
- Fixing normals and rotation, location and scale
- In Blender 2.49: fixing normals and rotation, location and scale

2. It's ham- export time!
- Installing Blender DTS Exporter
- Exporting

3. TL;DR



The work flow should be as following
  • Model in Blender 2.5.
  • Set up all materials, bones and empties.
  • Fix all normals and incorrect rotation etc. (Optional, but helps to see how the final model looks like)

  • Load up the model in Blender 2.49.
  • Animate if necessary.
  • Disable double sided faces and fix normals and rotation etc.
  • Export to DTS



Preparing your Blender model for exporting

I will be using an example model for everything below. It is a very simple axe that has both smooth and flat shading, more than one material and it has been prepared for exporting with a bone and empties so it is a great example model. In layer 1 is the axe that you are supposed to export, in layer 2 is the axe used for development. In layer 1 the axe faces have been converted to triangles for exporting. In layer 2 the axe has quads which are a lot better for modeling than triangles as they are a lot easier to control.
You can download it from below, but please do not release it as an add-on. The model is really bad and is only intended to be used as an example.

Example_Model.blend
Materials
Awww righty then. You've got yourself a sweet model in Blender but how on earth do you get it into Blockland? It is in fact really simple once you learn how to do it. First of all you gotta know a couple of things about materials. The Blender DTS exporter ONLY exports material names. So it doesn't matter if you have made your material transparent, glossy, glowing, matte or anything. Only the material name matters. None of that other stuff gets exported. None of it. Those are only good for usage in Blender to see how your models looks like with colors.



Later on after you have exported your model and got it into the game, the game will look for PNG images with the same material names that you have chosen in Blender. The PNG's should be 16x16 pixels and have only one color. The PNG's can have transparency, but for it to show in game it needs some fiddling with the exporter that I am currently unaware of.

Bones (Armatures), empties and parenting
Now that you've got your materials set up, let's add the proper bones and empties. There are two types bones Blockland uses that I am aware of. The mountPoint and muzzlePoint. The mountPoint is the spot where the Blockhead grabs your model. The muzzlePoint is the spot where the projectiles (bullets) come out. The empties are called detail32 and Shape.
First let's add the mountPoint. Press Shift + A and select Armature > Single Bone. Now rotate the armature so the pointy ends points to where you want the Blockheads fingers to point. The larger end is the actual point in space where the Blockhead grabs the model. Illustrated below.



With the armature selected, press TAB to go to the Edit Mode and then press N to show the handy-dandy sidebar. Under Item there are textboxes for Armature and Bone. The name of the armature is irrelevant as we will not be exporting it. The name of the bone on the other hand does matter. Name it mountPoint or muzzlePoint depending on which point you wish it to be. muzzlePoint works the same way as mountPoint, bullets come out of from the large end to the pointy end.

Empties are just some magical things that the engine requires because ponies. I do not really know why they should be there, since the model works without them, but better be on the safe side. press Shift + A and select Empty. With the empty selected press N to show the sidebar if you do not have it open. Again under the Item there is textbox for the object name. Type in Detail32 or detail32, either one is fine as the capitalization is irrelevant. Now create a new empty and name it Shape or shape.

Time parent these babies! The parenting goes as following: Your model hangs out all by itself, the armatures (All mountPoints and muzzlePoints) are parented detail32 and the detail32 is parented to Shape. In other words:
Shape parent of detail32 <-- detail32 parent of all armatures <-- Your model is forever alone
let's start by parenting the armatures. Select your armature(s) and go to the Object tab in the properties menu. Under Relations there is a textbox descriptively named Parent. Click the box and select detail32 from the list.



Then parent detail32 to Shape and you're done with that.

Fixing normals and rotation, location and scale
This part is optional but helps you to see how the final model looks. You will repeat this procedure in Blender 2.49 later on.

You are guaranteed to have problems with normals after you've finished modeling. So what are normals? They are these little thingies that tell the engine which way a face in a model is facing thus which faces to light and how.



How to check your model for normals that face the wrong direction? Simple. At the bottom toolbar of the 3D View click the white ball and change the Viewport Shading to Textured. Now take a good look at your model. Rotate it all around check every nook and cranny for invisible faces. It means the normal on that face is facing the wrong direction.



To fix (In most cases) the normals on your entire model in one click simply go to Edit Mode and select all of your model by pressing A. Now press T to show the oh so useful toolbar on the left side. Look for the Normals category and click on the Recalculate Normals button.



Now in some cases this does not work for all faces. Usually where another part of the model goes through faces the normals are still incorrect. To fix those faces, simply select them and press the Flip Direction button.

But sometimes even after fixing normals you get these really odd lighting errors in-game. Your model seems to be too bright or too dark. The image below is of my axe, not the example model, a few months back when I still didn't know how to fix this problem and on the right is the current fixed model.



Now back in the day we had this archaic method of fixing this problem that didn't always work because the planets weren't aligned. It included joining your model into a single mesh, creating a cube around your model and joining your model to the cube and then deleting the cube. But that was back in the old days, now let me present you with a much easier modern day solution that is guaranteed to work. Select your model and armatures in object mode. Now press Ctrl + A and select Location, Rotation and Scale one after the other. This not only fixes lighting problems but also incorrect model rotation in-game. (Ie. Holding a gun wrong way around with the barrel pointing at you.)

In Blender 2.49: fixing normals and rotation, location and scale
Hoorray. Your model is now ready for exporting. Well almost. Load it up in Blender 2.49. I suggest you to copy the .blend file, not actually move the original.

You'll notice this helpful little error "You have opened a 250 file, key information will get lost, like animation data. Continue?". As the error tells, you will lose all animation data. That means you can't animate your model in Blender 2.5 and must use Blender 2.49 if you intend to export said animations. I can't help with animating or exporting animations as I do not know it works. If you do please let me know. Simply click the text and the model will load.



Now that you've got your model loaded in Blender 2.49 let's get rid of that development copy. Go to layer 2, select all and delete. That way you have everything you need to export in layer 1 and nothing else cluttering the save. This will make things easier later on. Now you gotta fix up the model a bit more. Blender 2.49 automatically enables Double Sided faces so you got to turn that off first. Go to the Editing (F9) tab in the buttons toolbar and click on the Double Sided button to turn it off.



Sometimes turning off double sided faces messes with the normals so we gotta fix those again. It's pretty much the same thing here. Select your model, go to Edit Mode and press Ctrl + N (Or Mesh > Normals > Recalculate Outside) to recalculate the normals. To flip normals, select a face and press W and select Flip Normals (Or Mesh > Normals > Flip). Normals fixed.

I do not know why this happens in Blender 2.49 but sometimes it also messes with the rotation, location and scale thing we fixed earlier. So to be on the safe side it's also good to fix those since it only takes a few seconds. Select your model in Object Mode and press Ctrl + A and select Scale and Rotation to ObData.



Good heavens, just look at the time!

It's ham- export time!

Well that took longer than expected. Let's get to the actual exporting part now that your model is all neat and tidy and ready for exporting. Oh but wait. Perhaps it would be good to tell you how to install the exporter first since it's a piece of cake.

Installing Blender DTS Exporter
Download the exporter and extract the .zip. Open the folder and copy all of the files in the folder except LICENSE, LinuxInstallScript, MacInstallBlenderDTloveport, Readme, WhatsNew and WindowsInstallScript. Go to your Blender 2.49 folder then to the ".blender" folder and paste the files into the "scripts" folder. Done.

Exporting
Go to File > Export > Torque Shape (.dts)... and the exporter will open. The Shape tab is already open so click on the Nodes tab. These are the objects that are going to be exported. It has the Detail32 and Shape empties, armatures and bones as separate objects and of course the meshes of your model. The example axe consists of two meshes: head and handle. Make sure you have checked all the meshes of your model. Now we don't need the armature but we do need the bone so go ahead and uncheck the Armature.



Moving on to the next tab Materials. This is just to check that all the correct materials are listed.



The next tab that we need to worry about is the Shape Options tab. In there change the Geometry Type to Triangle Strips.



Off to the final tab, General, which also just to check everything is cool. This is to see what the exported .dts is named and where it is to be exported.



All done. Click the Export button at top right of the exporter window. That's all. You've got yourself a fresh .dts of your model in your hands.



TL;DR
  • Model.
  • Assign materials and their names
  • Convert quads to tris.
  • Create armature(s) and name the bone(s) mountPoint and muzzlePoint.
  • Create empties Detail32 and Shape.
  • Parent bones to Detail32. Parent Detail32 to shape.
  • (Recalculate normals and apply rotation, location and scale.)
  • Moving to Blender 2.49.
  • (Animate)
  • Disable double sided faces.
  • Recalculate normals and apply rotation and scale.
  • Exporting.
  • Nodes -> uncheck armatures, but not bones.
  • Shape Options -> check Triangles
  • Export.

If I missed something let me know.
« Last Edit: June 16, 2011, 01:52:33 PM by Demian »

If I am not mistaken, you should be exporting stuff as Triangle Strips. Why? Because due to some bugs you can only have shadows if you export stuff that way.

Is there a way to import a .dts back into blender? If so that would be HELL-A-Helpful.
Also thanks for posting, This needs to be a sticky!!

Is there a way to import a .dts back into blender? If so that would be HELL-A-Helpful.
Also thanks for posting, This needs to be a sticky!!

No, the only known program that can import .dts is Shaper (a stuffty, outdated, $35 dropped program project).
I'm curious as to what is necessary to create a plugin to import that filetype, and why no one has ever made one.
« Last Edit: June 15, 2011, 08:32:39 PM by Blastdown »

Sweet. I'll be sure to use this.

No, the only known program that can import .dts is Shaper (a stuffty, outdated, $35 dropped program project).
I'm curious as to what is necessary to create a plugin to import that filetype, and why no one has ever made one.
Thanks for the info.

If I am not mistaken, you should be exporting stuff as Triangle Strips. Why? Because due to some bugs you can only have shadows if you export stuff that way.
Oh wow. I never actually noticed that the shadow is screwed up if you export as triangles. Indeed exporting as Triangle Strips fixes the shadow. Nice. Gotta re-export everything I have ever created and released. Updated OP.

Just a bit of optimization tip: Make sure "double sided" button is marked as off, because that doubles the amount of polygons in-game.

EDIT: My bad, it's all up there.
« Last Edit: June 16, 2011, 04:10:59 PM by Barnabas »

Just a bit of optimization tip: Make sure "double sided" button is marked as off, because that doubles the amount of polygons in-game.
Mentioned it here: http://forum.blockland.us/index.php?topic=157886.0#post_fixing2
Also noticed that image is a bit confusing so I'm updating that.

Hey demian i think i figured it out

I've been doing "Scale To ObData/Rotation To ObData" Separate
I think i need to try "Scale and Rotation to ObData" all by itself
Would that make a difference?
Anyhow I'll try this and get back to you.

Hey demian i think i figured it out

I've been doing "Scale To ObData/Rotation To ObData" Separate
I think i need to try "Scale and Rotation to ObData" all by itself
Would that make a difference?
Anyhow I'll try this and get back to you.
I don't think it does.

I don't think it does.
Do you think it might be because i have a older version[2.49]? [BTW i just downloaded blender 2.57]

Do you think it might be because i have a older version[2.49]? [BTW i just downloaded blender 2.57]
You need both 2.49 and 2.5.

You need both 2.49 and 2.5.
Well then i got em both. Thanks Demian, Wanta see the ak47? [Without lighting/bad mount errors?]

There is also ejectPoint.  Nice tutorial though.