clipmapping for terrains

Started by
1 comment, last by filousnt 16 years ago
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?
Advertisement
I think this will answer all your questions: http://research.microsoft.com/~hoppe/gpugcm.pdf
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]

This topic is closed to new replies.

Advertisement