## really big difference in object sizes

elerion
Unregistered

Post: #1
hello anybody,

i'm a hobby programmer and currently working on a more or less realistic space game. My problem is that some spacecrafts are of the size of below 100m and some should be really big ( > 1km ) and i'm not sure how i should draw them, because the really big objects ( also planets ) should be visible even if they're outside of the frustum. I've made up two possibilities so far:

1. draw big objects on a different, bigger scale first and use accumulation buffer to add the small objects.

2. render the big objects to a texture and map it on a quad in the back.

could the first method even work out ( depth buffer )? which method is better for performance and is there a possibility i missed?

Thanks for any advice...
Stefan
Oldtimer
Posts: 834
Joined: 2002.09
Post: #2
Just a question - why do you need the objects to be visible outside the frustum?
Also, I believe that you mean the depth buffer, not the accum buffer. The way I'd go about it is to cull out any objects outside the frustum, and then draw the ships front-to-back. Large ships shouldn't be a problem fill-rate-wise, but I suppose that they have more polygons, so you might perhaps investigate the possibility of a level-of-detail reduction scheme.
elerion
Unregistered

Post: #3
i'd like to have a good resolution even for the small vessels, so if a big object is already too far away to be in the frustum it should still be drawn if it would be visible in "reality" ( for example a planet some 10'000s of km's away ). And i wrote depth buffer because i don't know much about accumulation buffers. I thought that perhaps if you use an accumulation buffer the depth test would still be done between objects of the different drawings.

The level-of-detail scheme sounds good. I don't know why it didn't occur to me... but this doesn't solve the problem.
Luminary
Posts: 5,143
Joined: 2002.04
Post: #4
You might like to do the projection math in software with double precision, then send screen-space coordinates to OpenGL. You'd still need to do multiple passes over the depth buffer I think. Certainly, it's not a straightforward problem.
Moderator
Posts: 365
Joined: 2002.04
Post: #5
I handle this kind of thing by doing multiple rendering passes for each scale of object. For example, in my game Rescue I draw the starfield background and nearby planets at a small scale, clear the depth buffer, draw spaceships and asteroids, clear the depth buffer, and finally draw the cockpit interior. I use different camera yon and hither plane settings for each pass to avoid Z-buffer fighting.

Another thing to consider is that objects look the same in perspective irrespective of their drawn scale, so your giant ships could be represented in one coordinate system while the smaller ships use another.

Neil Carter
Nether - Mac games and comic art
elerion
Unregistered

Post: #6
thank you all for the fast responses.
NCarter your idea seems really to be what i was looking for. I'll apply it as soon as i got some time to code, thanks alot.

Stefan

- i forgot to mention that coordinates are no problem: i got a grid of some lightyears in diameter per solar system with a resolution of 1 cm ( okay, maybe a bit much, but changing to lesser is simpler than changing to more ); objects are only sorted by solar system and are added to a to-draw-array while updating their positions ( stored as 6 int and 3 float ).
Member
Posts: 156
Joined: 2002.11
Post: #7
There's a series of articles on Gamasutra.com that deal with scale problems in space sims. Those articles are really worth a check.