I'm trying to use shadowCascade for directional lights. Using any code of the examples mentioned in https://github.com/mrdoob/three.js/issues/1888 results in a shader error + a periodical error Object [object Object] has no method 'decompose'
.
Since it's a seldomly used and undocumented feature I have no clue where to even begin with debugging.
Even leaving all the code out and enabling shadowCascade in the console for the light while the scene is running results in the periodical error from above showing up.
Any help would be greatly appreciated!
Kind regards, Doidel
PS: People always want to see some code. So here's some code.
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));