Three.js - 关闭光照阴影

Three.js - Turn of shadows on lighting

我有几个以 json 格式导入的 3D 对象,它们被分组以作为一个对象回答。有什么办法可以完全没有阴影地照亮这个物体吗?我只想让用户看到该对象尽可能干净。 这是一些代码:

function initMesh(x, y, z) {
group = new THREE.Object3D();
var loader = new THREE.JSONLoader();
loader.load('vasi.js', function(geometry, materials) {
    mesh = new THREE.Mesh(geometry, new THREE.MeshFaceMaterial(materials));
    mesh.scale.x = x;
    mesh.scale.y = y;
    mesh.scale.z = z;
    mesh.opacity=1;
    var model = new THREE.Object3D();
    model.add(mesh);
    model.position.set(0,0,0);
    //mesh.translation = THREE.GeometryUtils.center(geometry);
    group.add(model);
});
loader.load('mikrespleures.js', function(geometry, materials) {
    mesh1 = new THREE.Mesh(geometry, new THREE.MeshFaceMaterial(materials));
    mesh1.scale.x = x;
    mesh1.scale.y = y;
    mesh1.scale.z = z;
    mesh1.opacity=1;
    var model1 = new THREE.Object3D();
    model1.add(mesh1);
    model1.position.set(0,0,0);
    //mesh1.translation = THREE.GeometryUtils.center(geometry);
    group.add(model1);
});
loader.load('megalespleures.js', function(geometry, materials) {
    mesh2 = new THREE.Mesh(geometry, new THREE.MeshFaceMaterial(materials));
    mesh2.scale.x = x;
    mesh2.scale.y = y;
    mesh2.scale.z = z;
    mesh2.opacity=1;
    var model2 = new THREE.Object3D();
    model2.add(mesh2);
    model2.position.set(0,0,0);
    //mesh1.translation = THREE.GeometryUtils.center(geometry);
    group.add(model2);
});
scene.add(group);}

function initLights() {
var light;  // A light shining from the direction of the camera.
light = new THREE.DirectionalLight();
light.position.set(0,100,10);
group.castShadow = false;
group.receiveShadow = false;
scene.add(light);   

}

谢谢!

您可以将 castShadow 和 receiveShadow 标志设置为 false。

function initMesh(x, y, z) {
group = new THREE.Object3D();
var loader = new THREE.JSONLoader();
loader.load('vasi.js', function(geometry, materials) {
    mesh = new THREE.Mesh(geometry, new THREE.MeshFaceMaterial(materials));
    mesh.scale.x = x;
    mesh.scale.y = y;
    mesh.scale.z = z;
    mesh.opacity=1;
    mesh.castShadow = false;
    var model = new THREE.Object3D();
    model.add(mesh);
    model.position.set(0,0,0);
    //mesh.translation = THREE.GeometryUtils.center(geometry);
    group.add(model);
});
loader.load('mikrespleures.js', function(geometry, materials) {
    mesh1 = new THREE.Mesh(geometry, new THREE.MeshFaceMaterial(materials));
    mesh1.scale.x = x;
    mesh1.scale.y = y;
    mesh1.scale.z = z;
    mesh1.opacity=1;
    mesh1.castShadow = false;
    var model1 = new THREE.Object3D();
    model1.add(mesh1);
    model1.position.set(0,0,0);
    //mesh1.translation = THREE.GeometryUtils.center(geometry);
    group.add(model1);
});
loader.load('megalespleures.js', function(geometry, materials) {
    mesh2 = new THREE.Mesh(geometry, new THREE.MeshFaceMaterial(materials));
    mesh2.scale.x = x;
    mesh2.scale.y = y;
    mesh2.scale.z = z;
    mesh2.opacity=1;
    mesh2.castShadow = false;
    var model2 = new THREE.Object3D();
    model2.add(mesh2);
    model2.position.set(0,0,0);
    //mesh1.translation = THREE.GeometryUtils.center(geometry);
    group.add(model2);
});
scene.add(group);
}

function initLights() {
var light;  // A light shining from the direction of the camera.
light = new THREE.DirectionalLight();
light.position.set(0,100,10);
group.castShadow = false;
group.receiveShadow = false;
scene.add(light);   
}