Game Development Community

Announcing : Blender Exporter For Torque (0.8)

by James Urquhart · in Artist Corner · 06/17/2004 (8:57 am) · 116 replies

Hey again,

Finally, after many weeks of frustration, i have released a new version of the Torque Blender Exporter.

The exporter has been greatly revamped in an effort to make it easier to use, though it should still be considered unstable.

Changes of note are :
- Full support of loc,rot, and scale animation of bones.
- Many configuration options have been removed and intergrated more into blender (e.g. Material settings).
- Revamped gui and scene setup.
- Configuration settings are now stored in the .blend file.
- Works in Blender 2.33+; Full intergration into the Export menu.

A short how-to on converting existing shapes to work with the new exporter is included in the exporter .zip.
In addition, i have included an example.blend, which should export cleanly using the exporter.

As usual, it can be obtained at : www.garagegames.com/blender

Please post your thoughts, and any bugs you bump into here.

NOTE: If you downloaded 0.8 and are having problems, i have released 0.81 that corrects a few of them.
#81
08/05/2004 (2:18 pm)
Hey. First thank you so much for this exporter. You've made work fun again.

I'm having trouble triangle stripping. I'm getting this error in my console:

AttributeError: VTKStripper instance has no attribute 'faces'

I looked at the VTK site but it didn't really help me. I don't really know much about scripting, but do I need to add in some python script? I wish I didn't need to triangle strip but I need the dsq's to work on a G4. My meshes run great on a dual G5.

Any help would be much appreciated.
#82
08/05/2004 (2:27 pm)
Have you downloaded and installed VTK and VTK's python bindings ?

If you haven't, you need that for the triangle stripping to work.

If you do have VTK installed, you need to have your PYTHONPATH setup properly and/or have the VTK python bindings installed in the "correct" place.

If you think you have VTK installed properly, try running python from the command line and importing the vtk module:
shellprompt> python
Python 2.3.4 (#1, Jul 14 2004, 14:12:15)
[GCC 3.3 20030226 (prerelease) (SuSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import vtk
>>> (CTRL-D)

You type "python" and then once the python interpretor is running you'll get the ">>>" prompt. Then you type "import vtk" and hit RETURN/ENTER. Use CONTROL-D to exit python. If you get errors after you type "import vtk" its likely there's something wrong with your VTK, or possibly your python, distribution/installation.

I'm not aware of binaries to download for VTK, so its likely that the installation process is going to require you to build VTK before you can actually install it. It takes a long time to build vtk and I think it required cmake to be installed as well.
#83
08/05/2004 (2:32 pm)
Hey. First thank you so much for this exporter. You've made work fun again.

I'm having trouble triangle stripping. I'm getting this error in my console:

AttributeError: VTKStripper instance has no attribute 'faces'

I looked at the VTK site but it didn't really help me. I don't really know much about scripting, but do I need to add in some python script? I wish I didn't need to triangle strip but I need the dsq's to work on a G4. My meshes run great on a dual G5.

Any help would be much appreciated.
#84
08/05/2004 (2:34 pm)
Sorry to resend that message.
thanks for the quick response.
#85
08/05/2004 (2:58 pm)
You're welcome, I hope it helps.

I was just thinking about what you're trying to accomplish some more. It sounds like you're trying to optimize your exported mesh to make it work better on a lower performing system.

I think triangle stripping will help, but on models I've tried to optimize, I haven't received as much benefit from that as I was hoping.

There are several things I've run into with this. Specific to the blender exporter, if you enable Double Sided on your model (Editing F9 panel), the exporter produces faces for both sides of every triangle. If you don't have any faces in your models that need to be visible from both sides, you can halve your the face count by turning off Double Sided and insuring your normals are all pointing the proper way.

If you have faces in your models that need to be seen from both sides, you might want to make a few modifications to your model to make this unnecessary, i.e. put two polygons in place with their normals pointing opposite directions.

Not specific to the blender exporter is the number of textures used on a model. As far as I could find out from looking at posts here, each texture takes about the same amount of work to render. So, a model with two textures, i.e. two image files used as textures for different parts of the model, will take about twice as much work to render as the same model with only one image texture. Remapping your UVs and making the model only use one texture, if you're using more than one, should also give you some frame rate improvements.

I'm a little less confident on this second one as it seems a strange way to do things. When I researched it though, there were some good sources in the forum articles I found that were the foundation for why I believe it works this way. I don't have links to those articles handy or I'd point them out.
#86
08/05/2004 (10:59 pm)
Ok, two things :

1) You need VTK installed to use the triangle strip function. You can also implement your own triangle stripping functions, so it is pretty open ended.
I did write a partial python translation of the NVIDIA stripper, which is included, though it is currently not working (so its disabled).
The current exporter(0.84) should bail out of the triangle strip code if vtk does not exist; You should not get the faces attribute error (though if you do, please provide me with a full traceback).

2) You can optimize your model in many ways; Firstly, by using triangle strips - this decreases the amount of space on disk your dts takes up, and also the amount of indices sent to your card, though it really depends on what the triangle strips are like.
Secondly, check on the UV map on your mesh. Certain setups can cause the exporter to add too many duplicate vertexes than it needs(since in torque, vertexes go in pairs of vert,texvert,normal), slowing down torque ALOT. Selecting the mapto value of the first texture channel of your material to "stick" can also help, provided you have set up some sticky coords.
Thirdly, as zaz so rightly put, use only 1 material for your model. Torque is currently inefficient when it comes to rendering shapes (aka doesn't render them in batches, does alot of state transitions); it would be helpful if you only had 1 material in your shape (especially with lots of faces).
Fourthly, there is how you rig up your model to take into account. If you use a rigid rig (as in each mesh is assigned its own exclusive bone; "Standard" type), torque will not have as much work to do in calculating the position of each vertex in a mesh (as with "Skin" meshes);
Though note that the exporter currently cannot support parenting of meshes to single bones; you'll have to parent them to the armature.

3) Aswell as checking the double sided faces flag, the exporter should also check the double sided property of each faces, which you can select when you press f, select face, and look in the mesh edit tab.
#87
08/11/2004 (12:41 pm)
I'm having some pretty serious problems with the new exporter release 8.4 which were not present in the last release. Using the same model, my animations are now completely screwy (random movements in every directions, the face on the front of the model now shows through the back of the head, etc). When I revert back to the old scripts, the same problems seem to exist, as if to suggest there is a problem with the preferences stored in the .blend file. I have to go back to a backup copy of the model and the old scripts for it to work correctly again.

Is there a way to clear the preferences from the .blend?

Is this the warning on the download page, and if so, where do I paste that segment of code (blender or scripts, what file?). For now I'll be using the .82 release, but I do like the progress you're making with the interface.

Thanks for your time, and hard work.
#88
08/12/2004 (11:15 am)
Unfortunately I don't know the answer to this offhand, but I felt I should tell you that if I'm not mistaken James will be away today through next Wednesday...
#89
08/12/2004 (11:43 am)
...
#90
08/12/2004 (2:07 pm)
Thanks Joseph, That helps a lot.
I was worried it would involve opening the .blend in a text editor.
I'll see if that helps with the new scripts
#91
08/15/2004 (5:42 am)
I haven't had a chance to play with the latest relase much, but I'd expect if you chose the Configure option from the DTS Export submenu you should have been able to update the configuration.

As far as the problems you appear to be having, do you have all your rotations and scales applied ? How about parent/child relationships ? What has changed since it was last working ?

You can apply your rotations and scales with CTRL-AKEY or clear them with ALT-SKEY or ALT-RKEY. You also might want to assure that you aren't dealing with some sort of offsets between the armature and mesh. Unparent your mesh from the armature, clear the location of both your mesh and armature (ALT-GKEY). Realign your mesh to the armature by moving the mesh and then make its center the same as the armature's center (SHIFT-SKEY then 4KEY with armature selected, select mesh and on Editing F9 panel, press the Centre Cursor button). Then finally reparent the mesh to the armature without inverse, SHIFT-CTRL-PKEY.

A few notes:
1) Save you work somewhere before you do this, just in case.
2) I don't believe all of the above is completely necessary, but doing the tasks above will make the setup cleaner and more likely to work properly with more blender python utilities.
3) Like I said, I haven't been able to play with 0.84 much, but I did test an early version of it for James and didn't have the issues you encountered.
#92
08/15/2004 (12:40 pm)
...
#93
08/18/2004 (3:12 pm)
I think I'm having a simular problem as Ian. This is the first time trying the scripts. I'm using blender 2.33a and 0.84 scripts and my model looks great until the animations start. All the rotations seem to be rotating in the wrong direction, like when I have my character drop his arms to his side they come together in front of him. I tried this with the fix on the download page and blender 2.34 but had the exact same problem.
#94
08/18/2004 (11:02 pm)
About the rotation problem

