Three.js指出光影不在哪里?

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (1)
  • 关注 (0)
  • 查看 (91)

物体和阴影之间存在差距。这对于聚光灯没有任何问题。任何人有任何想法我可以解决这个问题?

主要片段:

  //MATERIAL
  var material = new THREE.MeshLambertMaterial();
  var terrainMaterial = new THREE.MeshStandardMaterial();

  //GEOMETRY
  var geometry = new THREE.BoxGeometry(100, 100, 100, 10, 10, 10);
  var terrainGeometry = new THREE.PlaneGeometry(10000, 10000, 100, 100);

  var mesh = new THREE.Mesh(geometry, material);
  mesh.position.z = -500;
  mesh.position.x = -100;
  mesh.position.y = -50;
  scene.add(mesh);

  var terrain = new THREE.Mesh(terrainGeometry, terrainMaterial);
  terrain.rotation.x = -90 * (Math.PI / 180);
  terrain.position.y = -100;
  scene.add(terrain);


  // pointlight
  var light = new THREE.PointLight(0xffffff, 2.0, 1200);
  scene.add(light);
  var pointLightHelper = new THREE.PointLightHelper(light);
  scene.add(pointLightHelper);

  light.position.y = 100;
  light.target = mesh;
  light.castShadow = true;
  light.shadow = new THREE.LightShadow( new THREE.PerspectiveCamera( 100, 1, 500, 1000 ) );
  light.shadow.bias = 0.0001;
  light.shadow.mapSize.width = 512;
  light.shadow.mapSize.height = 512;
  scene.add(light);

  mesh.castShadow = true;
  terrain.receiveShadow = true;
提问于
用户回答回答于

尝试使用较小的偏差值。试着将光线移近或移开,看看这是如何改变的。尝试将影子分辨率调整为1024或2048。

所属标签

可能回答问题的人

  • 腾讯云数据库 TencentDB

    腾讯云 · 产品团队 (已认证)

    302 粉丝2 提问51 回答
  • EatRice

    17 粉丝0 提问183 回答
  • 华讯云

    1 粉丝0 提问156 回答
  • 成都加米谷大数据

    11 粉丝0 提问16 回答

扫码关注云+社区

领取腾讯云代金券