Is there a way to use geomipmng without creating a vb and ib for each level?

Started by
16 comments, last by Sfpiano 20 years, 5 months ago
Since each level get less and less detailed, there are fewer triangles as you go down the line. Is there a way to not need to create a seperate everything per level, or to not have one massive vertex and index buffer? //------------------------------------------------------------------------------------------------------ The great logician Bertrand Russell once claimed that he could prove anything if given that 1+1=1. So one day, some fool asked him, "Ok. Prove that you''re the Pope." He thought for a while and proclaimed, "I am one. The Pope is one. Therefore, the Pope and I are one."
//------------------------------------------------------------------------------------------------------The great logician Bertrand Russell once claimed that he could prove anything if given that 1+1=1. So one day, some fool asked him, "Ok. Prove that you're the Pope." He thought for a while and proclaimed, "I am one. The Pope is one. Therefore, the Pope and I are one."
Advertisement
In most cases you can use just one index array for every level of detail. Then you just adjust this index array according to the offset to the giantic vertex array. This problematic, since you have to cover the cracks now.
But I don''t want to be changing the data of my buffers on the fly, and I don''t want a giant vertex buffer; I want everything to be calculated before rendering.
//------------------------------------------------------------------------------------------------------The great logician Bertrand Russell once claimed that he could prove anything if given that 1+1=1. So one day, some fool asked him, "Ok. Prove that you're the Pope." He thought for a while and proclaimed, "I am one. The Pope is one. Therefore, the Pope and I are one."
You only need 1 vertex buffer. You can then have an index buffer for each patch and mipmap level. Make sure you keep your patches small enough so that you only have to use 16-bit indices. Trying to precompute everything may end up being very memory consuming if you have a large terrain.
____________________________________________________________AAAAA: American Association Against Adobe AcrobatYou know you hate PDFs...
So if I have 3 levels of mipmapping, and I have 16 patches, that''s 48 index buffers, and my terrain is only 256x256 right now. For a full terrain wouldn''t I have hundreds of IB''s, and isn''t that inefficient?
//------------------------------------------------------------------------------------------------------The great logician Bertrand Russell once claimed that he could prove anything if given that 1+1=1. So one day, some fool asked him, "Ok. Prove that you're the Pope." He thought for a while and proclaimed, "I am one. The Pope is one. Therefore, the Pope and I are one."
If you have regular heighfield, then there is one option:
One IB for the patch - 33x33 vertices (32x32 quads).
One static VB with X,Z,U,V for each LOD.
Now for every patch we have only one tiny VB with Y (height) coordinate per-vertex.
Render with vertex shader, set static VB to stream 0 for the appropriate LOD for that patch, set its ''height'' VB to stream 1, set the IB and render. Pass to vertex shader offset of that patch in the world space (the static VBs are in object space obviously).
That saves space, and works very good with geomipmapping and geomorphing.
I''m sorry, I really don''t understand most of that. Are you saying to have an IB and VB per patch in addition to a VB per LOD?
//------------------------------------------------------------------------------------------------------The great logician Bertrand Russell once claimed that he could prove anything if given that 1+1=1. So one day, some fool asked him, "Ok. Prove that you're the Pope." He thought for a while and proclaimed, "I am one. The Pope is one. Therefore, the Pope and I are one."
quote:Original post by Sfpiano
I''m sorry, I really don''t understand most of that. Are you saying to have an IB and VB per patch in addition to a VB per LOD?


The only per-patch info is the tiny VB with the ''height'' values (Y). All other info is constant - one IB per terrain, and some VBs per LOD. If your terrain support max 8 LODs, then you''ll have only 8 such VBs.
LOD 0 VB is when X,Y,U,V corresponds for 1x1 patch, then LOD 1 is when that VB is for 2x2 patches square (next LOD), then 4x4 patches and so on. Geomipmapping...
quote:Original post by Sfpiano
So if I have 3 levels of mipmapping, and I have 16 patches, that''s 48 index buffers, and my terrain is only 256x256 right now. For a full terrain wouldn''t I have hundreds of IB''s, and isn''t that inefficient?


Sooner or later practically everthing boils down to a speed vs. memory trade off. You can keep all those index buffers for each LOD of each patch, or you could re-create them as the camera moves around. Depends on how much memory or CPU time you''re got spare..

Assuming your camera doesn''t move too fast you could just keep the current set of IBs around and update them when the camera changes and the LOD level needs to be switched.
quote:Original post by Zemedelec
The only per-patch info is the tiny VB with the ''height'' values (Y). All other info is constant - one IB per terrain, and some VBs per LOD. If your terrain support max 8 LODs, then you''ll have only 8 such VBs.
LOD 0 VB is when X,Y,U,V corresponds for 1x1 patch, then LOD 1 is when that VB is for 2x2 patches square (next LOD), then 4x4 patches and so on. Geomipmapping...


I don''t see how it''s possible to only have one IB for the entire terrain unless it''s this incredibly massive one, because you need to store different data per LOD. Triangle 1 in LOD 0 is different than triangle 1 in LOD 1.

//------------------------------------------------------------------------------------------------------The great logician Bertrand Russell once claimed that he could prove anything if given that 1+1=1. So one day, some fool asked him, "Ok. Prove that you're the Pope." He thought for a while and proclaimed, "I am one. The Pope is one. Therefore, the Pope and I are one."

This topic is closed to new replies.

Advertisement