Add support for importing material emissive and roughness from fbx file
#2153
This commit is contained in:
@@ -622,9 +622,21 @@ bool MaterialSlotEntry::UsesProperties() const
|
||||
Emissive.TextureIndex != -1 ||
|
||||
!Math::IsOne(Opacity.Value) ||
|
||||
Opacity.TextureIndex != -1 ||
|
||||
Math::NotNearEqual(Roughness.Value, 0.5f) ||
|
||||
Roughness.TextureIndex != -1 ||
|
||||
Normals.TextureIndex != -1;
|
||||
}
|
||||
|
||||
float MaterialSlotEntry::ShininessToRoughness(float shininess)
|
||||
{
|
||||
// https://github.com/assimp/assimp/issues/4573
|
||||
const float a = -1.0f;
|
||||
const float b = 2.0f;
|
||||
const float c = (shininess / 100) - 1;
|
||||
const float d = b * b - (4 * a * c);
|
||||
return (-b + Math::Sqrt(d)) / (2 * a);
|
||||
}
|
||||
|
||||
ModelLodData::~ModelLodData()
|
||||
{
|
||||
Meshes.ClearDelete();
|
||||
|
||||
@@ -356,6 +356,12 @@ struct FLAXENGINE_API MaterialSlotEntry
|
||||
int32 TextureIndex = -1;
|
||||
} Opacity;
|
||||
|
||||
struct
|
||||
{
|
||||
float Value = 0.5f;
|
||||
int32 TextureIndex = -1;
|
||||
} Roughness;
|
||||
|
||||
struct
|
||||
{
|
||||
int32 TextureIndex = -1;
|
||||
@@ -364,6 +370,7 @@ struct FLAXENGINE_API MaterialSlotEntry
|
||||
bool TwoSided = false;
|
||||
|
||||
bool UsesProperties() const;
|
||||
static float ShininessToRoughness(float shininess);
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user