Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Sfpiano

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

This topic is 5435 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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."

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!