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

Any tips on structuring 3d models for great code?

3 posts in this topic

What is the best general structuring approach to building a robust 3d model for use in video games? (i.e. a character/vehicle controlled by the player/AI) Some of my questions in specific are:

  1. When should I use multiple models?  This seems useful for things like weapons, but what about vehicle wheels or destructible pieces - how far should you take this concept?
  2. When should I use separate meshes within a single model?
  3. Is there a 1:1 realtionship between meshes and materials that should be honored? It seems like meshes get sent to the shaders as a unit, although you could possibly break them down into primitives and send those pieces to different shaders...
  4. Is it acceptable to animate a rigid model (like a mech) using a single mesh with disconnected pieces, assigning all the vertices in each piece a 100% weight to a corresponding bone?
  5. Should you ever create animation channels for meshes (rather than a bone)?
  6. Are there standards for how many texture files should be used with a single mesh or a model?

This topic may seem more to do with modeling than coding, but the reason I'm asking is because these details inform much of the design of the model handling code, which I would like to be powerful and flexible but elegant and clean as well.

Thanks for any advice!

1

Share this post


Link to post
Share on other sites

1 & 2. This is very application-specific, and it's generally a trade-off between performance and realism/complexity. A general rule of thumb would probably be to not use multiple models/meshes for any given game entity unless it's required by the game. For example, don't make a separate model for the wheels unless they can actually come off vehicle, or change appearance in some way.

 

3. Personally i prefer using texture maps for material properties, otherwise i would probably stick with one material per mesh.

 

4. Assigning all vertices a 100% weight to their corresponding bone makes the animation look less realistic on organic objects (you lose the skin-twisting effect). If that's acceptable or not is entirely up to you :)

 

5. I might be wrong but I can't see any reason to animate actual vertices when there's a working rig animation system in place.

 

6. This is also application specific, no standards. In many cases it's more efficient to load textures separately from models and just have the models reference whatever textures it's using. This way one texture can be reused by many models, but that's a different story.

2

Share this post


Link to post
Share on other sites

When should I use multiple models?  This seems useful for things like weapons, but what about vehicle wheels or destructible pieces - how far should you take this concept?

I would take this as far as required to reach my target.

Do your game require this feature. If not, let it out. Wrapping your head around things you might need in the future in some circumstances for some use-case is not going to take you anywhere.

Your example is ill.

Weapons come in their own model and get attached to the mesh.

Same applies to destructible pieces (although the models are likely bundled in the same resource file).

So I'd personally provide named attach points / joints / whatever you call them and allow the model to be assembled by multiple meshes.

 

When should I use separate meshes within a single model? Is there a 1:1 realtionship between meshes and materials that should be honored? It seems like meshes get sent to the shaders as a unit, although you could possibly break them down into primitives and send those pieces to different shaders...

Define what a mesh is. Everything that goes through draw calls is a mesh. Every draw call is a mesh. What is a model? For years, "models" had a single material and often got rendered in a single drawcall. Then, models started to have more drawcalls, each with a different material.

Basically, nobody in general breaks the drawcall to primitive level to issue them to "different shaders". Drawcalls are the basic unit of operation for generic usage.

 

Is it acceptable to animate a rigid model (like a mech) using a single mesh with disconnected pieces, assigning all the vertices in each piece a 100% weight to a corresponding bone?

Might work in some situations, I wouldn't be very proud of it and wouldn't consider it good practice (it's against the whole idea) but if it saves the day, I'm all for it!

 

Should you ever create animation channels for meshes (rather than a bone)?

They are sometimes still used.

 

Are there standards for how many texture files should be used with a single mesh or a model?

Some engines (especially hobby engines you read about in those forums) have a limit. In general you must support a "practically unlimited" amount of resources to be loaded. For my mesh format I have an hard limit at about 2^10 resources if memory serves.

2

Share this post


Link to post
Share on other sites
Hi, The general rule, purely from a technical and not an artistic viewpoint, is that each of those categories in the original post should be as lean as possible to accomplish the artistic concept. I have done a whole car with one material and one texture and a ship with several each. You use the least amount to accomplish the most visual impact PERIOD Duplicate identical parts exactly the same in view, UVmap, and texture as possible - sometimes going out your way to do so. For example, you would not want to make each section of hand railing from scratch. You would make a section of hand railing complete with texture, any material, and any shader, then duplicate that section many times to cover a bridge, ship, pier, boardwalk, balcony, and so forth where the handrail will span. Another example are legs of a monster. Say your monster has twelve legs. Most or all of the legs would come from one source leg which was duplicated. Another example are faces of any object - say a boat: Instead of making each section of deck or hull from scratch each time you would make one and duplicate it, placing each duplicate into the right position. An alternative is to select already existing faces and apply the same texture/material/shader to each. Later you can always go back and take a few of them to have another layer applied for variety. It is very advantageous for any game developer to get 3D model experience so they understand optimization of a model.
2

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