Jump to content
  • Advertisement
Sign in to follow this  
and192

Reusing geometry with vertex streams

This topic is 4219 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

Hello, Sorry if this has been answered elsewhere I've been looking quite hard but can't find an answer. I have a quadtree based terrain LOD implementation (don't we all!) working pretty well, and i'm doing some optimisation. One optimisation i've found is by noticing that my X and Z vertex coordinates are the same across each terrain chunk i render (when rendering the chunk i offset and scale them in the vertex shader, which also solves the floating point precision issue but that's another story). The only geometry that changes is the Y coordinate and normals. Consequently I've split my X and Z data into a separate vertex stream from the Y data and normals. The X and Z buffer is managed, the other buffer dynamic. Here's the problem - I render by calling DrawIndexedPrimitive for each chunk, specifying a BaseVertexIndex for that chunk's offset in the dynamic buffer (y & normals). However the X and Z buffer stream needs to always start at BaseVertexIndex 0. The only solution I can think of so far is to repeat the X and Z vertex data again and again in the managed buffer, so that the BaseVertexIndex will point to the correct starting point in the managed buffer (XZ) and the dynamic one (Y/Normals). This solution seems wasteful to me, and I'm hoping there's a better one. Any help, even if it's 'you can't do it that way at all', would be appreciated! Cheers, Andy

Share this post


Link to post
Share on other sites
Advertisement
You can use the "OffsetInBytes" parameter of SetStreamSource.

As for the concept itself, I'd suggest that you check how the separation into streams affects performance, since it might slow things down somewhat. It might end up that your space optimisation will not be a speed optimisation.



Share this post


Link to post
Share on other sites
Hi ET3D,

Thanks - i'll have another read of the documentation about that parameter, although i've heard it's not supported on some of the older cards. Having had the benefit of a night's sleep I suspect you may be right about the false economy of what i'm trying to do. I'll have another think!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!