Advertisement

Geometry clipmaps and array of texure

Started by February 24, 2018 10:55 AM
3 comments, last by semler 6 years, 11 months ago

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.

 

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.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Advertisement

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. 


 

 

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.

Henning

 

This topic is closed to new replies.

Advertisement