Using cmod tools? (for Chris)

General discussion about Celestia that doesn't fit into other forums.
Topic author
alphap1us
Posts: 212
Joined: 17.12.2003
With us: 20 years 9 months
Location: Buenos Aires

Using cmod tools? (for Chris)

Post #1by alphap1us » 11.11.2004, 20:45

Hi Chris,
I would like to convert some old models from 3ds to cmod. I read through the readme that comes with the cmod tools, but I am unsure of which options are the most appropriate. Can you give some general guidelines about which options should be used to make the models come out best? The models are older and less complicated than some we have seen recently, so I probably want to err on the side of detail rather than rendering speed.

Thanks in advance.
Joe

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 8 months
Location: Seattle, Washington, USA

Post #2by chris » 12.11.2004, 06:37

The options that you should use are:
--uniquify
--normals
--weld
--optimize

You should also specify a smoothing angle, but the angle you pick depends on the model. 45 degrees is reasonable for a spacecraft; 180 degrees (i.e. smooth all edges) is better for asteroids, which shouldn't have any sharp edges. You can choose to use the --binary flag to generate a binary cmod--it's substantially smaller than the ASCII version.

Here's the complete command line:

Code: Select all

cmodfix --uniquify --normals --smooth 45 --weld --optimize --binary input.cmod output.cmod


Or, using the short versions of the flags:

Code: Select all

cmodfix -u -n -s 45 -w -o -b input.cmod output.cmod


--Chris

Guest

Post #3by Guest » 12.11.2004, 08:36

I would like to use Blender to generate some spacecraft for my Celestia Add-on.
Is it possible to convert the blender file in cmod?
Thank you

Topic author
alphap1us
Posts: 212
Joined: 17.12.2003
With us: 20 years 9 months
Location: Buenos Aires

Post #4by alphap1us » 12.11.2004, 20:14

Guest-
You should output the file in 3ds (3D Studio Max) and then use the cmod GUi utility at http://celestiamotherlode.net/catalog/utilities.html to convert it into cmod using the guideline that Chris just gave.

Cheers,
Joe

smbika
Posts: 58
Joined: 07.07.2004
With us: 20 years 2 months
Location: Eastern Seaboard

GUI comment

Post #5by smbika » 13.11.2004, 16:29

Hi,

Thanks for the plug on the GUI Joe! To the guest above who would use it: when i was testing it and all of the variants of the cmodfix command parameters it seemed to me that the -b or -a (--binary or --ascii) params did not work with the others so i coded the gui to make them mutually exclusive with the rest. Hence, the GUI equivalent of the aforementioned command by Chris, cmodfix -u -n -s 45 -w -o -b input.cmod output.cmod, will not be generated. You will have to run 2 commands - one with all the other params first and then one with the conversion to binary like so:

cmodfix -u -n -s 45 -w -o input.cmod output.cmod

and then

cmodfix -b input.cmod output.cmod

Well, the GUI equivalent, anyway.

I have since tried the very command from above and it does indeed work. This means I will be changing the utility to reflect this and will make it work accordingly. I am sorry for the inconvenience and i must have just issued the commands incorrectly as i kept getting the -usage message.

In the meantime, it should work the way i mentioned above and still be easier than typing it all in in DOS.

Also, there is no capability in the GUI for renaming the output file. It will replace the original file with the fixed one.

These aforementioned shortcomings, the ability to process a list of files rather than just one, and tool tips to highlight the meanings of the different fix parameters are high on the list of corrections and upgrades i am working on...I will make them so as soon as possible. Until then, I hope the tool as it stands is of some use.

Apologies and Thanks,
Sean
The only show that could beat Stargate<whatever> in a fair fight is Firefly...

smbika
Posts: 58
Joined: 07.07.2004
With us: 20 years 2 months
Location: Eastern Seaboard

New version available from me

Post #6by smbika » 16.11.2004, 04:54

Hi!

I have a new version of the GUI tool for converting models. It allows for the selection of a new file name and for using the -b or -a options with other options for the fix command. It is available from me at the moment - email me at smbika@aol.com and i will send you a new zip file. Soon i will upload it to the motherlode. No tool tips or multiple files yet - sorry :cry: .

