Horizons?

Oldtimer
Posts: 834
Joined: 2002.09
Post: #1
As I'm starting to churn out the details of my upcoming uDG flight sim, I realized something - how the heck does one model landscapes that stretch ridiculously (sp?) far into the void that a horizon appears? Do I need to throw triangles all the way back there and into the fog, or is there an intelligent way to model an infinite plane? The W coordinate?
Quote this message in a reply
Member
Posts: 177
Joined: 2002.08
Post: #2
The "easy" way to draw a horizon is just to pick an arbitrary line across the window and color above the line sky, below ground or water. You get flat shading, but it's fast Rasp

Don't worry about running into any OpenGL limit on the size of your scene geometry; vertex positions and depth buffer values can get VERY large, and the cost of rendering in general does not depend on the coordinate size of the geometry (just the amount of it, which is why most flight sims use LOD).

As far as I can tell, most flight sims really do draw triangles all the way into the background, and use LOD systems to keep the triangle count manageable. Objects that are far enough away that they'd be only a few pixels are just skipped, the popup isn't noticable.
Quote this message in a reply
Moderator
Posts: 365
Joined: 2002.04
Post: #3
If you try to draw a gargantuan plane, the far clipping plane will truncate it and give you a lower horizon than you intend. It's probably better to fake a horizon by rendering an inside-out sphere or cylinder with appropriate coloration or texture. You might need to draw it first without writing to the depth buffer, and then draw everything else over the top of it in order to avoid difficulties with your depth clipping ratio.

With regards to representing the ground, I reckon that heightmapped grid is one of the most boring ways of doing it. F/A-18 Korea does this, and while it's quite atmospheric, it's noticeably artificial.

I think A-10 Cuba has the nicest landscape of any flight sim I've ever played. The map is divided into large cells to allow distant parts to be culled, and each cell of landscape has been lovingly hand modelled! This allows it to be incredibly organic and unexpected, and you almost never see a visible grid on the ground. A-10 also does a simple form of level-of-detail by swapping out complex cells for simpler renditions as they get further away.

If you want to do collision detection against the ground (I presume you do!) with this technique, you need to be prepared to do a lot of tricky intersection calculations. That could take quite a lot of processing power, but since A-10 ran very nicely on my old 7300 I don't see why it shouldn't work on modern machines!

Neil Carter
Nether - Mac games and comic art
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #4
Quote: Don't worry about running into any OpenGL limit on the size of your scene geometry;

Yeah, this I knew, I was just worried about triangle count.

Quote:As far as I can tell, most flight sims really do draw triangles all the way into the background, and use LOD systems to keep the triangle count manageable.

I guessed that - damn, I don't like the sound of that. Smile

Quote:If you try to draw a gargantuan plane, the far clipping plane will truncate it and give you a lower horizon than you intend. It's probably better to fake a horizon by rendering an inside-out sphere or cylinder with appropriate coloration or texture.

Wouldn't this be noticable as a color difference between lighted/rasterized triangles and the painted background?

I'd like to step away from heightfields, too - but I'm worried about uDG time - I don't have a lot of time to put into this. I'm almost into the Lylat Wars solution - just wrapping around when the player exits the map. But I don't like that either.

Quote: I think A-10 Cuba has the nicest landscape of any flight sim I've ever played. The map is divided into large cells to allow distant parts to be culled, and each cell of landscape has been lovingly hand modelled!

Now, _this_ I like. I'll probably go for something Hellcats-like, with just a low tricount on the terrain, and then throw an octree on it, however. Big thanks, though! I'll keep you posted!

/Ivan
Quote this message in a reply
Moderator
Posts: 365
Joined: 2002.04
Post: #5
Quote:Originally posted by Fenris
Wouldn't this be noticable as a color difference between lighted/rasterized triangles and the painted background?

Not necessarily. You could do something like David's doing with Lugaru, alpha fading the landscape into a static background, or you could make sure your fog colour suits the predominant sky colour (but don't fog the sky object).

I suppose that would be one of the benefits of flat-shading your landscape - you can just draw blue above the horizon and green below and make sure the average green colour of your landscape matches the background. All sorts of cheats become possible if you're dealing with flat colour!

Neil Carter
Nether - Mac games and comic art
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #6
Quote:alpha fading the landscape into a static background


That's clever! Grin I'll definitely try that out. Thanks!
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #7
I found a nice way to draw an infinite plane, so I'll just throw it in below my terrain models later. I just draw a plane with glVertex4f, passing something close to zero as the fourth parameter. (Might be interesting for some people, I don't know. Grin )
Quote this message in a reply
Post Reply