Few times ago someone asked how to place a tile on a planetary surface.
There are several good tutorials on how to do it from a complete planet texture but I did not find any on how to proceed from only a little piece of terrain.
This is a very simplified way to place a single tile on the surface of a planet. The placement of the texture is not absolutely accurate, but dimensions of the terrain are precise. This is well suited for fiction scenarios where the right place for a texture is where we place it.
Of course it is possible to place the terrain with very high precision. But here, we aim to build only one tile. So we’ll try to place our texture in the middle of a tile to have more room for it.
I have this image:
This field is 830 meters by 727 m. I want to put it on Tethys at approximately latitude 30° south and 170° east.
We need to know that the radius of Tethys is 529.9 km. This is indicated in the text information in the upper left of the Celestia windows when Tethys is selected.
We need to do some calculations. To do this, load the calc sheet attached at this post. The green cells are the cells to enter the data. The others are protected. Do type only the numbers without units. You can remove the protection to adapt the table to your needs.
1) Enter the longitude and latitude. The cells in blue indicate the limits of the coordinates of the tile. The coordinates of the middle of the tile are important. These will be the exact coordinates of the center of our image.
2) Complete with the radius of the planet and the ground dimensions.
3) Determine the highest level possible so that the size of our ground is still less than the size of the tile (in pink). Bear in mind that the maximum possible level is 12. The calc sheet doesn’t control that.
4) Set the size of the tile so that the image size matches well with the one you have. You can see the resolution displayed in meters per pixel. In this example with a tile of 2048, I have a resolution of about 80 cm per pixel. It was roughly my original picture resolution.
The size of the tile must always be a power of 2.
We get the following table:
-If you already have an image, adjust it to the size indicated (here 1045 pixels wide by 915 pixels high). Otherwise create directly your image with the size specified for the canvas below and skip the next step.
- Enlarge the frame as indicated (1774 x 2048), leaving the original image centered. You will need to complete the border added. For example, I added some grass around. Indeed it is not possible that part of the tile is transparent.
- Finally resize your image to the size of the tile (2048x2048) and save it with the name given by the calc sheet. You may choose png, jpg or dds for the format. I choose the jpg format for this example and I save my file as tx_1991_682.jpg
That's it. It remains only to define a virtual texture of Tethys for our tile.
I explain briefly.
Here is the directory structure:
Save the file ‘tx_1991_682.jpg’ in the level10 folder. Intermediate levels are unnecessary but it is mandatory to complete the level0 directory.
To do this, take the whole texture of the planet and cut it into two halves. Save the western hemisphere as ‘tx_0_0.jpg’ and the eastern hemisphere as ‘tx_1_0.jpg’. Place these two files in the level0 folder.
The directory “TethysCapitol” is the folder of our add-on. It should be placed in the "extras" Celestia directory. It contains the file tethysCap.ssc with the following content
Code: Select all
Modify "Tethys" "Sol/Saturn"
{
Texture "tethysCap.ctx"
}
Location "Capitol" "Sol/Saturn/Tethys"
{
LongLat [170.07 -29.97 0] # tile's center coordinates
Importance 300
Type "City"
}
The file “tethysCap.ctx” is in hires folder and contains the following
Code: Select all
VirtualTexture
{
ImageDirectory "tethys_VT"
BaseSplit 0
TileSize 64
TileType "jpg"
}
Note the unusually small value of TileSize.
To easily find this small area of less than 1 km? on Tethys, just type “tethys/capitol” in the input window of Celestia to select it and then go to it with G. And here's the result to check that all is well at the expected location.
It is even possible to zoom a bit more.
This high level of detail is possible at only level 10 with a not so big texture because I chose a small body to host it. Don’t expect this for super giant planets.
If something seems strange, don’t hesitate to bring corrections. I apologize for the bad English. I translate my original text with Google’s help. So some inexactitudes or worse are possible and even probable.
Regards