Hi all,
I am not at all interested in fiddling with (CMOD) models by trial and error e.g. via
Blender, Anim8or etc..
Actually, I hate to work with
Blender, where EVERYTHING is non-standard, even the file selector
Since Steve (aka
cartrite) and
John VanVliet spent so much time with Blender import/export in this forum and in shatters.net, I was fortunately put off in an early stage of the affair.
Instead, my idea was to CMOD-convert
directly standardized published shape model data, to which corresponding scientific texture mosaics are matched.
Due to its
potato shape, Phobos is a good example for the obvious that a simple cylindrical map depends pretty strongly on the underlying non-spherical model. Consequently,
any such texture update also needs a corresponding 3D-model update. Since my recent 4k Phobos texture update, an import of the published and matched shape model to CMOD format has become a necessity.
++++++++++++++++++++++++++++
So my task was to circumvent Blender entirely. Instead, I wrote just a little Perl script that produces directly an ascii CMOD version of the shape model in question. Chris Laurel's
cmodfix utility can then be used to generate normals and convert the result into a binary CMOD format etc.
++++++++++++++++++++++++++++
Thanks to some pedagogical explanations by
Chris Laurel about CMOD format essentials, this task amounted to just writing a Perl script not longer than HALF a page (apart from my detailed comments). Being "cross-platform", Perl runs almost everywhere and offers any kind of fancy math, even including a quaternion module

Notably, its easy to learn...
Before explaining a bit more precisely what I did, consider first the
cucumber shaped
asteroid Itokawa,
where a quite analogous procedure was applied already. The respective scientific shape model data are published here
http://hayabusa.sci.isas.jaxa.jp/index.php => Shape Model. With sufficiently high resolution, the
Gaskell shape models on that site can give almost photo-realistic results!
For that purpose, ChrisL wrote a little utility in C++, as part of the Celestia distribution, called
txt2cmod. It is located in the src/tools/cmod directory of the Celestia sources. It can very easily be compiled. This utility is just half a page of code and specializes in
reading-in the published shape model data of Itokawa (in various resolutions) and converts them into
ascii CMOD format. Subsequently, you just run cmodfix on this file and readily get a finalized binary CMOD. The command reads typically
cmodfix --normals --smooth 90 --weld --binary <input file> <output file>
That is all there is and it takes just a few minutes with fabulous results! That's what I wanted to do, too in case of Phobos.
There is one difference of most published shape models with the one for Phobos: The scientific reference for Phobos' 3D shape only contains vertex data (16471), but NO (triangular) faces that are required for using the cmodfix tool. Here is the reference for the latest scientific Phobos shape model by Peter Thomas/Cornell U., to which my new 4k texture was matched.:
EAR-A-5-DDR-SHAPE-MODELS-V2.1
http://sbn.psi.edu/pds/asteroid/EAR_A_5 ... phobos.tab
I have attached my Perl script that leads within minutes to perfect results for Celestia 1.6.x, like so:
The texture is what I recently discussed here:
http://forum.celestialmatters.org/viewt ... 33&start=0
But the shape model (
phobos.cmod) to which this texture has been assigned, is NEW, obtained just from these two commands:
> ./phobos_cmod.pl < m1phobos.tab
involving that above input file with the 16471 Phobos vertex data.
> cmodfix --normals --smooth 90 --weld --binary phobos_ascii.cmod phobos.cmod
The file phobos_ascii.cmod is the ascii-CMOD output from my Perl script and phobos.cmod is the improved binary CMOD that produced the above image. Note in particular how well now the crater labels match up with the center positions of their corresponding craters!!
Let me finally explain briefly what my Perl script does:
It's really not hard, TRY it yourself!
Fridger
+++++++++++++++++++++++++++++++++++++++++
Here is my well commented Perl script for download
http://www.shatters.net/~t00fri/images/ ... mod.pl.zip
++++++++++++++++++++++++++++++++++++++++++