【发布时间】:2015-05-07 04:35:37
【问题描述】:
我现在尝试了几种不同的灯光(定向、点、点),但它们都没有在 MeshFaceMaterial 对象上产生漂亮的阴影。相反,整个 MeshFaceMaterial 对象将变为黑色。
My Test Website(请持保留态度,不断变化)。
如何使用灯光在 MeshFaceMaterials 上创建阴影? MeshFaceMaterial 是否支持阴影? documentation 表示“使用 MeshLambertMaterial 或 MeshPhongMaterial 影响对象。”
这是我如何加载 .json 模型的示例代码。
loader.load('sample-concrete.js', function ( geometry, materials ) {
mesh1 = new THREE.Mesh(
geometry, new THREE.MeshFaceMaterial( materials )
);
mesh1.rotation.x = -Math.PI / 2;
scene.add( mesh1 );
});
这是我的 .json 文件中的材料示例。
"materials": [
{
"DbgIndex" : 0,
"DbgName" : "Steel",
"colorDiffuse" : [0.3059, 0.0471, 0.0471],
"colorAmbient" : [0.3059, 0.0471, 0.0471],
"colorSpecular" : [1.0000, 1.0000, 1.0000],
"transparency" : 1.0,
"specularCoef" : 25.0,
"vertexColors" : false
}
谢谢。
【问题讨论】:
-
First
HemisphereLight不支持阴影。只有DirectionalLight和SpotLight。那么你所有的.castShadow都是假的,所以他们永远不会投下阴影。 -
是的,我知道 HemisphereLight 不支持阴影。 DirectionalLight 和 SpotLight 不适用于 MeshFaceMaterial。
-
在我看来它是在投射阴影。 @gaitat,你应该把你的评论作为我认为的答案。
-
我上面关于 DirectionalLight 和 SpotLight 不起作用的评论是不正确的。他们似乎确实在工作。
标签: javascript three.js