Jump to content
  • Advertisement
Sign in to follow this  
skyemaidstone

Avoiding huge far clip

This topic is 805 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi Guys,

 

Apologises if this has been answered somewhere, I've had a look and can't find an answer.

 

My question is about rendering large terriain. Currently I'm using a 2048x2048 16bit heightmap in a quadtree as my game area. This gives me a nice large terrain if I treat 1 pixel in the heightmap as 5 meters with nice smooth rolling hills/mountains etc.

 

Now the problem is unless I increase the farclip to something huge then my hills and mountains in the distance slowly come into view. I've read that I shouldn't really have my farclip much above 1000 or i'll lose too much presicion in the depth buffer and start having z fighting issues.

 

I can use distance fog or even volumetric fog to hide the horizon a bit but mountains will still come into view rather weirdly. I could put them on the skydome/box too I guess but that's a bit bleh.

 

 

 

Thanks

Share this post


Link to post
Share on other sites
Advertisement

Have you tried increasing the farclip to see how it works? Z fighting is not always a big issue, especially with modern video cards. In my own app I use a far clip of about 8000+ with no real problems ( also, try increasing nearclip a bit, that can make a big difference)

 

For farther view than that, you can use "linear depth"... this means you calculate the depth in the shader in a different way than is standard.

 

Also, you can use two z-buffers, render the far distant stuff using one projection matrix, and the near distance stuff using another one.

Share this post


Link to post
Share on other sites

Can someone explain to me why in the year 2016 ( high dynamic range, FSAA, 100 instructions per shader, 4k ... )  graphic cards do not just store the floats coming from the GPU with maybe just 2 bits rounded off? If you do not overflow your GPU you should not overflow the rasterizer. Still GPU only uses floats, not doubles like CPU. I do not get why the CPU has so many SIMD for low precision floats. I want MAC for 64bit floats! I just read the numbers. Okay even float is sufficient for this application. Stupid Cray also only had floats.

Share this post


Link to post
Share on other sites

One very good method off of the top of my head...

Shadows of the Colossus used a technique that rendered very distant geometry very well. I'm not sure if they were using displacement maps, or actual meshes but the concept remains the same reguardless. You simply render cube maps for your distant terrain, while having them set to lower LODs.

 

You don't need to use a very high res cube map to do this either. But it needs to be high enough that it looks good (No large square pixels) and small enough that the GPU can render it on the fly.

 

You can scale in the world a bit around the camera and render it this way. The user might not notice the difference.

Edited by Tangletail

Share this post


Link to post
Share on other sites

You mentioned fog, which was a favorite early on in gaming history, but there are other tricks you can use in addition to fog to give a nice feel to your game.

 

At some point, you can't have the player seeing infinitely in any direction, or you'll have to load all your entities (or at least LOD versions like billboards) located in that direction for miles and miles.

 

I can use distance fog or even volumetric fog to hide the horizon a bit but mountains will still come into view rather weirdly. I could put them on the skydome/box too I guess but that's a bit bleh.


On the fifth day of creation, to hide the z-fighting and to prevent distance objects from suddenly popping into view, God added curvature to the earth.

 

Atmospheric fog and curvature together would probably help set an absolute limit to your terrain. Any ridiculously high objects - like mega towers or mega mountains, you could add just those (hopefully few) extreme situations to your skybox.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!