Page 1 of 1

Using cmod tools? (for Chris)

Posted: 11.11.2004, 20:45
by alphap1us
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

Posted: 12.11.2004, 06:37
by chris
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

Posted: 12.11.2004, 08:36
by Guest
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

Posted: 12.11.2004, 20:14
by alphap1us
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

GUI comment

Posted: 13.11.2004, 16:29
by smbika
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

New version available from me

Posted: 16.11.2004, 04:54
by smbika
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

New version has been uploaded to the motherlode

Posted: 16.11.2004, 16:47
by smbika
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

Re: New version has been uploaded to the motherlode

Posted: 16.11.2004, 19:44
by TERRIER
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.

Posted: 16.11.2004, 20:35
by TERRIER
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

Yeah, I noticed that too...

Posted: 16.11.2004, 21:07
by smbika
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

Posted: 16.11.2004, 21:17
by chris
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

Posted: 17.11.2004, 00:58
by TERRIER
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

Posted: 20.12.2004, 00:05
by alphap1us
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

Tangents...

Posted: 20.12.2004, 12:57
by smbika
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

Posted: 23.12.2004, 14:07
by Guest
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

Posted: 24.12.2004, 00:54
by alphap1us
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

Posted: 28.12.2004, 05:48
by chris
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

Posted: 28.12.2004, 05:56
by chris
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