Convert triangle list to a triangle strip?

Started by
10 comments, last by DividedByZero 8 years, 4 months ago

Hi guys,

Is there any way to convert a triangle list to a triangle strip? Either via code or some external utility?

A game I am working on is very heavy in geometry and I am hoping to cut down them memory footprint to a third. I am currently hitting ~800 MB of VRAM due to animations.

Thanks in advance. :)

Advertisement

I know of two tools, NVTriStrip, from nVidia, and another one that tried to improve on it.

Here you can read about both of them: http://users.telenet.be/tfautre/softdev/tristripper/vs_nvtristrip.htm

TriStripper http://users.telenet.be/tfautre/softdev/tristripper/

NVTriStrip http://www.nvidia.com/object/nvtristrip_library.html

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

My journals: dustArtemis ECS framework and Making a Terrain Generator

Any reason to not prefer indexing? There are plenty of arguments (e.g from the likes of Tom Forsyth) that indexing is so superior to strips in so many ways (higher vertex reuse ratio, better vertex cache optimization, better match to hardware) that you should at least have a really good reason to not consider it.

Also - is using 800mb of VRAM actually a problem? Or do you just not like the fact thatyou're using so much? If the latter then I'd suggest that you may be prematurely optimizing.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

Bear in mind that even if your geometry is 800MB, the majority of that will be vertices rather than indices. Stripifying your data may reduce the size of the index buffer by 2/3rds but it does nothing for the size of your vertex buffers which are typically going to be ~5-15x larger than your index buffers (depending on vertex/index size).

Are your vertices slimmed down and compressed to the bare minimum size? In what format are you storing each vertex attribute?

Adam Miles - Principal Software Development Engineer - Microsoft Xbox Advanced Technology Group

Bear in mind that even if your geometry is 800MB, the majority of that will be vertices rather than indices. Stripifying your data may reduce the size of the index buffer by 2/3rds but it does nothing for the size of your vertex buffers which are typically going to be ~5-15x larger than your index buffers (depending on vertex/index size).

Are your vertices slimmed down and compressed to the bare minimum size? In what format are you storing each vertex attribute?

I can clean up the geometry a bit, but it is pretty lean at the moment.

The FVF is purely vertex positional data. Each vertex attribute is 12 bytes. So, I don't have any unnessesary data tied to it. No normals, colour data etc. Colour is handled purely by the shader.

Any reason to not prefer indexing? There are plenty of arguments (e.g from the likes of Tom Forsyth) that indexing is so superior to strips in so many ways (higher vertex reuse ratio, better vertex cache optimization, better match to hardware) that you should at least have a really good reason to not consider it.

Also - is using 800mb of VRAM actually a problem? Or do you just not like the fact thatyou're using so much? If the latter then I'd suggest that you may be prematurely optimizing.

Hi mhagain,

My game is created in GameMaker Studio, which sadly doesn't support indexing. The other issue with the 800MB VRAM usage is that GM stores a copy of the geometry in system RAM also. 800 MB is 1600 MB in reality. Couple that with GM only being able to create 32 bit applications, I am right on the threshold of exceeding the available RAM for an application.

Any reason you're not trying to use a 2 byte per positional component format?

Also does gamemaker really not support indexing? Wow if true.

-potential energy is easily made kinetic-

and one another thing i hardly can imagine 800 MB for animations consider 3 joints per finger * 5 fingers * 2 + 2 joints per foot + 2*anckle * 4 for legs + 8 others gives us

48 matrices per frame * 16*4 bytes = 3 Kilobytes per frame, considering that:

hitting ~800 MB of VRAM due to animations.

this sounds like gamemaker exporst each frame to different model, instead of using one vbuff for one character. or maybe you did the animtion wrong, there is a way to export triangle set to tri_strip, but i wonder how are you supposed to go through vertice data, if this program stores animation set in 800 MB seriously

i may calculated that wrong but it seems: 2.53 hours of pure animation at 30 fps. for one vertex buffer set.

anyway to the answer...

how exactly it would work i don't know but finding shared vertices between triangles and then converting these shared ones (you group by 2 triangles, and convert that to tri_strip) next would be to find shared vertice of tri strip quad but i mean ' 'the' 'next' ' shared vertice i reckon for first quad tri strip is 4th vert and for second quad tri strip is first vert.

so first step group shared verts and connect by 2 triangles , then you will have almost everywhere quads made out of triangle strips,, you could find shared verts there and connect them accordingly. but i wish you could say how did you do the animation on this game maker. coz it seems pretty unreasonable,

but still if you have way too much gemoetry you could consider using dynamic level of detail, or at least precompute models to lower LODs, or make lower polygon models,

anyway if you plan really to release the game that uses such amount of vram onyl to draw a menu, then so be it, i have seen way too much unity games that were drawing 2 quads and it ran at 1 fps... so why would you care?

and one another thing i hardly can imagine 800 MB for animations consider 3 joints per finger * 5 fingers * 2 + 2 joints per foot + 2*anckle * 4 for legs + 8 others gives us

48 matrices per frame * 16*4 bytes = 3 Kilobytes per frame, considering that:

hitting ~800 MB of VRAM due to animations.

Careful about what you are assuming I am animating.

i meant an animation of human without all toes

I can easily imagine 800mb of animation if keyframe animation is used.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

This topic is closed to new replies.

Advertisement