Z-Buffer How do real games do it?

Started by
12 comments, last by ShmeeBegek 19 years, 4 months ago
After playing round with opengl for a little while I have come upon a few things which puzzle me, I was hoping someone who knows better or someone from the games industry could answer my question (probably very simple). I have created a 3D Globe with accurate land mass models (countrys etc). Now the problem here is I have a sphere (acting as the globe, ok i modelled it as an oblate spheroid, but we will say sphere) and land masses which have to lie exactly on top of the surface of the sphere. Now is it possible to get the land masses to lie on top of the earth without causing graphic glitches (flickering and Z fighting for example). Questions: 1: Is is possible to do this without using glPolyGonOffset? 2: How would the games industry/someone who knows what they are doing do this? 3: What should the Zbuffer limits be set to considering the radius of the earth is about 6000km, should i work in meters? I.E 6,000,000 or km 6000 or even 10's Km 600? What would be most optimal for the Z-buffer and for the solution i require. How would you do it? Any help greatly appreciated. Thanx Tom
Advertisement
Cheat.. cheat... and more cheating. :)

This is one of the reasons why LOD is used.. :D

Otherwise you could do this...

zbuffer:
Faraway -> Even further away
draw:
Nebulousas and so on...

zbuffer:
Near -> Faraway
draw:
Planets that are close...


I dont know if you understand what I mean, but simply change the zbuffer range depending on what you´re drawing! :)

peace!
"Game Maker For Life, probably never professional thou." =)
Render the sphere with no z-writes?

Assuming that your land masses aren't modelling below the 'surface' of the sphere...

Land masses on the far side of the sphere ought to be taken out by backface culling, and you turn z-writes on for the land masses so that they can occlude each other or themselves (overhangs, or land masses near the side of the sphere).

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

Why not just texture the sphere?
You do want to zoom way in and walk/fly around the global, or see the entire thing at the same time?
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
I have to agree; just texture it.
use one unit as 1km, near bufer = 10, far buffer = 10000. should give reasonable results
move your near plane farther away.
Thank you all for your replies.

Texturing is not an option, I have very detailed coastline data, Texture maps could never convey this kind of accuracy especially not when zoomed in(even with swapping in and out of more detailed textures, the resolution just is not there).

As for zooming in and out, the initial view is zoomed out and i can see the whole globe, but i can zoom right down into say a certain part of the uk, this is why i am keeping with vectored coastline data.

Would 10-10000 be a reasonable z-buffer? I am looking into Z-writes as i type this:D

tom
log2(10000/10) ~= 10 bits
That should work fine with the typical 24bit hardware z-buffer

At that far-out zoom level, textures would be fine, you won't be able to see any detail nor height variation.
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara

This topic is closed to new replies.

Advertisement