Geometry Clipmaps


I'm trying to implement the GPU Gems version of Geometry Clipmaps in Unity : article.

The article creates a number of `2D footprints' composed of constant vertex and index buffers, as shown in the image below. 1 vertex and index buffer for the block, 1 vertex/1 index for the Fix-up, 4 vertex/1 index for the complete 'L' shaped trim (blue). These are then translated and scaled in a vertex shader to produce variations on the pattern in the image.

At the moment I have one GameObject and Mesh for each grey Block, one for every four green pieces and for every 'L' shaped blue piece. The grey pieces are kept separate for frustum Culling, the green and blue are actually combined meshes. All this results in lots of Meshes and GameObjects.

How can I replicate the approach of the article in Unity?

Thanks for any help.

[I meant to post this here not on the Answers site, so I've copied it across. Apologies for the double post.]

Would using 1 mesh with lots of submeshes help in reducing the GameObject count?

(Is that what you are asking for help with?)

1 Like

Thanks for your reply.

As I'm still trying to understand what the algorithm does exactly I think it may make more sense if I quote part of the relevant section.

`Most of the ring is created using 12 blocks (shown in gray) of size mxm, where m = (n + 1)/4. Since the 2D grid is regular, the (x, y) geometries of all blocks within a level are identical up to a translation. Moreover, they are also identical across levels up to a uniform scale. Therefore, we can render the (x, y) geometries of all terrain blocks using a single read-only vertex buffer and index buffer, by letting the vertex shader scale and translate the block (x, y) geometry using a few parameters.'

A ring is a set of 12 grey blocks, 4 green pieces and one blue `L' piece.
A level represents a ring at a particular vertex spacing.

I know that the Mesh class in Unity is responsible for creating the vertex and index buffer and that interacting with them directly requires a native code plugin. Is there a way I can create one block mesh for example, upload it to the gpu and then reuse it with translation and scaling to form a ring of 12 of them as shown above? I think I may be able to do this with gpu instancing but I was hoping to avoid limiting myself to DX11.

I hope this helps to clarify things.

btw. link is broken (has extra + in the end)

1 Like

Thanks for that, I've updated it.

Hello, I see that this thread is a little bit old but I am interested in clipmaps for my project and it is very difficult to find documentation on this topic.

@MasterReDWinD , have you manage to get something which works?

Also, I have another question, if I understand well, the purpose of clipmaps is to use the GPU to generate the terrain height, but for the collision, how does it works?