3d model .OBJ File loading error
in mtl file
newmtl ShinyMaterial
Ka 1.0 1.0 1.0
Kd 0.8 0.8 0.8
Ks 1.0 1.0 1.0
Ns 500.0 # Shininess (Specular Exponent: 0 ~ 1000)
but in unit GLS.Material
TGLShininess = 0..128;
so value mapping error
TGLShininess = 0..128
mtl (obj) = 0..1000
so
i tried temporary MapValue function
function MapValue(Value, Min1, Max1, Min2, Max2: Double): Double;
begin
if Max1 = Min1 then
begin
Result := Min2;
Exit;
end;
Result := Min2 + (Value - Min1) * (Max2 - Min2) / (Max1 - Min1);
end;
and
function GetOrAllocateMaterial(const libName, matName: string): string;
...
//Shininess := StrToIntDef(objMtl.MaterialStringProperty(matName, 'Ns'), 1); // previous code
// Fix by funnyhong
var iTemp : Integer;
iTemp := StrToIntDef(objMtl.MaterialStringProperty(matName, 'Ns'), 1);
Shininess := Round(MapValue(iTemp, 0, 1000, 0, 128));
...
end;
I would like to express my sincere gratitude to the GLXEngine production team.
good luck
3d model .OBJ File loading error
in mtl file
newmtl ShinyMaterial
Ka 1.0 1.0 1.0
Kd 0.8 0.8 0.8
Ks 1.0 1.0 1.0
Ns 500.0 # Shininess (Specular Exponent: 0 ~ 1000)
but in unit GLS.Material
TGLShininess = 0..128;
so value mapping error
TGLShininess = 0..128
mtl (obj) = 0..1000
so
i tried temporary MapValue function
function MapValue(Value, Min1, Max1, Min2, Max2: Double): Double;
begin
if Max1 = Min1 then
begin
Result := Min2;
Exit;
end;
Result := Min2 + (Value - Min1) * (Max2 - Min2) / (Max1 - Min1);
end;
and
function GetOrAllocateMaterial(const libName, matName: string): string;
...
//Shininess := StrToIntDef(objMtl.MaterialStringProperty(matName, 'Ns'), 1); // previous code
...
end;
I would like to express my sincere gratitude to the GLXEngine production team.
good luck