0

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));
Doidel
  • 1,743
  • 1
  • 14
  • 22
  • Does this work: http://threejs.org/examples/webgl_morphtargets_md2_control.html ? – WestLangley Jun 23 '13 at 22:50
  • Uhm that's one of the two examples mentioned in the thread I linked. But yeah, that one doesn't work too if I copy it 1:1. You don't have these errors? Does the light work for you? – Doidel Jun 24 '13 at 11:25
  • I linked to a three.js example that works with the current version r.58. You linked to to a different site, using a three.js version that is a year old. You are most likely linking to an old version of the three.js library. Use r.58. – WestLangley Jun 24 '13 at 12:49
  • Hmm I happened to have r58 already. And now I took the code from that demo 1:1 and I still get the same issues.. I'll search on, maybe I find something. Or I'll post some progress if I don't find anything... – Doidel Jun 24 '13 at 15:58
  • Ok here's my console output: http://pastebin.com/ywv6XbmE – Doidel Jun 24 '13 at 16:05
  • Yes, the three.js r.58 demo works for me, excpet for a visual [bug](https://code.google.com/p/chromium/issues/detail?id=225578) using Chrome 27. – WestLangley Jun 24 '13 at 16:35
  • Look at line 307 then 313-317 of my pastebin. Does that make any sense to you..? But strangely nowhere in the code "max shadows" is set, in the example! – Doidel Jun 27 '13 at 05:57
  • Lines 313-317 are mostly blank. Can you provide a live link to your example? – WestLangley Jun 27 '13 at 11:54

1 Answers1

0

There was another discussion about the usage of shadowCascade with the conclusion to currently not use shadowCascade, due to not being maintained.

Community
  • 1
  • 1
Doidel
  • 1,743
  • 1
  • 14
  • 22