Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for "map_Bump -bm" #4393

Merged
merged 2 commits into from Feb 20, 2022
Merged

Added support for "map_Bump -bm" #4393

merged 2 commits into from Feb 20, 2022

Conversation

TerenceRussell
Copy link
Contributor

@TerenceRussell TerenceRussell commented Feb 18, 2022

Hi,

I've added Obj model support for the bump map -bm #### multiplier. I've attempted to follow the gltf use of "$tex.scale" as a guide for making it available.

An example Obj line with the parameter:
map_Bump -bm 0.398056 textures\main_normal.png

These changes will load the 0.398056 factor into a material property for either Normal or Height maps (ie: Obj map_Bump). The property is only set if the scalar is not 1.0.

The property can be retrieved like so:
aiMaterial* mtl = scene->mMaterials[m];
ai_real bm = 1.0;
aiReturn rc = aiReturn_SUCCESS;

if( mtl->GetTexture(aiTextureType_NORMALS, texIndex, &path) == AI_SUCCESS) {
rc = aiGetMaterialFloat(mtl, AI_MATKEY_OBJ_BUMPMULT_NORMALS(0), &bm);
}
else if(mtl->GetTexture(aiTextureType_HEIGHT, texIndex, &path) == AI_SUCCESS) {
rc = aiGetMaterialFloat(mtl, AI_MATKEY_OBJ_BUMPMULT_HEIGHT(0), &bm);
}

@kimkulling kimkulling merged commit a346882 into assimp:master Feb 20, 2022
@kimkulling
Copy link
Member

Merged, thanks a lot for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants