• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
mrheisenberg

Using mesh subsets vs. a single mesh

8 posts in this topic

Which do you think is the better choice to implement?The way I see it - using a single vertex buffer is the easier way,cause it's easier to texture and easier to organize shaders in the render loop according to materials.However,with splitting the mesh into subsets,you can have for instance a character getting his limbs blown off,but then it sounds like it'll be hell for the artist and for organizing batching when rendering.
0

Share this post


Link to post
Share on other sites
The better choice is the one that best meets the objectives you wish to achieve. If you want limbs blown off then you will have to compromise.

One potential compromise is a layout that allows the mesh to be contained in a single buffer, and drawn with a single call, but with which components of the mesh also have their own separate ranges within that buffer. So, for example, elements 0...127 of the buffer may be a left leg, 128...256 a right leg, and so on. That would let you draw either the entire mesh or individual components as you wish, but at a cost of some vertex duplication.

As always, there is no absolute right answer to this. You pick the solution that does what you need. Edited by mhagain
2

Share this post


Link to post
Share on other sites
You can blow the limbs off a character and still draw him in one DrawIndexed.

1. Give him a skeleton and assign different vertices.
2. Separate the elements of the mesh that you want blown off. Eg, make sure there are no faces connecting vertices from the arm to vertices of the shoulder etc.
3. When the arm gets shot (or chopped with an axe, samurai sword etc), mark the arm's skeleton joint (or bone) as "Separated"
4. When you collapse the bone transforms, any bones marked as "Separated" should have their world transforms calculated separately. Eg you could use a physical simulation to provide the transforms from then on.

I understand this is a lot of conceptually difficult stuff - the main point to take away from it is that you can easily have parts of a mesh use different world transforms, all you have to do is give each vertex a component that indexes the world transform from an array (Preferably in the vertex shader). You can provide this array in several different ways - in D3D10 the options are constant buffer, shader-buffer, texture1D, texture2D... Once you understand this technique there is a whole range of effects you can achieve using it - characters having their limbs separated, instancing, etc.
1

Share this post


Link to post
Share on other sites
[quote name='mrheisenberg' timestamp='1350166208' post='4989899']using a single vertex buffer is the easier way[/quote]Multiple sub-meshes can all share the same vertex buffer.[quote]with splitting the mesh into subsets,you can have for instance a character getting his limbs blown off,but[/quote]There's lots of ways you could go about this. You could split the mesh into many draw-calls, and only submit the draw-calls for the sections you want. You could create many different sets of indicies ([i]in one index buffer, or in multiple buffers[/i]) -- e.g. one for whole mesh, one missing A, one missing B, one missing A+B, etc -- and then use a single draw call with the appropriate set of indices. You could have your artist create a 2nd tex-coord set, where the [font=courier new,courier,monospace]u[/font] coordinate is an integer representing the "sub mesh" ID, and then in the vertex shader, if this number matches a "missing" mesh you can multiply the position by zero to make it disappear.

The best solution depends on the situation.
1

Share this post


Link to post
Share on other sites
[quote name='Hodgman' timestamp='1350564902' post='4991414']
multiply the position by zero to make it disappear.
[/quote]

Surely this will lead to horrible artifacts? Unless the topologies of the different limbs were separate, as I described above? But even then you would still want that part of the mesh to be visible. Shot-off limbs dont disappear, they fall to the ground or roll down the hill.
0

Share this post


Link to post
Share on other sites
Yeah that was just another option for hiding sub-meshes - it would require each sub-mesh to not share any verts with other sub-meshes ([i]but that's guaranteed because the per-sub-mesh UV coordinates make the verts unique[/i]).

You could apply the same trick to your already mentioned bone-based sub-meshes, where if you wanted to hide a sub-mesh after it's been on the floor for some time, you could replace that bone's transform matrix with a scale=zero matrix.


I've only used the multiply-by-zero trick in a few cases, such as:
* Tile-based post processing. Instead of using a full-screen quad for post effects, you can use a grid of quads. If a quad doens't need to be processed ([i]e.g. it's entirely in-focus when performing DOF[/i]) you can hide that quad.
* Shader LOD on sub-meshes. We had an expensive pixel shader and a cheap LODed version of that pixel shader. We first used a per-pixel [font=courier new,courier,monospace]if[/font] to choose which one would be used, based on distance, but then found that on our target GPU it was quicker to draw the mesh twice ([i]once with each shader[/i]) and then hide one of the meshes if it's beyond a certain distance, and hide the other if it's closer than a certain distance -- so that when the mesh's centre point gets a certain distance away, it automatically starts using a cheaper pixel shader.


There's practically endless options for mesh rendering, depending on what your situation is. So, different games would be best suited to different mesh rendering schemes. Edited by Hodgman
0

Share this post


Link to post
Share on other sites
thanks for the replies,I think you're right that a single vertex buffer is better,the blown off limb will be a totally different mesh anyway,since it would require for instance - having torn off skin and blood at the place where it was attached to the body and exposed bones on the texture.

EDIT:how do you think it's done in Dead Space 2?I think they have a different mesh type for each limb and for the body for each type of limb blown off?How else would they add the bloody torn off flesh at the torn off joints otherwise

[img]http://www.xboxworld.com.au/images/fake_achievements/fake-achv-deadspace2.jpg[/img] Edited by mrheisenberg
0

Share this post


Link to post
Share on other sites
What Valve did was to render a separate bloody-mess mesh around the wound. So you could have bones poking out etc

http://www.valvesoftware.com/publications/2010/gdc2010_vlachos_l4d2wounds.pdf
0

Share this post


Link to post
Share on other sites
[quote name='hupsilardee' timestamp='1351112936' post='4993555']
What Valve did was to render a separate bloody-mess mesh around the wound. So you could have bones poking out etc

[url="http://www.valvesoftware.com/publications/2010/gdc2010_vlachos_l4d2wounds.pdf"]http://www.valvesoft..._l4d2wounds.pdf[/url]
[/quote]

one thing that bothers me = aren't there going to be seams between the limbs if you have a different subset for each limb?
0

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  
Followers 0