cmodtools under linux

The place to discuss creating, porting and modifying Celestia's source code.
Topic author
astro
Posts: 41
Joined: 27.10.2003
With us: 21 years 1 month

cmodtools under linux

Post #1by astro » 24.10.2004, 03:29

Hi,

gcc compiles 3dstocmod, but not cmodfix.

I made some changes to cmodfix for it to compile.

The version that compiles (and runs) on Linux can be found here:
http://godard.b.free.fr/celestia/cmodfix.cpp


I am working on a basic model of the FUSE spacecraft. I made the model with Blender. But I haven't succeeded in getting it into celestia yet. In the meantime, you can find some images here:
http://godard.b.free.fr/celestia/fuse_model.html
If I can't get a decent 3ds conversion from blender (I might be doing something wrong or all the export modules in Blender for any output formats other than .blend are bugged), I might try to redo the model in wings3d.
Need to work on a blender export module for cmod ... one day maybe.

Toti
Developer
Posts: 338
Joined: 10.02.2004
With us: 20 years 9 months

Post #2by Toti » 24.10.2004, 05:17

Have you tried exporting it using Lightwave format and reconverting it to 3DS with an external utility?
If your mesh doesn't have UV maps this should work fine. If not, you can try another intermediate format: if I recall correctly, there is a Wings3D exporter for Blender.

Thanks for your work with cmodfix

Topic author
astro
Posts: 41
Joined: 27.10.2003
With us: 21 years 1 month

Post #3by astro » 24.10.2004, 22:41

About blender export module, most of them doesn't even output anything. I get an error in the console.

The 3DS export outputs something, but when the 3DS model is put in Celestia some of the faces are not present (or become transparents depending on the viewing angle). Other faces appear (that is some vertex from different faces form a face that wasn't there in my blender model.
Textures are not shown. And material colors are not correctly set for some meshes.
Also it seems the 3DS exported model is not perfect either when seen in Wings3D.

I was thinking of writing the model with a text editor directly in cmod ASCII, instead of bothering with conversion, since I don't have so many vertices. But I would first need to understand cmod ASCII. I might try to export some wings3D simple models to cmod ASCII via
3DS to figure this out.

Also is there a document that explains exactly what are the requirements for a model to work in Celestia? I haven't found one yet.

- Should all faces be cut in triangles?
- Can different objects use the same material instance?

Thank you.

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 2 months
Location: NY, USA

Post #4by selden » 25.10.2004, 01:49

astro,

I'm sure Chris can describe things better than I, since he's a professional working in the 3D field and is intimately familiar with the design of most 3D graphics cards, but what the heck...

The few 3D graphics designs that I've done with a GUI editor have been created using Anim8or. It has a very simple user interface and its 3DS models are accepted by Celestia.

Some time ago, Chris posted a description of the ASCII CMOD format to the developers' mailing list. A slightly edited version of his description, along with a copy of the comments that are in Celestia's source code, can be found on my "cryptic notes" Web page at http://www.lns.cornell.edu/~seb/celestia/celestia_notes.html

The CMOD format is designed for optimal translation into OpenGL code, which is what's used by 3D graphics cards.

Meshes are defined in terms of vertices. Then lists of interconnected vertices form surfaces composed of triangles.

Materials can be reused as many times as necessary within the same CMOD file.
Selden

Toti
Developer
Posts: 338
Joined: 10.02.2004
With us: 20 years 9 months

Post #5by Toti » 25.10.2004, 03:32

Do not use the 3DS exporter: it creates overlapping, fake faces and does a bad job with some normals. It can't export UV maps, so you lose your textures in the process.

About blender export module, most of them doesn't even output anything. I get an error in the console.

In order to run, some of the exporters might need a full Phyton installation. Your Phyton version must be compatible with Blender's Phyton API.
You must set your Phyton path accordingly. You can get more info here: http://www.elysiun.com/forum/

I was thinking of writing the model with a text editor directly in cmod ASCII, instead of bothering with conversion, since I don't have so many vertices. But I would first need to understand cmod ASCII. I might try to export some wings3D simple models to cmod ASCII via
3DS to figure this out.

A Blender->CMOD conversion tool development should be straightforward. I have already coded a script that does the inverse (CMOD->Blender) transform.
The main complication is to arrange the internal temporary structures in order to increase speed efficiency when dealing with heavy meshes.

Unless you are very accustomed to Blender, the Anim8or tool that Selden commented would make things easier for you.

Topic author
astro
Posts: 41
Joined: 27.10.2003
With us: 21 years 1 month

Post #6by astro » 26.10.2004, 03:32

Thank you for your replies, Toti and Selden.

In order to run, some of the exporters might need a full Phyton installation. Your Phyton version must be compatible with Blender's Phyton API.
You must set your Phyton path accordingly. You can get more info here: http://www.elysiun.com/forum/

I have Blender 2.34 which was compiled using Python 2.3.x. I have a full Blender 2.3.4 install on my Slackware current. I just noticed I forgot to export Python path before running blender. But I still can't export my FUSE model to Wings or Nendo. I get an error in generate_edgetable. I can however export simpler model (a cube). Maybe there is something wrong with my model.
I could export to lightwave and wavefront. Opening the wavefront model in Wings3D and exporting it to 3DS seems to work in Celestia, except for the materials : it's all white/grey (it was already when I opened the wavefront model in Wings3D).
But that's already better. Need to work on the materials now.
I read somewhere in the forum that we should not use more than one material per object in the 3DS model. Is it still a requirement for recent versions of Celestia (1.3.2)?

The few 3D graphics designs that I've done with a GUI editor have been created using Anim8or. It has a very simple user interface and its 3DS models are accepted by Celestia.
Thanks for the suggestion but I would really feel better using only Linux native software to make this model.

Some time ago, Chris posted a description of the ASCII CMOD format to the developers' mailing list. A slightly edited version of his description, along with a copy of the comments that are in Celestia's source code, can be found on my "cryptic notes" Web page at http://www.lns.cornell.edu/~seb/celesti ... notes.html


Thanks for these notes. It seems there are lots of interesting stuff in there.
I will have to read all of this when I find the time.

Also about the cmodfix, there is one change I made I am not at all sure about:
Line 386 of the original cmodfix.cpp was

Code: Select all

delete mesh.getVertexData(); 

gcc didn't return an error but a warning that I think is serious enough to be addressed:

Code: Select all

cmodfix.cpp:386: warning: deleting `const void*' is undefined

I replaced it with

Code: Select all

delete[] reinterpret_cast<const char*>(mesh.getVertexData());

I just used the best guess on the type from the code above, but I am not sure if it's delete or delete[], if the type is char or anything. I started to read through the getVertexData method definition but I was refered to other classes and I got kind of lost. So if someone knows the answer... Chris probably does...
After that change I don't get any warning, but that doesn't mean it's freeing the memory as it should.


Return to “Development”