Thanks,
Sean :D
The only show that could beat Stargate<whatever> in a fair fight is Firefly...

smbika
Posts: 58
Joined: 07.07.2004
With us: 20 years 2 months
Location: Eastern Seaboard

New version has been uploaded to the motherlode

Post #7by smbika » 16.11.2004, 16:47

It might be on the utilities page in the next couple of days but you can get it here - http://www.celestiamotherlode.net/creat ... odv3-1.zip now if you like.

Thanks,
Sean
The only show that could beat Stargate<whatever> in a fair fight is Firefly...

TERRIER
Posts: 717
Joined: 29.04.2003
With us: 21 years 5 months
Location: West Yorkshire, England

Re: New version has been uploaded to the motherlode

Post #8by TERRIER » 16.11.2004, 19:44

smbika wrote:It might be on the utilities page in the next couple of days but you can get it here - http://www.celestiamotherlode.net/creat ... odv3-1.zip now if you like.

Thanks,
Sean


Cheers, I'll give this a try.
1.6.0:AMDAth1.2GHz 1GbDDR266:Ge6200 256mbDDR250:WinXP-SP3:1280x1024x32FS:v196.21@AA4x:AF16x:IS=HQ:T.Buff=ON Earth16Kdds@15KkmArctic2000AD:FOV1:SPEC L5dds:NORM L5dxt5:CLOUD L5dds:
NIGHT L5dds:MOON L4dds:GALXY ON:MAG 15.2-SAP:TIME 1000x:RP=OGL2:10.3FPS

TERRIER
Posts: 717
Joined: 29.04.2003
With us: 21 years 5 months
Location: West Yorkshire, England

Post #9by TERRIER » 16.11.2004, 20:35

Just had a go at converting the Helios UAV 3ds model using;

Convert 3ds to cmod,
Weld vertices,
Generate normals,
Uniquify,
Optimize,
Smooth Angle 45 deg.

Result, seems to be OK.

Model looks fine and the frame rate has definately improved. :D

Only 'prob' is that the file size has increased from 3.5MB for the old .3ds model to 22.5MB for my .cmod version 8O

regards,
TERRIER
1.6.0:AMDAth1.2GHz 1GbDDR266:Ge6200 256mbDDR250:WinXP-SP3:1280x1024x32FS:v196.21@AA4x:AF16x:IS=HQ:T.Buff=ON Earth16Kdds@15KkmArctic2000AD:FOV1:SPEC L5dds:NORM L5dxt5:CLOUD L5dds:
NIGHT L5dds:MOON L4dds:GALXY ON:MAG 15.2-SAP:TIME 1000x:RP=OGL2:10.3FPS

smbika
Posts: 58
Joined: 07.07.2004
With us: 20 years 2 months
Location: Eastern Seaboard

Yeah, I noticed that too...

Post #10by smbika » 16.11.2004, 21:07

For now I am going to claim the same incredulity as you. Seems like it should have been a TAD smaller as the cmod format is supposed to be more efficient for Celestia. This does not logically mean, however, that the size would be smaller - rather the format itself might lend itself to more efficient processing. Just for grins, try doing the same thing with the actual DOS tools and see how big the files are. I will do the same. :!:

Thanks,
Sean

PS - glad it works otherwise!

Also, try using the convert to binary option - i am sure it will reduce the size some - but it still might be bigger than the 3ds.

----------------
Just added:

Yup. I tried it the hard way - command line - and they indeed are humongified when you convert - Kleopatra.3ds went from 91,633 bytes to 981,534 bytes when converted to ascii cmod format. When I converted to binary it went down to 441,992 bytes. 8O
The only show that could beat Stargate<whatever> in a fair fight is Firefly...

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 8 months
Location: Seattle, Washington, USA

Post #11by chris » 16.11.2004, 21:17

TERRIER wrote:Only 'prob' is that the file size has increased from 3.5MB for the old .3ds model to 22.5MB for my .cmod version 8O

The file will be a lot smaller if you convert it to a binary cmod. However, it's still likely to be slightly larger than an equivalent 3ds file, the cmod contains surface normals, whereas normals must be generated at load time for 3ds files.

--Chris

