0

我正在尝试将 shadowCascade 用于定向灯。使用https://github.com/mrdoob/three.js/issues/1888中提到的示例的任何代码都会导致着色器错误 + 周期性错误Object [object Object] has no method 'decompose'。由于它是一个很少使用且未记录的功能,我什至不知道从哪里开始调试。即使在场景运行时保留所有代码并在控制台中为灯光启用 shadowCascade 也会导致上面出现的周期性错误。

任何帮助将不胜感激!

亲切的问候, Doidel

PS:人们总是希望看到一些代码。所以这里有一些代码。

var sunlight = new THREE.DirectionalLight();
sunlight.intensity = 0.5;
sunlight.position.set(100, 300, 100);
sunlight.castShadow = true;
sunlight.shadowBias = -0.0001;
sunlight.shadowMapWidth = sunlight.shadowMapHeight = 2048;
sunlight.shadowDarkness = 0.7;

var d = 250;
sunlight.shadowCameraLeft = -d;
sunlight.shadowCameraRight = d;
sunlight.shadowCameraTop = d;
sunlight.shadowCameraBottom = -d;
sunlight.shadowCameraNear = 200;
sunlight.shadowCameraFar = 800;

sunlight.shadowDarkness = 0.6;
sunlight.shadowBias = 0.000065;

sunlight.shadowCascade = true;
sunlight.shadowCascadeCount = 3;

sunlight.shadowCascadeNearZ = [ -1.000, 0.9, 0.975 ];
sunlight.shadowCascadeFarZ  = [  0.9, 0.975, 1.000 ];
sunlight.shadowCascadeWidth = [ 2048, 2048, 2048 ];
sunlight.shadowCascadeHeight = [ 2048, 2048, 2048 ];
sunlight.shadowCascadeBias = [ 0.00005, 0.000065, 0.000065 ];

sunlight.shadowCascadeOffset.set( 0, 0, -10 );

scene.add( sunlight );
sunlight.lookAt(new THREE.Vector3(0,0,0));
4

1 回答 1

0

关于 shadowCascade 的使用还有另一个讨论,结论是目前不使用 shadowCascade,因为没有维护。

于 2014-03-19T12:49:05.623 回答