It is currently Thu, 30-03-17, 20:26 GMT

All times are UTC

Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Mon, 03-09-07, 22:09 GMT 
Site Admin
User avatar

Joined: Fri, 31-08-07, 20:59 GMT
Posts: 1605
Location: Norway
The Placeholder trick
Sometimes it is desirable to cut a model into several separate parts and reassemble them in Celestia. For example if you want to animate a part of it., or perhaps to make a part emissive.

To make this work, we use a placeholder model that will be the models focus in Celestia.

A common side-effect of doing this is that your model becomes unselectable in Celestia.
You may also experience ugly depht-sorting issues. Due to Celestia´s limitations there are no
absolute respite from this, but there are ways to minimize these problems. So, here is my
optimal recipe for getting the placeholder trick to work in an elegant way.

For the purpose of this minitutorial, we will create a rocket with a glowing tail... So,
in your 3D editor, you create a simple model consisting of three distinct meshes:

A. The rocket mesh
B. The exhaust mesh
C. The Placeholder mesh

First, we construct A. A simple cylinder with a cone on top will suffice.

For B, you just invert the cone, assign a semi-transparent material to it and map your
favourite PNG file of a fire onto that material.

C will be a cube that encloses A and B completely. You make a 100% transparent material
for C, so that it will be completely invisible.

Now you have a model that looks something like this:

Next, you save this model as three separate 3DS files:

File A:
Delete the exhaust mesh (B) and export to "rocket.3ds"

File B:
Retrieve the exhaust mesh (B) from memory and delete the rocket mesh [A] instead, then
export to "exhaust.3ds"

File C:
Now comes the trick: you do NOT delete A and B to export the placeholder cube. Rather,
you copy C into a new model file and save it. Some more work must be done with it without
disturbing the A-B-C setup.

Here´s what you do with the new copy of C:
1. Create a 100% transparent PNG file that is 32x32 pixels at 72 dpi (or any power of two,
but the smaller the better). Save it as "placeholder.png"

2. In your 3D modeller (in your new C file), assign the PNG file to the transparent material
of the cube, and edit the material so that it is no longer 100% transparent. Set it to 50%
opaque! Now it is not only transparent, but the PNG file is ALSO transparent as a material,
not just as an image.

4. Export the C model to "placeholder.3ds"

Here´s why you make the transparent material in such an elaborate way:
Celestia will simply disregard 100% transparent meshes. It will know it is there so that the
models align properly, but it will NOT let you select invisible geometry. Which means the
transparent parts of model A and B becomes impossible to grab with your cursor in Celestia.
By introducing the transparent PNG file, Celestia does not KNOW the third model is transparent,
and so the placeholder mesh becomes selectable. Which is essential for assembling the model
in the SSC file:

The SSC file

1. Create an empty text file and save it as "rocket.ssc"

Now, the placeholder goes FIRST, at the very top of the document. This is because Celestia
draws objects in the order it reads them, and we want the placeholder mesh to be read first.
That way, your cursor will always grab the invisible cube rather than one of the visible parts
inside it. It makes your model selectable.

# -- START ROCKET ------------------------------------------

# The placeholder comes first, and gets the name of the rocket

"MyRocket" "Sol/Earth"
   Class "spacecraft"
   Mesh      "th_placeholder.3ds"
   Radius 0.11
   SampledOrbit    ""
   Albedo 0.001

# The semi-transparent exhaust comes BEFORE the opaque mesh,
# to minimize the appearance of Celestia´s depht-sorting bug

"" "Sol/Earth"
   Emissive   true
   Class "spacecraft"
   Mesh      "exhaust.3ds"
   Radius 0.1
   SampledOrbit    ""
   Albedo 1e-32

# The opaque part(s) comes after any transparent parts

"" "Sol/Earth"
   Class "spacecraft"
   Mesh      "rocket.3ds"
   Radius 0.1
   SampledOrbit    ""
   Albedo 1e-32

# -- END ROCKET ------------------------------------------

NOTE: if you have many transparent meshes, you should esperiment with their order in the SSC
file until you find the optimal setup. Celestia will treat them all differently, so it can only be resolved by eye.

NOTE 2: Why you should not make the C cube in your A+B+C file the placeholder:

You can if you want to. But there is a couple of reasons why not:
A) If you make the placeholder once, you can use it with all your models
B) If you do this inside your mesh files, they will interfere the day you want to use a given mesh
for something else, since the PNG version of C will make it impossible to select the actual mesh
inside when in Celestia
. Usually this is the desired behaviour... But not neccecarily in all future
possible ways you want to use your model.



Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group