• 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
Leow Jun Jie Donald

How to load Maya Models and Animation?

5 posts in this topic

Hi all,

 

I am currently making a 3d game, and I have managed to make a program that run on OpenGL and C++. Everything that is needed to make a windows pop out has been done, I also have a .obj loader. However, I realized that I have no idea how to load animations. I did some research online, but there were a lot of things I didn't understand...some said use MD5 files, some said FBX files, and some even just did animation with the codes using the OBJ models.

 

Can anyone tell what kind of file would be easy to use for a beginner like me? And just to emphasize, I am really a beginner. I learn C++ and OpenGL as modules in my school for the past two years, and all I have been doing is 2D games most of the time. This is my third time doing a 3D project, but on a bigger scale. The previous projects are just simulations that have nothing but non-moving models and "hard-coded" objects. Even the environment was done in OpenGL codes.

Edited by donaldleow
0

Share this post


Link to post
Share on other sites

Skeletal animation != easy !

 

Some thoughts considering formats:

obj:

Very easy text format, but it does not support animation data.

 

FBX & Collada:

Both formats are interchange formats for different modelling tools, games etc. They both contain skeletal bone animation data, but although contain a lot of stuff not really necessary for games. FBX is from autodesk, but is the better, more simple format and better supported format. Collada is a open format, but it is harder to get warm with it, and support is laking somewhat.

 

MD5:

Is a game animation format used in id-tech engines (a long time back). Not as powerful as FBX or Collada, but have some good support including libs to read them.

 

The simplest way would be to use MD5, the best way would be FBX or Collada and a converter to transform it into your own format. But nevertheless, skeletal animaton is really not trivial to implement in your engine.

 

Although consider assimp, an open source assert lib, it might be useful.

1

Share this post


Link to post
Share on other sites

Thanks for the reply Ashaman73!

 

Though I would like to ask, what did you mean by "a converter to transform it into your own format"?

The part that I don't get is the transformation part, just to clarify...do you mean get a converter software or something?

And "my own format" meaning ACSII or something?

 

Appreciate your help btw.

0

Share this post


Link to post
Share on other sites

Take a look at this topic. That link's question actually has nothing to do with DirectX and is applicable to most applications that may use more than one import file format. Even if you only import from one format, the approach still provides flexibility in revising your code.

 

The approach of having a file importer program separate from a data saver program is particularly applicable if you're not sure how you're going to use data for animations. Write a file importer and load in all the data that format has to offer, and stuff it into a custom structure of your design. The data converter/saver program will load data from that custom structure and convert it to your animation program's needs, the best being a binary file with data in just the form needed by the mesh builder part of your program, and by the animation controller part of your program, which should be separate processes/objects.

 

It may seem like a pain in the rear-end having all those separate pieces. But, if you have a file importer that works, you can (and will be) revising the data converter/saver without having to change working code. It will likely be a little iterative - you may want to change the custom structure from time to time - but you'll thank yourself if you take the time now to create a flexible process.

 

Once you get it working, the entire back end of the process never needs to be revised. Note: obj format doesn't support animation, but can still store it in the same structure and you just create meshes from it. Also, the better you separate all the tasks from one another, you'll later be able to write other programs using some or all of the pieces without having to worry about importing data again! With a binary file on disk, whose structure you know, you can write in other APIs (DirectX, etc.) with previously converted files.

 

file importer (MD3) ---> custom data structure (maybe ASCII on disk) ---> convert/save (binary) to disk ---> quick load and mesh creation / animation creation.

file importer (Maya) ---> custom data structure (maybe ASCII on disk) ---> convert/save (binary) to disk ---> quick load and mesh creation / animation creation.

file importer (obj) ---> custom data structure (maybe on ASCII disk) ---> convert/save to (binary) disk ---> quick load and mesh creation / animation creation.

 

If you're not comfortable passing the data structure in memory from one program to another, write a routine that takes a pointer to the data structure and writes the data in that structure configuration to disk. That routine can then be copy/pasted into each file importer. If you're just starting out doing this sort of thing, write the custom structure data to disk in ASCII, so you can open it in Notepad (or even in your IDE - Visual Studio, etc.) as you'll likely be debugging the import process. Remember, the time to load/save/convert, etc., for this process is all outside your realtime animation program, so, if it takes a couple seconds to read this file or that, and a few more seconds to save it, load it again, etc., there's no impact on your animation program.

Edited by Buckeye
1

Share this post


Link to post
Share on other sites

Though I would like to ask, what did you mean by "a converter to transform it into your own format"?

The common problem is, that you have an internal format to render your models (eg. a simple array to store your vertices etc.) and an external tool to edit your content (modelling tool). Here are some way to transform the modelling tool representation to your internal tool representation:

1. write a custom exporter

You can write a custom exporter for your modelling tool to export it to a file format, which suits your internal requirements best (e.g. write all vertices as a comma separated list of floats). This has some charm, but has lot of disadvantages, therefor I would never sugguest to write your own exporter as hobby/indie developer (too time consuming). The reasons are, that the exporter is often bound to a single tool, written in a tool specific language (which you need to learn) and with an API which might change with a newer tool version.

 

2. write a custom importer

This is the other way around, export content to a common format (obj,fbx,collada) and write an importer to this format. This works great for small projects, but have some disadvantages too: You need to map the format structure to your own, you need too load and parse often really large files, which is memory/disc consuming and slow. For larger projects this could be a showstopper.

 

3. write a converter between a common format and your internal file format

This is the best solution in my opinion. As input you take a common file format and maps it to your own fileformat, much like the importer in 2, but instead of using it directly, you save it as file much like an exporter in 1 . This way you avoid the tool dependency from 1 and the performance hit from 2.

 

smile.png

Edited by Ashaman73
0

Share this post


Link to post
Share on other sites

3. write a converter between a common format and your internal file format

Just to make it clear, that "internal file format" isn't what your game application will read in. It's an intermediate file, which is designed to hold just about anything Maya or MD3 can export that you ever think you'll need, which is then converted by an independent routine to (e.g.) a binary file that's used by the game application.

Edited by Buckeye
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