Preparing Models for Celestia

All tutorials about Celestia go in here. For Celestia itself, add-ons, textures, scripting, etc.
Avatar
Topic author
FarGetaNik M
Posts: 432
Joined: 05.06.2012
With us: 7 years 1 month
Location: Germany

Preparing Models for Celestia

Post #1by FarGetaNik » 12.08.2016, 19:58

I just want to share with you how I create models for Celestia, maybe this could be useful for someone since it took my much effort to learn this. Also I'd appreciate any tips to improve this process, I'm still struggling with some flaws. I will explain the process on the example of the Dawn spacecraft and Epimetheus. Note: I'm working on Windows 10.

Tools necessary:
Blender: https://www.blender.org/download/
Anim8or: www.anim8or.com
cmodview: http://celestiaproject.net/forum/viewtopic.php?f=25&t=17413&p=134262&hilit=cmodview#p134262
cmod export script for Anim8or: http://anim8or.com/scripts/selden/export_cmod_plugin.a8s
Blender and Anim8or need some time to learn, cmodview is very simple and should not make any trouble.

Download a suitable model
I have no talent in creating models myself, so I rely on sources to get a suitable model. For solar system objects, I recommend the 3D asteroid catalogue by Greg Frieger: http://space.frieger.com/asteroids/ and for spacecraft NASA's 3D resources: http://nasa3d.arc.nasa.gov/models

Blender: Convert model to OBJ
If the model is in any format Anim8or can't handle (mostly spacecraft in .blend format) open it with Blender first. Click File/Export/Wavefront (.obj) to create an obj file for Anim8or. This is necessary, because I have no working cmod converter for Blender running on Windows, but only for Anim8or.
Here comes the first flaw: Blender creates a yet invisible cube, as you can see in the materials in the screenshot. I can't delete it.
modelforcelestia-dawn-blender.png


Anim8or: Texturing the model
Open all textures of the model (except the normal maps) in your graphic manipulation software of choice and export them as jpg, since Anim8or can’t handle png. You can later use these textures in Celestia as well, except png is more suitable (for featureless textures png compression is more effective).
Open the obj in Anim8or. Switching to the materials menu, we see that the invisible cube converted itself into a now visible, still useless cube. On Dawn it's inside the mesh, because the spacecraft itself is cubic. Open the cube’s material (usually on the top) and set transparency to 0 (deleting it corrupts the model). Then open each material by double-clicking on it and assign the correct texture to it. This is done by clicking on the 'T' next to diffuse and clicking on “Load Texture” in the new window. Then select the texture with the name fitting the material.
modelforcelestia-dawn-anim8or.png


If you are not working with a spacecraft but rather a small body model from the asteroid catalogue, you will have to rotate the model first. The x-axis should be the longest. Unlike in Celestia, in Anim8or the polar axis is y and should be shortest. If your object is a tidally locked satellite, you might want to make sure the mesh is rotated around the polar axis the right way by comparing it to its Celestia counterpart or spacecraft imagery. Then you have to assign a texture to the model, or it will be impossible for Celestia to render ANY texture to it. This is again done by selecting the model and switching to materials. Double-click on “New” and click on the button next to “Diffuse” and proceed as described above. Click “Apply” on the material. The mesh might change color, but the texture is not rendered yet. Click on “UV” on the left and confirm, then double click anywhere to let a window appear to select “Spherical projection”, the texture should now be rendered. You are able to rotate the texture to align it to the features of the mesh if necessary.
modelforcelestia-epimetheus-anim8or.png


Export to CMOD
As finished, export the model to cmod. 2 files are created, one for materials and one for the mesh. Open both. You may delete any unnecessary comments and stick the content of *.cmod_mesh after the content of *.cmod_material, saving it with the file extension .cmod. We now have a raw ASCII cmod, which already can be used in Celestia, but fine-tuning is recommended. For the next step, you have to put it into a models folder and make sure the textures (including normal maps) are present in a folder structure where Celestia would expect them:
put cmod in here:
.../model
put all textures in here:
.../textures/medres

Edit in cmodview
When successful, the cmod can be loaded with cmodview. If not, you will get an error, if so you need to retry to stitch the exported files together. Using such a file in Celestia might cause a crash.
We now can edit specular power and color, which is displayed material for material in Blender, select the respective material, which is now highlighted in green, and edit specular data on the right. If you are unlucky, the invisible cube obscures some materials. For solar system bodies, you might want to remove the texture, or Celestia will always load the assigned texture if not told otherwise by an ssc.
Also, a normalmap can be assigned to the model: Click on Operations/Generate tangents... and then on Operations/Uniquify Vertices. Again by clicking on individual materials you can select a normalmap if one is present in the right folder. For solar system objects, you might also want to select a diffuse color corresponding to the true color and albedo. Saving the model converts it into a binary cmod. It is now ready for use in Celestia.
modelforcelestia-dawn-cmodview.png


Dawn model featuring specularity and normalmap in Celestia:
dawn-normals.jpg

Return to “Tutorials”

Who is online

Users browsing this forum: 1 guest