Truespace plugin

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
computerwhiz
Kobold
Posts: 37
Joined: Mon Nov 29, 2004 8:51 pm

Truespace plugin

Post by computerwhiz »

Hello everyone. I am the developer of the Truespace-to-Ogre converter plugin. Just wanted to let everyone know that the plugin is ready for people to test it out.

Right now, it only exports out the mesh objects. Also, all vertex normals are smoothed, and I have not gotten around to doing crease angles (as I need to learn how they work.) I'm sure I can figure them out via the cosine/unit vector.

You will need Truespace 5.2 or higher, and the Truespace 5.2 SDK, which is available from Caligari. I'm sure with a few modifications to the source, it could be ran on any version that supports the functions I used.

You can download it from the ogreaddons/truespaceexporter module on the Ogre CVS server (thanks again Sinbad for letting me put it there.)

Let me know how you like it, and if you have any suggestions, please let me know.


[EDIT]

The Truespace SDK is free, by the way. Also, all of the compilations instructions are in the README.txt file.

[/EDIT]
There are 10 kinds of people that understand binary....those who do....and those who don't.
Black Manatee
Gnoblar
Posts: 1
Joined: Fri Jul 01, 2005 5:14 am
Location: Florida, U.S.A.

Re: TS-to-Ogre plug-in

Post by Black Manatee »

Just wanted to say thanks for working on the plug-in. I'm very attached to TrueSpace/GameSpace (not just the price, though that's a big consideration too!), and I'm eager to beta-test the convertor and help you make it workable. Thanks again...
Black Manatee
A distant relative of the "Black Dog" squadron!
computerwhiz
Kobold
Posts: 37
Joined: Mon Nov 29, 2004 8:51 pm

Post by computerwhiz »

Cool :). Thanks.

I haven't had much time to work on it over the past week or two, but I did find one bug with the vertex smoother, and plan to release the updated source files once I get a couple of new features in it.

One of the features I'm working on is detecting what shading type each object uses (smooth or faceted), and then using that to determine how each vertex normal comes out. That shouldn't be too hard.

Another feature I'm working on is the bone/skeleton structure. Even though I have been using Truespace since version 3.2, and am quite proficient at modeling, I've never used skeletons. As such, I am completely lost...lol.

From what I understand, a bone connects two joints together, and a joint can have multiple bones joined to it. Is this correct?

I'll post another message here once the updated sources are in place.
There are 10 kinds of people that understand binary....those who do....and those who don't.
Kary
Gnoblar
Posts: 1
Joined: Mon Jul 25, 2005 2:41 pm

Excellent!

Post by Kary »

Iam long time user of cali. TrueSpace. Your plugin is the best idea, wich can I imagine! Thank you! Iam waiting for news. :!:
computerwhiz
Kobold
Posts: 37
Joined: Mon Nov 29, 2004 8:51 pm

Post by computerwhiz »

Well, I finally had a chance to dust off the Truespace exporter code...

I guess I was thinking one-dimensional when I wrote it...lol. Currently, the code converts all face normals to vertex normals. That's fine and dandy when the object is a sphere or a smooth object, but when you toss a cube in there...oh boy does it look funny...

I'm going to have to rewrite about half of the code so that when I run across a faceted, autofaceted, or smooth face, I can smooth the normals accordingly. Hopefully, when I'm rewriting it, I can toss some code in to export materials too.

It's probably going to take a month or two before I can post any code...primarily because I rarely have time anymore to work on it. But I have a project coming up that I will need to use it with, so it may be done sooner than that.

Sorry about the delay...this plugin is my first attempt at working with 3D objects at the mathematical level...I'm used to just designing animations and programming business apps.
There are 10 kinds of people that understand binary....those who do....and those who don't.
klauss
Hobgoblin
Posts: 559
Joined: Wed Oct 19, 2005 4:57 pm
Location: LS87, Buenos Aires, República Argentina.

Post by klauss »

Unless the information is stored in the file somehow (that is, if you're talking about autosmoothing), then the method is really simple.

For each vertex, set up an auxiliary vertex array. Copy all vertex info, except normals. Initialize them to 0.

Now, for each face, add to each vertex the normal, and have a way to store the number of normals you've been summing.

Up to here, it must have been what you've been doing.

To get autosmoothing, for each face, also, find the faces sharing edges (not vertices). You'll have to setup a map for this that allows quick lookup given two indices... probably more than a single map... three maps, I'm thinking. This could be tricky... don't worry. Since I have to do it for my own converter, I can send you the code as soon as I have it, if you want.

Then, for each edge, you take the normalized normals of the faces, and do a simple dot product. If the angle is above the threshold, do not add those two vertices' normals. If it's below, do it.

This should give good results.
Oíd mortales, el grito sagrado...
Hey! What is it with that that?
Wing Commander Universe
computerwhiz
Kobold
Posts: 37
Joined: Mon Nov 29, 2004 8:51 pm

Post by computerwhiz »

To Klauss:
That is the first description of vertex smoothing that I've read that actually makes sense to me...lol. Thanks.


To everyone:
Here's a status update on the plugin :D . So far, I have not had time to work on it lately. I had ran across an article on how to use the Truespace API with the Microsoft .NET Framework...so if I can get a plugin to work with that, then I can knock this plugin out within a week (when I have the time) . I'm not too savvy with doing DLLs in C++. Maybe I'll look into managed C++ (I just like having everything easily accessible with a dot operator rather than having to remember all the include files I need)

Well, I have some time today and this weekend...maybe I'll take a look at the code again, and see if I can get something going for everyone.
There are 10 kinds of people that understand binary....those who do....and those who don't.
tonywt
Gnoblar
Posts: 4
Joined: Tue Apr 05, 2005 4:45 am

TS Plugin Advance

Post by tonywt »

My first attempt at using the plugin was with a UV mapped cube and saw the side affects spoken of in the forum. I'm really a TS user and was hoping not to have to juggle tools. I also see its been a good while since anything has been spoken of the TS Exporter, which leads me to believe the project is at a standstill. I don't know if I have the intestinal fortitude to take a hack making some progress, since I'm not familiar with the TS API yet. How depressing :(
computerwhiz
Kobold
Posts: 37
Joined: Mon Nov 29, 2004 8:51 pm

Post by computerwhiz »

STATUS UPDATE:

I know it's been quite a while since I've been able to work on the plugin, but I have some time now to work on it. Tonight, I started working on exporting materials. Caligari couldn't have made this any more difficult!

Getting the actual material used on a face is not hard, but since within TS you can have multiple materials assigned to one object/name, it's going to be much more difficult than I thought. I will have to get the list of all the materials used on the object, figure out what faces use what materials, and separate them into separate submeshes in the XML file. Then I can finally assign the materials to them as needed.

Also, I will attempt to work on the vertex smoothing issues too at some point this week.

One good thing is, the exporter somewhat works! I was able to export a mesh of a monkey with over 6,000 faces, and the plugin didn't crash! Plus, the monkey looked halfway decent in CEGuiMeshViewer. Although, I ran the plugin on a model of a house, and it did crash...so there is still some work to be done on it.

I can see why no one else wanted to write the plugin...lol. If someone from Caligari reads this message...please...write better documentation. Your page numbers aren't even right!

[EDIT]
The exporter can somewhat export materials now, and it seems to be fairly stable. Discussion about the plugin is taking place at the following link:

http://www.ogre3d.org/phpBB2/viewtopic. ... 610#118610
[/EDIT]
There are 10 kinds of people that understand binary....those who do....and those who don't.
Post Reply