New 3ds Max PBR Materials in FBX
This commit is contained in:
@@ -2011,12 +2011,25 @@ void FBXConverter::SetTextureProperties(aiMaterial *out_mat, const TextureMap &_
|
||||
TrySetTextureProperties(out_mat, _textures, "Maya|TEX_roughness_map", aiTextureType_DIFFUSE_ROUGHNESS, mesh);
|
||||
TrySetTextureProperties(out_mat, _textures, "Maya|TEX_ao_map", aiTextureType_AMBIENT_OCCLUSION, mesh);
|
||||
|
||||
// 3DSMax PBR
|
||||
// 3DSMax Physical material
|
||||
TrySetTextureProperties(out_mat, _textures, "3dsMax|Parameters|base_color_map", aiTextureType_BASE_COLOR, mesh);
|
||||
TrySetTextureProperties(out_mat, _textures, "3dsMax|Parameters|bump_map", aiTextureType_NORMAL_CAMERA, mesh);
|
||||
TrySetTextureProperties(out_mat, _textures, "3dsMax|Parameters|emission_map", aiTextureType_EMISSION_COLOR, mesh);
|
||||
TrySetTextureProperties(out_mat, _textures, "3dsMax|Parameters|metalness_map", aiTextureType_METALNESS, mesh);
|
||||
TrySetTextureProperties(out_mat, _textures, "3dsMax|Parameters|roughness_map", aiTextureType_DIFFUSE_ROUGHNESS, mesh);
|
||||
|
||||
// 3DSMax PBR materials
|
||||
TrySetTextureProperties(out_mat, _textures, "3dsMax|main|base_color_map", aiTextureType_BASE_COLOR, mesh);
|
||||
TrySetTextureProperties(out_mat, _textures, "3dsMax|main|norm_map", aiTextureType_NORMAL_CAMERA, mesh);
|
||||
TrySetTextureProperties(out_mat, _textures, "3dsMax|main|emit_color_map", aiTextureType_EMISSION_COLOR, mesh);
|
||||
TrySetTextureProperties(out_mat, _textures, "3dsMax|main|ao_map", aiTextureType_AMBIENT_OCCLUSION, mesh);
|
||||
TrySetTextureProperties(out_mat, _textures, "3dsMax|main|opacity_map", aiTextureType_OPACITY, mesh);
|
||||
// Metalness/Roughness mode
|
||||
TrySetTextureProperties(out_mat, _textures, "3dsMax|main|metalness_map", aiTextureType_METALNESS, mesh);
|
||||
TrySetTextureProperties(out_mat, _textures, "3dsMax|main|roughness_map", aiTextureType_DIFFUSE_ROUGHNESS, mesh);
|
||||
// Specular/Gloss mode
|
||||
TrySetTextureProperties(out_mat, _textures, "3dsMax|main|specular_map", aiTextureType_SPECULAR, mesh);
|
||||
TrySetTextureProperties(out_mat, _textures, "3dsMax|main|glossiness_map", aiTextureType_SHININESS, mesh);
|
||||
}
|
||||
|
||||
void FBXConverter::SetTextureProperties(aiMaterial *out_mat, const LayeredTextureMap &layeredTextures, const MeshGeometry *const mesh) {
|
||||
|
||||
@@ -90,7 +90,7 @@ Property* ReadTypedProperty(const Element& element)
|
||||
ai_assert(tok.size() >= 5);
|
||||
return new TypedProperty<bool>(ParseTokenAsInt(*tok[4]) != 0);
|
||||
}
|
||||
else if (!strcmp(cs, "int") || !strcmp(cs, "Int") || !strcmp(cs, "enum") || !strcmp(cs, "Enum")) {
|
||||
else if (!strcmp(cs, "int") || !strcmp(cs, "Int") || !strcmp(cs, "enum") || !strcmp(cs, "Enum") || !strcmp(cs, "Integer")) {
|
||||
ai_assert(tok.size() >= 5);
|
||||
return new TypedProperty<int>(ParseTokenAsInt(*tok[4]));
|
||||
}
|
||||
@@ -121,6 +121,16 @@ Property* ReadTypedProperty(const Element& element)
|
||||
ai_assert(tok.size() >= 5);
|
||||
return new TypedProperty<float>(ParseTokenAsFloat(*tok[4]));
|
||||
}
|
||||
else if (!strcmp(cs, "ColorAndAlpha"))
|
||||
{
|
||||
ai_assert(tok.size() >= 8);
|
||||
return new TypedProperty<aiColor4D>(aiColor4D(
|
||||
ParseTokenAsFloat(*tok[4]),
|
||||
ParseTokenAsFloat(*tok[5]),
|
||||
ParseTokenAsFloat(*tok[6]),
|
||||
ParseTokenAsFloat(*tok[7]))
|
||||
);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user