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:
parent
cf65d1f204
commit
fa015f7fb5
@ -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);
|
||||
|
||||
2
source/external/three.converter.js
vendored
2
source/external/three.converter.js
vendored
@ -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,
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user