add buildings and trees to planet surfaces HELP!!!

The place to discuss creating, porting and modifying Celestia's source code.
Topic author
carolinaguyyyy

add buildings and trees to planet surfaces HELP!!!

Post #1by carolinaguyyyy » 11.06.2002, 15:14

I created a building in .3DS format and tried to orbit it in a circular orbit at the planets surface. The goal was to look out the buildings windows and watch the planets rise and set. But do to my lack of understanding of your orbit parametors the best i got was able to do was a low flying house that dipped under the surfuse now and then. :(

How do you set the orbit settings to hold an object at a given lat. and long. on a planet surface. Or better yet some code to do that for us dummies would sure be fun :)

Marc Griffith
Posts: 5
Joined: 11.06.2002
With us: 22 years 4 months
Location: Melbourne, Australia

Post #2by Marc Griffith » 11.06.2002, 17:24

I've tried something similar before. I managed to get it working for an object at the equator. I have no idea for other longitudes and latitudes, and i doubt its possible.
I had a 3DS model of some buildings orbiting the earth with its SemiMajorAxis equal to the radius of the earth.


Code: Select all

"Building" "Sol/Earth"
{
   Mesh "building.3ds"
   Radius   2 #kilometers
   CustomOrbit "building"
   EllipticalOrbit {
      Period          1
      SemiMajorAxis    6378 #radius of the earth
       }
}



There are two things that will cause trouble.

1. Celestia re-calculates the center of each mesh when it is loaded. This will cause your building to be rendered with half of it underground. I modified the celestia code to disable this. You can get around this by mirroring your entire 3ds model, (the mirror will be underground).

2. Celestia is not designed to handle drawing any objects that are close to each other or are overlapping, it doesnt need too. The soloution has something to do with sharing depthbuckets (openGl stuff). Because of this your models will dissapear when too close to the earth at all but a few viewing angles.

The second point is the one that kills your idea. The code responsible has been commented by Chris (render.cpp I think) you'll have to ask someone with some OpenGL nouse to modify it.


Return to “Development”