I implemented a normal map into my tiny graphics engine (I’ve gotten by mostly with phong shading for my research work, so yeah I should do more graphics stuff I thought), and also to learn about tangent space. I saw firsthand the remarkable difference a normal map brings.
Map without normal map
Map with normal map (same lighting as above)
It’s pretty cool how much more detail a normal map brings into your models. Hope to integrate more features like this.
I was looking around on how to get the shininess (aka the specular coefficient, specular exponent) from a loaded model, when using the Assimp APIs (4.1.0). Unfortunately, nothing in the docs helped me and I had to look into some sample programs to get the answer. So, here’s how to do it:
// material index is the ID of the material you are interested in
const aiMaterial* ai_material = scene.mMaterials[material_index];
if(AI_SUCCESS != aiGetMaterialFloat(ai_material, AI_MATKEY_SHININESS, &shininess))
// if unsuccessful set a default
shininess = 20.f;
Here’s an example to get some other property like specular color using Assimp’s structs.
if(AI_SUCCESS != aiGetMaterialColor(ai_material, AI_MATKEY_COLOR_SPECULAR,
spec_color = aiColor4D(1.f, 1.f, 1.f, 1.f);