geomorphing on gpu

Started by
1 comment, last by dave j 18 years ago
I'm trying to implement geomorphing on the gpu. My heightmap is stores in a texture and I sample it in the vertex shader. To get the refined height of a vertex, I just sample the heightmap directly. However, I am trying to figure out how to get the height at the next coarser level. Obviously, for a given vertex, it lies on the edge of the coarser grid. So I could find the two edge points and compute the midpoint. In a CPU implementation this seems straightforward to me. But in a vertex shader, this is giving me problems because I do not know which edge of the coarser grid the vertex lies on. When a quad is subdivided, 5 new points are introduced which can lie on a number of edges of the original quad. GPU Gems 2, the article on clip maps, seems to suggest it can be done, but doesn't give details. It just says: "the sample location lies on an edge of the coarser grid, and z_c is obtained by averaging the two course samples on the edge endpoints."
-----Quat
Advertisement
Given the lack of replies here in DX I'll move it over to GP&T - this sounds like something those guys might be able to help you out with [smile]

Cheers,
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

You have to calculate the height in the next level on the CPU and put it into the vertex buffer with the height in the current level.

Texture lookups in vertex shaders are relatively slow in current hardware so this approach is quicker even if you could work out how to access the neighbouring verticies to calculate the value in your shader.

Hugues Hoppe's papers on geometry clipmapping explain it in detail. See his home page for the papers.


dave j

This topic is closed to new replies.

Advertisement