How to graft a CMOD landscape model onto a Virtual Texture seamlessly
Due to Celestia´s infamous depht-sorting bug, entirely seamless is not quite possible
but you can do a very good approximation. Here´s how:
Let´s say we have a 64k PNG virtual texture of the Kalahari desert, and you want to place a
mountain on it.
Here is your mountain:
You want to place this mountain here in Celestia:
First, you locate the exact VT tile the mountain will rest on, and open it in your favourite
image editor. In our case, it looks like this:
Now, in your 3D editor, you make a material for your mountain and assign the tile above
to it, then apply the material to your mountain:
... If you were to save your model like this, the landscape would get an ugly quadratic
seam, and we don´t want that. So, here´s what to do:
1. Split your model into two meshes
(don´t move the top mesh at all; in the picture this is just to illustrate my point...
2. Fill the hole under your top mesh!
Make sure the normals of the bottom point outwards. This we do
to minimize depht-sorting issues in Celestia.
3. Make a copy of our tile in your image editor
Use a circular lasso with some high feather value (how high depends on the size of your
texture: in this case, with a 1024x1024 pixel tile, i use perhaps 200 pixels. Use the tool to
delete the borders of your tile, making an increasingly transparent image from the center
and out. Save your tile as a transparent PNG file.
It now looks like this:
4. In your 3D program, DUPLICATE the mountain material
Assign the duplicate your NEW tile. To force Celestia to understand that it is transparent,
it is neccecary to make this new material 98% opaque.
Now apply your NEW material to the bottom half of your model:
... Now you have a mountain whose base becomes gradially more transparent the
closer it gets to the Virtual Texture it rests upon. In our case, it looks like this:
Some notes:
1. You WILL experience depht-sorting issues. See the Placeholder Trick tutorial for
notes on how to minimize them.
2. You will almost always have to experiment with the
material properties in your
3D editor to get the coloring and reflections just right; Celestia treats a CMOD mapped
image differently than it treats a Virtual Texture, so colors will be off. You just need to
fine-tune it to your liking.
... Finally, here´s an overview of the scene in Celestia:
rthorvald