TERRIER
Posts: 717
Joined: 29.04.2003
With us: 21 years 5 months
Location: West Yorkshire, England

Post #12by TERRIER » 17.11.2004, 00:58

Yep, I've tried converting to binary output and I've got the Helios file size down to 4.2MB....and it still looks fine.

Might experiment with the smoothing angle tomorrow.

cheers,
TERRIER
1.6.0:AMDAth1.2GHz 1GbDDR266:Ge6200 256mbDDR250:WinXP-SP3:1280x1024x32FS:v196.21@AA4x:AF16x:IS=HQ:T.Buff=ON Earth16Kdds@15KkmArctic2000AD:FOV1:SPEC L5dds:NORM L5dxt5:CLOUD L5dds:
NIGHT L5dds:MOON L4dds:GALXY ON:MAG 15.2-SAP:TIME 1000x:RP=OGL2:10.3FPS

Topic author
alphap1us
Posts: 212
Joined: 17.12.2003
With us: 20 years 9 months
Location: Buenos Aires

Post #13by alphap1us » 20.12.2004, 00:05

Hi,
Sorry to pick this thread back up after it has lain dormant, but I am actually starting on this project now. I just noticed that no one mentioned the "Generate Tangents" option, so I wondered what this is for. Any help?

Thanks,
Joe

smbika
Posts: 58
Joined: 07.07.2004
With us: 20 years 2 months
Location: Eastern Seaboard

Tangents...

Post #14by smbika » 20.12.2004, 12:57

alphap1us,

No apologies necessary...as far as I know, which is this blurb in the readme.txt that comes with the command line utilities on Chris' download page ( http://www.celestiaproject.net/~claurel/celestia/cmodtools/ ) or the LicenseInfo.txt on the motherlode download page
( http://www.celestiamotherlode.net/creat ... odv3-1.zip ),
Generate tangents refers to:
Tangents are required in order to apply bump maps or other per-pixel lighting
effects to a cmod. The tangent vectors are generated from the vertex
normals and texture coordinates--both must be present in order to create
tangents.

I have not tried the option myself as regards looking for practical results, but I am sure in the context mentioned above it is useful.

Hope that helps,
Sean
The only show that could beat Stargate<whatever> in a fair fight is Firefly...

Guest

Post #15by Guest » 23.12.2004, 14:07

alphap1us wrote:Hi,
Sorry to pick this thread back up after it has lain dormant, but I am actually starting on this project now. I just noticed that no one mentioned the "Generate Tangents" option, so I wondered what this is for. Any help?


Tangent vectors are used for bump mapping. The 'generate tangents' option derives a surface tangent for each vertex based on the geometry and texture coordinates stored in the mesh. Since Celestia can't yet apply bump maps to meshes, the option isn't very useful at the moment. It won't be long, though . . . I have a 10 day break from work that starts on Friday.

--Chris

Topic author
alphap1us
Posts: 212
Joined: 17.12.2003
With us: 20 years 9 months
Location: Buenos Aires

Post #16by alphap1us » 24.12.2004, 00:54

So while I am at it, should I use this option, so that when this feature is implemented, the bumpmaps will automatically become available? Are there any downsides to this approach, like a large size increase?

Cheers,
Joe

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 8 months
Location: Seattle, Washington, USA

Post #17by chris » 28.12.2004, 05:48

alphap1us wrote:So while I am at it, should I use this option, so that when this feature is implemented, the bumpmaps will automatically become available? Are there any downsides to this approach, like a large size increase?


Extra information is added to the file, so yes, it will increase the size. Like a normal, a tangent is stored as three single-precision float values, so it will make the file larger by 12 bytes per unique vertex. Thus, tangents should only be generated for meshes that will have bump maps applied.

--Chris

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 8 months
Location: Seattle, Washington, USA

Post #18by chris » 28.12.2004, 05:56

Let me also add that the cmod format will at some point be enhanced to allow separate bitangent vectors to be specified per vertex. Right now, the bitangent is assumed to be the cross product of the tangent and the normal, thus assuring an orthonormal surface space basis. But, for certain lighting effects, it's desirable to have non-orthogonal tangent and bitangents. First however, I need to get basic bump mapping working . . . :)

--Chris


Return to “Celestia Users”