Assimp & Normal Maps

Started by
6 comments, last by NiteLordz 12 years, 3 months ago
Currently i am using assimp in an offline tool, and it works fine. i can import my models both skinned and static, and render them in my engine without a problem. Now i have come to the part where i want to stream line my process a little more, and this means reads "all" materials from the model format and creating my custom material.

where i am at right now is i can read in the diffuse material/texture and write it out. However, the model i have has a normal map and a specular/gloss map associated with it.

I model in 3D Max 2012. I know that the x file format does not contain the extra materials asside from Diffuse. So i tried .OBJ format. The "mtl" file contains the textures that i am trying to read in, but when it comes to assimp reading it ( or me pulling it from assimp ), i do not get the information.

This works for diffuse material

if (material->Get(AI_MATKEY_TEXTURE(aiTextureType_DIFFUSE, 0), stringVal) == AI_SUCCESS)

this does not work for bump

if (material->Get(AI_MATKEY_TEXTURE(aiTextureType_NORMALS, 0), stringVal) == AI_SUCCESS)

Any help is much appreciated.

Thanks much
Code makes the man
Advertisement
It seems that the normal map is stored as aiTextureType_HEIGHT. I, too, was confused about this some time ago. I believe someone has
already reported this to the assimp team.
Thanks fanwars, i will try this,
Code makes the man
That works, kind of. Now it returns -bm, instead of the file name. Thougths ?
Code makes the man
There must be a bug in the obj importer. I'm having the same behaviour... If the -bm switch and the float is removed from the mtl file, it works how it should.
The whole material pipeline of assimp is a bit vague. I'm using xml-based material files for my model format, I find it easier to manually tweak some attributes
instead of struggling with these kind of bugs.
I am doing the same. I create my custom xml materials based on the parameters from assimp, and this stream lines the process. so what i ahve done, is added a "hack" into my asset importer, that if it is an obj file, it will scan the file, and remove those "issues" that i come across.

the other problem i am currently having, is that i use skinned meshes, and none of the formats that export to animated files that assimp understands, none of them import the normal or specular maps. so they have to be added individually :( big time killer.

this is leading me closer and closer to wanting to write my own 3d max exporter
Code makes the man
Did you try opencollada exporter? It works pretty well for skinned and animated stuff. You may have to let assimp recompute the normals or tangents for some meshes, though.
And if you're using CAT or other such tools, the best results are achieved when you first export to FBX, then import it back and finally export with opencollada wink.png .

Collada for skinned meshes, ASE for static/collision meshes, and the "quality" is guaranteed.

I was also thinking about writing my own 3ds max exporter. I actually tried, and I got my mind shattered. And I thought my future artist isn't going to use 3ds max anyway, so I impatiently quit... Sure is all the hassle with exporters, importers and manual tweaks waste of time, but now that I found at least somehow working asset exchange pipeline, I think I can handle the pain.
I just downloaded and installed OpenCollada. This works very well. i can use it for both static and skinned meshes in my pipeline as it picks up the material maps properly. The only issue i see is the animations are under one umbrella in the dae file ( "animation" ). this isn't a huge deal, as my animations are stored in a seperate named file, and i can just use the file name in the file export process ( not the best or ideal solution, but... )

Thanks for the heads up !
Code makes the man

This topic is closed to new replies.

Advertisement