In blender 2.34, there is a bug where the rotation ipo's (quatx-quatw) for ipo curves are incorrectly represented, so the wrong values are in the wrong places.

As long as you have modified the function described on the download page, you should be fine.

If you are still having problems, make sure the script you edited is the one you are using in blender.

Clearing the preferences from the blend

There should be a text buffer in the .blend entitled something along the lines of "TORQUEEXPORTER_CONF". Delete everything in this buffer, or even delete the buffer itself, and save. Then restart blender.

(This is basically what Joseph said)
#95
08/20/2004 (2:19 pm)
Not sure this is the right place to ask for help, but ...

I got this working on a WinXP Blender installation. Thanks and applause to James.

I'm trying to get it working on a Linux Blender installation. I'm a Linux newbie, and I can't find where to put the Torque DTS Exporter files on my machine. "whereis blender" returns "/usr/lib/blender", and Blender runs beautifully, but "find / -name blender -print" comes up empty-handed.

I also tried "find"ing release*234.txt, scripts, *.py, with no success.

I'm running Mandrake 9.2. I installed Blender 2.34 from the RPM, not from the tarball.

--
Regards
Ray
#96
08/20/2004 (2:39 pm)
Ray,

For linux, put the scripts in ~/.blender/scripts (~ is an alias for your home directory).
#97
09/02/2004 (6:53 pm)
Ah! Many thanks.
#98
09/06/2004 (6:10 pm)
I'm having some issues getting animation to work correctly. I'm using Blender v2.34, and I've applied the patch to the plugin to work around the animation issues. I've also tried Blender v2.33, and get different but incorrect results.

I'm trying to make a box that opens on the top. Like a hinge. It appears to animate correctly in Blender, but after exporting and viewing it in the show tool, the top of the box rotates around the "hinge", but it's in the wrong position.

If anyone has a couple of minutes, could you check out this link. And tell me what I'm doing wrong?

Thanks!
#99
09/10/2004 (12:52 pm)
Hey folks, regarding editing the function to get this current release to work with Blender 2.34, WHICH .py file is it that has the definition for BuildCurveMap(ipo)? I have an animated mesh with everything parented properly that exports without error to dts, but when I do torqedemo -show and load it, the mesh is horribly stretched out like Mr. Fantastic. I am assuming this is the rotation problem described?!

Enjoying getting these two great pieces of software (no sarcasm) to work together. Thanks everyone for working together on this.
#100
09/10/2004 (1:02 pm)
Joshua,

BuildCurveMap(ipo) is located in Dts_Blender.py.
On a sidenote, if you use the latest version of blender from CVS, you do not need the patch.