Jump to content
  • Advertisement

Geometry clipmaps and array of texure

Recommended Posts

Hi all

this is my first post on this forum.

First of all i want to say you that i've searched many posts on this forum about this specific argument, without success, so i write another one....

Im a beginner.

I want use GPU geometry clipmaps algorithm to visualize virtual inifinte terrains. 

I already tried to use vertex texture fetch with a single sampler2D with success.


Readed many papers about the argument and all speak about the fact that EVERY level of a geometry clipmap, has its own texture. What means this exactly? i have to 

upload on graphic card a sampler2DArray?

With a single sampler2D is conceptually simple. Creating a vbo and ibo on cpu (the vbo contains only the positions on X-Z plane, not the heights)

and upload on GPU the texture containing the elevations. In vertex shader i sample, for every vertex, the relative height to te uv coordinate.

But i can't imagine how can i reproduce various 2d footprint for every level of the clipmap. The only way i can imagine is follow:

Upload the finer texture on GPU (entire heightmap). Create on CPU, and for each level of clipmap, the 2D footprints of entire clipmap.

So in CPU i create all clipmap levels in terms of X-Z plane. In vertex shader sampling these values is simple using vertex texture fetch.

So, how can i to sample a sampler2DArray in vertex shader, instead of upload a sampler2D of entire clipmap?



Sorry for my VERY bad english, i hope i have been clear.


Share this post

Link to post
Share on other sites

Typically you store the clipmap levels as mipmaps in a single texture. Then you select the correct mipmap during rendering via an LoD parameter to the texture sampling function.

Share this post

Link to post
Share on other sites

Ok. But say i have a complete  2d footprints of a clipmap (12 blocks mesh, two L-shaped meshes and the cross mesh), how can i, in vertex shader, reproduce the various scaled versions (1 for each level)? The only solution i can think is produce on CPU all scaled version of 2D vertex positions, and it means that i produce (if say L the number of clipmap levels) L versions of the 2D footprints and send them on GPU. 



Share this post

Link to post
Share on other sites
Posted (edited)

So there is a difference between "Geometry Clipmaps" and "Texture Clipmaps".


Geometry Clipmaps are described here: http://hhoppe.com/geomclipmap.pdf

The algorithm is a continous LOD for the mesh


Texture Clipmaps are described here: http://developer.download.nvidia.com/SDK/10/direct3d/Source/Clipmaps/doc/Clipmaps.pdf

The algorithm handles the visualization of very large textures by using a stack of LOD textures as opposed to the usual pyramid.


I used Geometry Clipmaps in the early days (before switching over to a quad tree based algorithm), and I used a toroidal addressing method for the texture (See the Texture Clipmaps paper for an explanation)


To answer your question: You can scale and offset your parts in the vertex shader using data from a constant buffer eg.

pos_base = pos_input_vs + meshOffset;
tex_coord = pos_base.xy
pos_world = pos_base * LODscale + LODoffset

Where meshOffset is to place the L-shaped part at the right location and LODscale and LODoffset is to get it into the right size and position in the world.



Edited by semler

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!