MeshPhongMaterial's shininess should be between 0.0 and 100.0, so I modified the conversion and all of the importers accordingly.

This commit is contained in:
Viktor Kovacs 2021-04-17 12:45:40 +02:00
parent cf65d1f204
commit fa015f7fb5
4 changed files with 5 additions and 5 deletions

View File

@ -44,7 +44,7 @@ OV.ExporterObj = class extends OV.ExporterBase
mtlWriter.WriteArrayLine (['Ka', material.ambient.r / 255.0, material.ambient.g / 255.0, material.ambient.b / 255.0]);
mtlWriter.WriteArrayLine (['Kd', material.diffuse.r / 255.0, material.diffuse.g / 255.0, material.diffuse.b / 255.0]);
mtlWriter.WriteArrayLine (['Ks', material.specular.r / 255.0, material.specular.g / 255.0, material.specular.b / 255.0]);
mtlWriter.WriteArrayLine (['Ns', material.shininess * 100.0]);
mtlWriter.WriteArrayLine (['Ns', material.shininess * 1000.0]);
mtlWriter.WriteArrayLine (['d', material.opacity]);
WriteTexture (mtlWriter, 'map_Kd', material.diffuseMap, files);
WriteTexture (mtlWriter, 'map_Ks', material.specularMap, files);

View File

@ -39,7 +39,7 @@ OV.ConvertModelToThreeMeshes = function (model, callbacks)
color : diffuseColor,
specular : specularColor,
emissive : emissiveColor,
shininess : material.shininess * 10.0,
shininess : material.shininess * 100.0,
opacity : material.opacity,
transparent : material.transparent,
alphaTest : material.alphaTest,

View File

@ -163,8 +163,8 @@ OV.Importer3ds = class extends OV.ImporterBase
}
});
if (shininess !== null || shininessStrength !== null) {
material.shininess = shininess * shininessStrength;
if (shininess !== null && shininessStrength !== null) {
material.shininess = shininess * shininessStrength / 10.0;
}
let materialIndex = this.model.AddMaterial (material);
this.materialNameToIndex[material.name] = materialIndex;

View File

@ -258,7 +258,7 @@ OV.ImporterObj = class extends OV.ImporterBase
if (this.currentMaterial === null || parameters.length < 1) {
return true;
}
this.currentMaterial.shininess = parseFloat (parameters[0]) / 100.0;
this.currentMaterial.shininess = parseFloat (parameters[0]) / 1000.0;
return true;
} else if (keyword === 'tr') {
if (this.currentMaterial === null || parameters.length < 1) {