问题蒙上阴影

时间:2019-09-10 11:10:54

标签: three.js

我希望我的 tableBoard (桌子的表面)和 tableLegs 将阴影投射在地板

Current Look

import * as THREE from "three";

export default ({ scene }) => {
    const lights = [];
    lights[0] = new THREE.PointLight(0xffffff, 1, 0);
    lights[0].position.set(0, 200, 0);
    lights[0].castShadow = true;
    scene.add(lights[0]);
  }

对象(网格)

    tableLeg1.castShadow = true;
    tableBoard.castShadow = true;
    floor.receiveShadow = true;

    tableLeg1.add(floor);
    tableBoard.add(tableLeg1);
    scene.add(tableBoard);

渲染器

  sceneSetup = () => {
    const width = this.el.clientWidth;
    const height = this.el.clientHeight;
    this.scene = new THREE.Scene();
    this.camera = new THREE.PerspectiveCamera(75, width / height, 0.1, 1000);
    this.camera.position.z = 5;
    this.controls = new OrbitControls(this.camera, this.el);
    this.renderer = new THREE.WebGLRenderer({antialias: true});
    this.renderer.shadowMap.enabled = true;
    this.renderer.setSize(width, height);
    this.el.appendChild(this.renderer.domElement);
  };

0 个答案:

没有答案