【问题标题】:Three.js Loaded Model Missing Bump and Specular MapsThree.js 加载的模型缺少凹凸和高光贴图
【发布时间】:2014-04-06 04:51:16
【问题描述】:

我无法在 three.js 中对导入的模型进行凹凸和高光贴图。

我将模型从 3DS Max 导出到 .obj 文件,然后使用 convert_obj_three.py 脚本将其转换为 .js。在 model.js 文件中,我可以看到凹凸贴图和高光贴图正在出现:

"materials": [  {
    "DbgColor" : 15658734,
    "DbgIndex" : 0,
    "DbgName" : "flloor_bump_test",
    "illumination" : 2,
    "mapAmbient" : "sat_8.jpg",
    "mapBump" : "sat_8_bump.jpg",
    "mapDiffuse" : "sat_8.jpg",
    "mapSpecular" : "sat_8_spec.png",
    "opticalDensity" : 1.5,
    "specularCoef" : 25.0,
    "transparency" : 0.0
},

这是我将模型加载到场景中的方式:

var jsonLoader = new THREE.JSONLoader();
jsonLoader.load( "model.js", addModelToScene );

function addModelToScene( geometry, materials )
{
    var material = new THREE.MeshFaceMaterial( materials );
    model = new THREE.Mesh( geometry, material );
    model.scale.set(0.01,0.01,0.01);

    model.castShadow = true;
    model.receiveShadow = true;

    scene.add( model );
}

任何想法都非常感谢!谢谢!!

编辑

这是我的现场演示的链接 - http://benbeckford.com/temp/

编辑 2

所以在玩了之后我可以看到转换后的.js模型中缺少以下数据:

"shading" : "phong",
"mapSpecular" : "powerday_sat_8_specular.png",
"shininess" : 1000,
"mapBumpScale" : 5,

所以很明显我从 Max 到 .obj 的导出,或者 .obj 到 .js 的转换存在问题。如果有人解决了这个问题,我将非常感谢你是如何做到的!谢谢:)

【问题讨论】:

  • 您是否有任何理由要转换为 js 而不仅仅是使用 OBJLoader 类加载 .obj 文件?您是否有任何理由使用 MeshFaceMaterial 而不是 MeshPhongMaterial 之类的东西?
  • materials 数组中有哪些材质类型?必须是Phong
  • 嗨@2pha:OBJLoader 类不加载纹理,尝试使用OBJMTLLoader,然后我丢失凹凸贴图和高光贴图并且模型不会投射阴影如果我替换@987654329 @ 和 MeshPhongMaterial 然后纹理根本不会出现(它只是全白)。
  • 嗨@WestLangley,加载的材质数组中充满了MeshLambertMaterial 类型的材质,但是当我从3DS Max 导出时它们设置为Phong
  • 你能提供一个非常简单的实例吗?

标签: javascript three.js 3dsmax .obj


【解决方案1】:

我最终手动编辑了 .js 模型并添加了字段使其如下所示:

"materials": [  {
    "DbgColor" : 15658734,
    "DbgIndex" : 0,
    "DbgName" : "21___Default",
    "colorAmbient" : [0.588235, 0.588235, 0.588235],
    "colorDiffuse" : [0.588235, 0.588235, 0.588235],
    "colorSpecular" : [0.117, 0.117, 0.117],
    "illumination" : 2,
    "mapAmbient" : "texture_8.jpg",
    "mapDiffuse" : "texture_8.jpg",
    "shading" : "phong",
    "mapSpecular" : "texture_8_specular.png",
    "shininess" : 1000,
    "mapBumpScale" : 5,
    "mapBump" : "texture_8_bump.jpg",
    "opticalDensity" : 1.5,
    "specularCoef" : 1000,
    "transparency" : 0.0
}

【讨论】:

  • 光泽度 = specularCoef
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-01-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多