全部。
我正在使用three.js 127,按照文档添加SpotLight。但是,阴影不会显示在场景中。下面,你可以找到我的场景。我已经将平面设置为接收阴影以及其他能够投射阴影的元素,但场景上没有渲染阴影。
{if $listing.pagination.total_items > 1}
{l s='There are %product_count% products.' d='Shop.Theme.Catalog' sprintf=['%product_count%' => $listing.pagination.total_items]}
{else}
{l s='There is 1 product.' d='Shop.Theme.Catalog'}
{/if}
我是否缺少一些东西来渲染阴影?
答案 0 :(得分:0)
我从您的代码中注意到一些可能导致此问题的事情:
renderer.shadowMap.enabled = true;
这部分似乎没有出现在您链接的 SpotLight 文档中,有关这方面的更多信息可以在 SpotLightShadow 的文档中找到。
import { OrbitControls } from 'https://cdn.jsdelivr.net/npm/three@0.127/examples/jsm/controls/OrbitControls.js';
...
spotLight.position.set(8, 40, 40); // Third parameter (z) with value of 80 was too far away
controls = new OrbitControls(camera, renderer.domElement);
helper = new THREE.PointLightHelper(pointLight);
scene.add(helper);
这是固定版本的 JSFiddle:https://jsfiddle.net/tombugolya/hx61L5vp/17/