Page 1 of 1

best way to store sky background

Posted: 24.02.2008, 22:20
by florin
I'm building an open source specialized 3D ray tracer to explore relativistic phenomena (general relativity, not special). The end result may look superficially similar to Celestia, but may be quite different "under the hood". The program will be a simulator - the images will be physically realistic and accurate. I'm in the initial phase - planning.

The ray tracer needs to be able to render images up to HD (1080p) resolution. Maybe beyond that too. It needs to be as fast as possible, ideally real time NTSC/PAL frame rates for most resolutions on good hardware (PS3, high performance PC).

Because of that, I need to pre-render as a bitmap the whole sky background, which looks quite similar to Celestia - mostly black, with some stars. The resolution of the pre-rendered sky needs to be higher than the resolution of the screen, of course.

So that's my dilemma - due to the extremely high resolution, I cannot simply store the whole sky in a regular matrix, or I'll need many GB of RAM. (or I may use 8bit graphics for the sky and still end up with 100MB of live data in RAM - which is suboptimal in more than one way)

One way around that would be something like a sparse matrix. But that too has its issues (the suitesparse library, for example, is not good for random access, according to its author).

How does Celestia store / represent the sky background? Is it rendered dynamically, or pre-rendered and stored as bitmap? Or something else?

Is Celestia essentially a ray tracer, or not? What's the Celestia 3D engine like?

(I guess I could spend some time reading the source myself, but time is the least abundant resource that I have, so I would very much appreciate just a few words of clarification.)

Any comments are welcome.

Thank you!

Posted: 26.02.2008, 20:45
by Brendan
The stars are individual objects you can go to. They are rendered with some kind of culling mechanism, either a BSP or octree. Some others here would know.

Posted: 26.02.2008, 21:12
by chris
Brendan wrote:The stars are individual objects you can go to. They are rendered with some kind of culling mechanism, either a BSP or octree. Some others here would know.


Correct: Celestia uses an octree for storing stars. Deep sky objects are stored in their own octree. For fast visibility testing of solar system objects, Celestia uses a tree of bounding spheres.

The rendering isn't done with raytracing. Celestia uses OpenGL, which generally means that final rendering is done with triangle rasterizing / z-buffering hardware.

--Chris