Celestia/Tutorials/Advanced Asteroids

Once you have written a basic asteroid definition, you may want to put in the work to make your asteroid more accurate. After all, some asteroids have been observed enough that we now know additional parameters about them, such as shapes, colors, and rotational axes.

This tutorial assumes you have read the previous page: Simple Asteroids. It also assumes that you have an .ssc file with code that looks something like the following. For this example, we will be using the asteroid 107 Camilla:

"107 Camilla:Camilla" "Sol"
{
	Class "asteroid"
	Mesh "asteroid.cms"
	Texture "asteroid.jpg"
	Radius 105.185

	EllipticalOrbit
	{
	Epoch	        2459000.5
	Period		6.52164269786
	SemiMajorAxis	3.49059288735
	Eccentricity	0.06510884809
	Inclination	10.0014540063
	AscendingNode	172.582645061
	ArgOfPericenter 306.396995698
	MeanAnomaly	27.1200816186
	}

	Albedo 0.059
	RotationPeriod 4.844
}

MeshEdit

 
We will be using Blender to process the models.

The models asteroid.cms or roughsphere.cms that you used are CMS models. These are good for modeling blobs and other simple shapes, but for detailed models, you need to use 3DS or CMOD models. CMOD models are recommended, as Celestia runs much faster using CMOD files compared to 3DS files.

Models for asteroids can be downloaded from several places, but the 3D Asteroid Catalogue is quite comprehensive and is a good place to find models. Models can be downloaded in PLY or OBJ format, but either way they have to be processed before they can be used in Celestia.

For this tutorial, we will be using Blender. It's a free and open-source program, like Celestia, and is extremely powerful. However, its user interface and controls can be quite intimidating! So, there will be screenshots provided. Before you start, download Blender and install it. You will need 2.79 or below, since 2.8 removed support for the 3DS format. (If you have Blender 2.8, there may be plugins that can support importing/exporting 3DS files.)

Note that this tutorial has an inherent limitation, which is that 3DS files have a limit of 65,536 polygons, so the original shape model cannot have any more polygons than this number.

Orientating the modelEdit

 
How to import a model in Blender.

For 107 Camilla, models can be downloaded here. Camilla has two versions available: one by Torppa et al., which was derived from lightcurve inversion, and one by Hanuš et al., which was derived by directly imaging the asteroid. Lightcurve inversion involves reconstructing the shape from its light curve, a graph showing the brightness of an object over time. This is the easiest way to get a model for an asteroid, but the resulting models are not as good as if they were made from direct imaging. So here, download the Hanuš model, in either PLY or OBJ.

 
Here, the model is too big and should be scaled down for visibility.

Open Blender. Blender always starts with a cube, which should be deleted. Press X and Enter to delete the cube. Then, import the file by going to File near the top left, then Import, then select the model type that you downloaded. You'll see a list of files in your computer, so select your asteroid model.

In some cases, the model is too big to comfortably view, and the you'll be seeing the view inside the model itself. In this case, you might want to scale the model down to a size, but this isn't strictly necessary. To do this, press S, then drag your cursor inwards until the entire model is in view. However, make sure that the model doesn't flip while scaling. Click once to set the size.

If you've downloaded the OBJ model, then you need to rotate it so the next steps (UV mapping and adding surface normals) work correctly. Type R then X then -90, then press Enter, to rotate it −90° about the X-axis. If you've downloaded the PLY model, then do not do this.

Preparing the modelEdit

 
Switch to "Edit Mode" near the bottom left.

Right now, these models only have vertices and faces defined. That means that Celestia, or any software, has no way to map textures or smooth out the lighting. To fix these problems, we need to add UV maps and surface normals to the model.

UV mappingEdit

 
How to add UV maps to a model.

