I have been working away with directx10 for a couple months now. I have a lot of the fundamentals figured out. I have a 3d world with a simple cube for a ship that flies around via thrust. A 3rd person camera that rotates in all directions etc, etc. Oh yeah, did I mention that my ship is a cube? WTF?! Many articles I have read have pointed to using blender, maya, or 3dstudio max as a model editor. Great I've played around with blender and I feel I could make a decent model or two. And then all of a sudden... pow... DirectX has been around for how long now and its still a huge pain in the ass to load data from a largely supported format into a mesh.
I get that many people will have different uses for the data stored in their particular model format but is there not some base functionality that could be implemented. Such as: load vertices, normals, uv coordinates, and indicies? I seriously have to go write a loader from scratch? Or apparently learn the poorly documented Assimp API?
So my question is: where is the most stable loader library for either a .blend, or .obj, or anything else that Blender can export (or a tutorial). I'm not about to drop 3 grand on Maya or 3DSMax. Jesus. I suppose I can do it if I have to but at this point I could care less about how the mesh is actually loaded. I don't need to know the inner workings of a mesh loader to satisfy a craving for knowledge. Just give me something that says: loadMesh(...), getVertices(...), getIndices(...).... etc, etc.
Help a guy out. My flying cube is pretty sweet and all but I also wanted to add planets with gravity, etc and I don't want to write out the vertices by hand or apply some ungodly function to generate them.
Blender and Directx10 c++
Direct3D and OpenGL do not have built in Mesh loaders because they are low level libraries, and model loading is well beyond their scope. To standardize a model format for them would greatly nullify the advantages of having a low level library in the first place, because all the freedom would be lost. These libraries exist only to talk to the GPU by setting render states and calling draw commands with the lowest possible overhead. Nothing more.
There is no good general purpose 3D model format because 3D data is very versatile and can be used in many different ways. Blender, Maya, 3DS Max, and similar programs all have their own internal data structures and ways of representing things, and their file formats are not general purpose, or even useful to other programs.
Because of that, loading someone else's file format into your program is VERY counter productive. Your program will end up wasting a lot of time allocating memory to load foreign data structures, and then restructuring it all at load time to map to your own internal data structures. This is a very slow and messy process.
It's best to use something like Blender's scripting language to export data out of the program into a file format of your choosing in a way that makes sense for your own program, and it's data structures. If all you want is a list of vertices, then write a small script that will dump out a list of vertices into a txt file. Evolve your own format over time, and then when you are done you can make a proper binary format.
There is no good general purpose 3D model format because 3D data is very versatile and can be used in many different ways. Blender, Maya, 3DS Max, and similar programs all have their own internal data structures and ways of representing things, and their file formats are not general purpose, or even useful to other programs.
Because of that, loading someone else's file format into your program is VERY counter productive. Your program will end up wasting a lot of time allocating memory to load foreign data structures, and then restructuring it all at load time to map to your own internal data structures. This is a very slow and messy process.
It's best to use something like Blender's scripting language to export data out of the program into a file format of your choosing in a way that makes sense for your own program, and it's data structures. If all you want is a list of vertices, then write a small script that will dump out a list of vertices into a txt file. Evolve your own format over time, and then when you are done you can make a proper binary format.
I strongly suggest to use Blender export using internal custom properties. Collect those properties and dump them to json.
Then export the geometry as collada and load it up using AssImp. This way, you still get some benefits of collada and full support of your features. Yeah, theorically, Collada alone could do that but looks like AssImp doesn't (sure blender don't export them anyway) so we have to work around that.
The idea of producing my own format for data exchange ... mh, I'd rather not do that.
Then export the geometry as collada and load it up using AssImp. This way, you still get some benefits of collada and full support of your features. Yeah, theorically, Collada alone could do that but looks like AssImp doesn't (sure blender don't export them anyway) so we have to work around that.
The idea of producing my own format for data exchange ... mh, I'd rather not do that.
Previously "Krohm"
Or apparently learn the poorly documented Assimp API?
Really? poorly documented? I found their documentation very useful. All you have to do is load the data using a single call to assimp and then you have a fairly transparent structure that holds all your data. Like so:
Assimp::Importer importer;
const aiScene* scene = importer.ReadFile("file.obj", flags);
Then you can grab vertex positions from that same structure like so:
xpos = scene->mMeshes[0]->mVertices.x;
ypos = scene->mMeshes[0]->mVertices.y;
zpos = scene->mMeshes[0]->mVertices.z;
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement