Jump to content
  • Advertisement
Sign in to follow this  
Funkymunky

clipmapping for terrains

This topic is 3773 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

I would love to have a clipmapped terrain, like the sample in GPU Gems 2. I've read that chapter numerous times, but I'm still a little uncertain as to its implementation. First of all I understand the idea of having a mip-map chain of the terrain heightmap texture. I don't understand how you generate the vertex data. I think I get that you use the vertex-texture-fetch vs 3.0 operation to offset the terrain by the heightmap mip-map based on the distance from the camera. But how do you wind up with the actual vertices that get offset by the vertex shader in an LOD-based grid...? I think what's confusing me is what part of this operation do I do on the CPU as prep work for the shaders?

Share this post


Link to post
Share on other sites
Advertisement
Each level of your pyramid has a float4 that contains in xy the space between two vertex of same level and in zw the translation from int(viewer.xz). In the vertex shader,

float2 VertexPos = VertexBufferPos.xy * LevelScaleTrans.xy + LevelScaleTrans.zw;

gives you the xz position in world space. There is only one vertexbuffer, VertexBufferPos.xy € [0,0] [N,N].

[Edited by - filousnt on March 24, 2008 12:55:32 PM]

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!