Own Model Format, how to render?

Started by
13 comments, last by bzroom 20 years, 5 months ago
I''m making my own model format for this game im working on where the limbs of the characters can be chopped off. I pritty much have how im going to render it. Each member of the body is a geometry class and after the matrix is all setup for it I call its draw method. I havn''t actualy tested this yet but I have a feeling since the verticies are assigned to each member that when one is severed there will be stretched polygons between the severed members, not to mention the holes left if this dosn''t happen. So what im asking is do you think it would be more efficient if I would create a display list for each member, and have each member capped. Or double up the verticies at the joints of the members and render them in the normal GL_TRIANGLES way I was planning? One problem I think I would face with display lists is that eventualy I want the members to accept blood splatters. Since the members geometry are shared by all instances of the same character, I dont think I could change the textures and coordinates per instance. I hope all that made sense and thanks ahead of time for help.
Advertisement
All I can say is, sounds like my kind of game!

And I''m gonna go with...it depends on the rest of your design. If the geometry is pretty static, it may be good to go with display lists (or even better, VBOs)

Brian J
Brian J
Yea it should be pritty cool. Um, whats a VBO? and Will a display list ever become slower then not if there are two few verticies drawn in it?
A VBO is a vertex buffer object. It''s a good way to store your vertex data in hardware. But this is where I can''t help you anymore, because I''m a D3D man myself . I just know a decent amount about OpenGL and the ARB. I''m sure you will find tons of information on google or on this site. Good luck

Brian J
Brian J
So its a vertex buffer like in D3d. I used to mess with that, could never get my frame rate above 10 or so. That was before my knowledge of the matrix. I would, everyframe, manualy update every verticies new position and resave it in a buffer. I guess thats not the fastest thing in the world.
Oh yeah, VBs are the fastest way to go, that would have to be your own mistake
Brian J
I would do something like this:

1) keep entire mesh in a vertex buffer
2) build a triangle list for each piece, and a capping list for each possible slice position, in system memory
3) build the actual triangle list/buffer by just concatenating triangle lists for pieces that are still connected; cap by concatenating capping lists for things that are severed
4) render the entire mesh using a single call (perhaps two calls, if you use a separate severed texture for the caps)

Note that you only need to re-build the list when the pieces get severed; you don''t need to do it per frame. Note that you can start out with a single mesh instance, and if you chop off an arm, you might spawn a separate "dummy" mesh for the arm piece flying away; the original and arm meshes can still refer to the same vertex buffer, but be rendered using different triangle lists as different calls.
enum Bool { True, False, FileNotFound };
Thank you.
I guess i dont know as much about opengl as i thought i did. If i have all my characters mesh in a single triangle list. And render it with one call. How would i apply the transformations of each joint?
The way I do characters, and I think this is pretty standard, is to have a hierarchical structure of (invisible) bone objects and animate those.

The character is single mesh, with skin information. Each vertex is driven by one or more bones, and each vertex/bone pair has a weight and offset vector; the offset vector is the vertex's position in the bone's coordinate system. When the driving bones are moved, the offset vectors are transformed by the corresponding driving bones absolute transformation matrices, and the final vertex positions are the weighted average of all the transformed offset vectors for each bone driving that vertex.

A simpler way to do this is to have one bone driving each vertex.

[edit: and just to clarify, to transform the vertices, I obviously don't use gl matrix commands, since I'm rendering the model in a single vertex array. I do the transforms manually using my own matrix class.]

[edited by - benjamin bunny on November 6, 2003 11:26:18 AM]

____________________________________________________________www.elf-stone.com | Automated GL Extension Loading: GLee 5.00 for Win32 and Linux

This topic is closed to new replies.

Advertisement