Sign in to follow this  
THACO

NvTriStrips

Recommended Posts

Ok, I want to use NvTriStrips to create triangle strips. I can't figure out which way they want the information. Do they want it via and array of indicies to an array? or like an array that is setup to be used a vertex array? Currently my info is setup like this face { vert1 float[3]; vert2 float[3]; vert3 float[3]; normal1 float[3]; ... tvert1 float[3]; ... } where the verts are they specific verticies not just indicies into an array. Can i send in just an array of my verts? or do I have to send in an array of indicies for each face? Im just curiuos on how to use nvtristrips, also is there a maximum size for strips that is recommended for use with modern cards? -THACO

Share this post


Link to post
Share on other sites
The NvTriStrip library doesn't care about or take as input your position/normal/texcoord/whatever information. Just your vertex _indices_. All operations are performed on the indices.

Share this post


Link to post
Share on other sites
That is sorta my problem, what indicies am I sending it. I know this should be easy and I'll be kicking myself for not realizing it but. What should I be sending to the functions? I know I am probably not explaining myself correctly here. I feel like an idiot because I should understand this but I am just missing it. I guess I will try to re-iterate my problem to see if I can explain it better.

I pretty much have an array of face structures like I mentioned above. What indicies would I send it then? or in what order? Or is there another way I should organize my data to make it easier?

-THACO

Share this post


Link to post
Share on other sites
Save every vertex once (no duplicates) and use the mentioned indices to "bind" the vertices. Take for instance a triangulated cube, it would have 8 vertices (8 corners) and 6*2*3 indices (6 sides, 2 triangles each and each triangle has three vertices pointed to in the vertex pool using indices). Then send the "bind-list" which is just an array of ints in groups of three making up triangles.

It's the best way I can explain it...

Share this post


Link to post
Share on other sites
Here's a code snippet from my code:

//now to let NvTriStrip loose
SetListsOnly( true );
PrimitiveGroup* Groups;
unsigned short NumGroups;
GenerateStrips( &Indices[0], (unsigned int) Indices.size(), &Groups, &NumGroups );
Indices.resize( Groups->numIndices );
std::copy( Groups->indices, Groups->indices + Groups->numIndices, Indices.begin() );
delete[] Groups;


My indices are in a std::vector<unsigned short> here. I call GenerateStrips with Lists Only enabled (I only want one result primitive group, and I don't want stitched lists). The resulting Indices, I copy back into the vector, and then delete the groups. That's all there is to it.

NvTriStrip's header has another function to reorder vertices, but I have no idea at all how to use that one.

Share this post


Link to post
Share on other sites
I am working through it now. I am trying to think, cuz I can't in my head see how its works yet. Of what I understand you just send it the list of indicies into your pool of vertices. That sounds easy enough, the one thing I can't understand is more of how that helps. I am going over it on pencil and paper right now to try to convince myself that just knowing which points are shared between triangles you can do it. I understand it is possible / but I don't see it. Not sure if that explains it, I figured in the first place it would need actual data, but thinking about it more and more I see how it can work with just indicies well im starting to see, gota do some tests. Thanks for all the help, ill post back when I finally figure it out.

-THACO

Share this post


Link to post
Share on other sites
Ok, it seems to be working. The one remaining question is how do I deal with texture coords. Im working with OpenGL and currently my Pool of vertices consists of all the vertices which are different in terms of x, y, z and the normal that is associated with that vertex. I can see that I will send up with arrays that are the same length when I draw a vertex array and normal array, but what about texture Coords?
Say I am just using vertex ararys, not VBO's I need to set glTexCoordPointer, will that be the same regardless of if I am using triangle strips or no strips?

THACO

Share this post


Link to post
Share on other sites
I've been trhough all this, and you have to be very carefull about how many vertices ( spelling??) share the same texture coord, a quake2 model works
like that , one vertex has more than one texture coord , this is very difficult to render using nvidia tri strip utility without duplicating the vertex ( which it doesn't ) , so you will end up with a messed up model.
I call this kind of models 'unaligned' because of the different count od vertex count and texture coord count, there is one more issue i never managed to solve, not the entire model is rendered using strips, sometimes, ( depending on optimizations you choose ), small gaps appear, these surfaces need to be renderd with a separate algorithm because they are saved in a linked list rather than in a tristrip list.
This sounds very odd for me, has anyone tried to solve this ( bye the way i have now my tristripping algo , this is more just than a curiosity )

Share this post


Link to post
Share on other sites
Quote:
Original post by ketek
I've been trhough all this, and you have to be very carefull about how many vertices ( spelling??) share the same texture coord, a quake2 model works
like that , one vertex has more than one texture coord , this is very difficult to render using nvidia tri strip utility without duplicating the vertex ( which it doesn't ) , so you will end up with a messed up model.
I call this kind of models 'unaligned' because of the different count od vertex count and texture coord count, there is one more issue i never managed to solve, not the entire model is rendered using strips, sometimes, ( depending on optimizations you choose ), small gaps appear, these surfaces need to be renderd with a separate algorithm because they are saved in a linked list rather than in a tristrip list.
This sounds very odd for me, has anyone tried to solve this ( bye the way i have now my tristripping algo , this is more just than a curiosity )


Yeah the solution is in Quake source code ;-)

I don't know what you mena rendered in a seperate link lists though...

Share this post


Link to post
Share on other sites
I just threw everything out the window and rendering with just gl_triangles, it is really easy to keep track of everything when it comes to exporting and manipulation. I know it takes up more memory but I didn't want to make my exporter have to test and see if the triangles strips would generate less verts compared to the triangles. Most of my tests generated almost double the vert count in triangle strips due to degenerated triangles and almost all my verts for each face being unique (not being able to share verts between faces because of texture verts or normals being different). I don't think this will hurt performance to much, and I don't intend on having rediculous amount of polygons in my game.

-THACO

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this