Load Meshes

Started by
4 comments, last by Krohm 9 years, 6 months ago

I've been working through GEA and re-reading "Introduction to 3D Game Programming with DirectX 11" and have recently also been making some demos based on the further exercises from each chapter.

I wanted to improve these demos by adding some models/ meshes around the environment and including a skybox. Although the book only covers how to load the custom .m3d format. I could create a Python script in blender, but I really wanted to load the models another way.

The book recommends, MeshFromOBJ10, but having researched it, the results seem to complicated to include in my code. I did, however, find this (http://www.braynzarsoft.net/index.php?p=D3D11OBJMODEL), which I have reason to belive is not functional.

Should I include the code from there in two files - OBJLoader.cpp and OBJLoader.h?

Or is there any other place I should be looking to load meshes?

P.S. I'm open to any file format that would be good for me. Be it .OBJ or anything else (.max or .3ds would be great though).

Advertisement
Look into assimp. It supports many mesh file formats.

While most times I'd agree with yckx on the assimp thing, I think for a demo it's rather bulky. It contains WAY too many functions and formats. I say, find a format that you want and look for a library that specializes in it. It will be smaller and, in most cases, faster.

I develop to expand the universe. "Live long and code strong!" - Delta_Echo (dream.in.code)

Assimp is pretty simple to use and with a unique interface you have lots of format in your hands. Once I thought as sethhope, but the time i spend to find and get working some specialized lib (not to say to write my own parser...) is at the end greater than the time to download, install and use assimp. And, more, the assimp work has to be done only once, and you can get rid of the problem of loading a mesh in every other project.

As for the speed I quote setthope: assimp seems a bit slow in effect.


As for the speed I quote setthope: assimp seems a bit slow in effect.

The speed of the first loader shouldn't be an issue, in that a better approach is to convert files to a convenient format that will load quickly. I.e., use assimp to load files, convert the files to a fast-loading format and save those files for (later) loading into an app that needs them.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

If you have doubts about an OBJ loader then don't use it.

I second suggestions about using ASSIMP. Why?

Because work put in ASSIMP interfacing, even for a demo, is work invested in a library you're going to use. By contrast, you will drop OBJ support a day. It gets quite some mileage but it's just insufficient for modern uses and BTW, the real OBJ format includes nontrivial stuff such as NURBS usually not supported by easygoing file loaders.

Previously "Krohm"

This topic is closed to new replies.

Advertisement