A UV map is simply a set of coordinates that tells the software how to wrap the texture around the model. To add this to your model, go to Object Mode near the bottom left of the screen and change that to Edit Mode. (If you can't do that, try right-clicking on the model and try again.) You should see that all the faces and vertices of the model are now highlighted in orange.

Next, select the third tab down on the left side of the screen (see the screenshot at right), which is Shading/UVs. Under UV Mapping:, click the menu that says Unwrap and select Sphere Projection.

Surface normalsEdit

Surface models are vectors that tell the software how light should reflect off the model. You should already be in the Shading/UVs tab for this. Under Normals:, click Recalculate.

Exporting as 3DSEdit

Before you export your model, type R then X then -90, then press Enter. This is necessary for both PLY and OBJ models.

Then, export your model as a 3DS model by going to File, then Export (right below Import), and by selecting 3DS.

Converting to CMODEdit

Your 3DS model can technically be used as a mesh in Celestia, but it's strongly recommended to use CMOD. To convert it to CMOD, download the 3DS to CMOD converter. There are versions available for Windows and MacOS here. Select the 3DS you've just exported, then output the CMOD (binary is recommended since the resulting file is smaller).

Once you're done, you now have a CMOD file that is ready to use in Celestia! Move your CMOD file to the "models" directory (or create a new "models" directory inside your "extras" directory). Then change the Mesh parameter to the name of your file.

ColorEdit

 
Ceres is gray with a hint of brown.

Many asteroids are gray, but they can also have varying shades of brown and reddish colors. To simulate this, you need to specify the asteroid's Color with three values representing the red, green, and blue components (RGB), like below:

	Color [ 1.000 0.945 0.881 ]

There are two ways to do this: one method uses color indices and the other method uses visual spectra. Using visual spectra is more accurate, but the data only exist for a small sample of asteroids, as well as the process being slightly more difficult.

Using color indicesEdit

Color indices tell you the color of the asteroid. For many astronomical objects, including asteroids, the color is on a spectrum ranging from reddish to bluish. (When an asteroid has a "bluish" color, however, this means that it is gray.) The higher the color index, the redder it is.

Astronomers calculate color indices by measuring the brightness of an object in two different wavelength-specific filters called "passbands", and then subtracting the difference. That means there are several types of color indices, depending on the passbands used. Among the most common are U−B, B−V, and V−R indices from the UBVRI photometric system, commonly known as the Johnson photometric system.

To calculate a Color value, use FarGetaNik's color calculator. First, make a copy of the spreadsheet. Then, go to the "color index" tab, then enter the appropriate values for the "B−V" and "B−R" cells. (Don't worry about "Albedo" and "Texture Brightness" here.) For the three RGB values, use the "relative" values: cells E11, F11, and G11.

Using SMASS spectraEdit

SMASS (Small Main-Belt Asteroid Spectroscopic Survey) is an extensive survey of asteroids that produced a wealth of data in the form of asteroid spectra. They are available at the SMASS website. Using these spectra, it is possible to calculate an RGB color value for an asteroid.

First, go to the current GitHub repository and click on the green button that says "Clone or download". Then, download the ZIP file.

Then, open up your computer's command line. This is called "Terminal" for macOS, and "Command Prompt" (cmd.exe) for Windows. In the window, type cd and change the current directory to the one called "src/tools/spectrum2rgb". You can do this by typing cd and dragging the "spectrum2rgb" folder into the command line window.

If you're on Windows, you need to install GCC. Instructions for installing GCC can be found here: https://gcc.gnu.org/install/

Once you have done that, type gcc spectrum2rgb.c into the command line window. This should create a file called "a.out" in the same folder.

Now, go to the SMASS website catalog. Scroll down to the asteroid that you are adding to Celestia. Select a spectrum file by clicking on the file icon. Note that the spectrum must be in the visible (Vis) part of the electromagnetic spectrum, not near-infrared (NIR). You should see two or three columns of numbers.

Save the numbers as a text file. If there are three columns of numbers, delete the third column. That's the error value, and isn't needed. Move the text file into the "spectrum2rgb" folder.

Time to run the code. In the command line window, type this:

./a.out solar_spectrum.txt filename.txt

where filename.txt is the name of your text file. After running, the command line prompt should output a color definition that can be used for Celestia, such as below:

	Color [ 1.000 0.943 0.905 ]

Rotational axisEdit

For most objects, using RotationPeriod will suffice, because that is the only thing that is known about their rotation. However, for some objects the orientation of the rotational axis is also known. For these asteroids, it's better to use UniformRotation, like so:

	UniformRotation
	{
		Period <number>
		Inclination <number>
		AscendingNode <number>
	}

The Period is the same as the RotationPeriod parameter from before. However, the axial orientations are usually given in one of two options: λ and β (ecliptic values) or α and δ (equatorial values). These can usually be found in the same paper that presents the models. For example, according to Pajuelo et al. (2018), the pole solution is λ = 68.0°, β = 58.3°. The Inclination is simply 90 − β and the AscendingNode is 90 + λ. So, for 107 Camilla the rotational model should look like this:

	UniformRotation
	{
		Period 4.844
		Inclination 31.7
		AscendingNode 158.0
	}

Pajuelo et al. (2018) also lists the pole solution in α and δ, as α = 35.8° and δ = 76.1°. If you were to use these values, simply replace β with δ, and λ with α, respectively. You must also specify that the body frame is in the EquatorJ2000 frame, since the default for Celestia is the EclipticJ2000 frame. For 107 Camilla it would look like this:

	BodyFrame { EquatorJ2000 { Center "Sol" } }
	UniformRotation
	{
		Period 4.844
		Inclination 13.9
		AscendingNode 125.8
	}

For more information, see Celestia/Rotation Models and Celestia/Reference Frames.

SatellitesEdit

Like stars and planets, asteroids can have satellites orbiting them. To see how to add them, see the page for Moons.