Jump to content

Large Terrains and Z-Buffer Precision


Flexman
 Share

Recommended Posts

The larger scale maps you're able to create with Leadwerks engine are a little over 40km x 40km assuming 1m per unit and a terrain of 4096x4092 with 10m per tile.

 

If you've ever tried positioning object with small details at positions more that 10,000 delta from the origin you begin to run into z-buffer artifacts. It's a problem common to most engines.

 

A good explanation of this can be found in Steve Baker's document on Loving your Z-buffer.

 

This is something we have problems with. Even roads, large as they are flicker towards the outer areas of the map.

 

Then someone pointed me towards a blog post about using a Logarithmic Depth Buffer. In which he references Steve Baker's doc and an interesting solution which allows his 3D engine to render near and far objects with impressive resolution.

 

A similar kind of z-buffer in LE would fix some of the ugly z-fighting you get further out.

 

This YouTube video of

is just nuts. Looks highly specialised, but cool.

6600 2.4G / GTX 460 280.26 / 4GB Windows 7

Author: GROME Terrain Modeling for Unity, UDK, Ogre3D from PackT

Tricubic Studios Ltd. ~ Combat Helo

Link to comment
Share on other sites

I've been thinking about ways to overcome this as I face the same problem myself.. it seems you can implement this entirely in the vertex or pixel shader by calculating the new z value, no special buffers or setups, this would be ideal and easy to implement in LE (at first glance)

 

Thanks for the share

Link to comment
Share on other sites

Couldnt you just blend the models "off" at a certain distance?

And for roads you could use a complete black alpha in the last mipmap sp it would be invisible too.

Or work with fog and some distance before you get zfighting.

 

Alas were it so simple.

 

Roads are a bit odd actually. Out at the near 20k unit region, they do wibble a lot (I like that word), in the middle distance they appear steady. I'm quite intrigued by that.

 

We're able to mitigate some effects using LODs and object visibility range settings, 2.32 has more options we'll be using. But still have depth issues as we have up close objects everything in between for 6,000 or so units.

 

It all goes to hell when you have something like a sniper-scope though. You're rendering a narrow frustum with objects up close and everything out to several km.

 

There's also the issue of floating point accuracy which an accurate zbuffer can't fix and needs Ogre3D style camera relative rendering. My workaround for that is to simply not have the cockpit occupy the same world and fake lighting to match; after the main world render, clear the z-buffer then render the cockpit with ambient/sun light. Live with the other visual artefacts, which it has to be said can be seen in other games to a lesser extent.

 

I've been chatting with the Outerra engine designer about his technology, very nice chap, it's currently OpenGL, surface to whole planet rendering. Way way beyond the scope of what we need for our current game. 40x40km is the biggest LE lets you make which is spot-on perfect for our game. I just want it to look steady, as best as we can.

 

If it's reasonably straight forward to add your own z-buffer shader function to improve shadow rendering and depth resolution then great. But there has to be a catch?

6600 2.4G / GTX 460 280.26 / 4GB Windows 7

Author: GROME Terrain Modeling for Unity, UDK, Ogre3D from PackT

Tricubic Studios Ltd. ~ Combat Helo

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...