Is it possible to rotate shadow map in Three.js? -
i have plane ground rectangle rotated 90 degrees. , have directionallight cast shadow on plane. @ simple code example:
var 3 = new function () { var scene = new three.scene() var camera = new three.perspectivecamera(45, window.innerwidth / window.innerheight, 1, 1000) camera.position.set(-380, 252, 420); camera.rotation.order = 'yxz'; camera.rotation.y = -math.pi / 4; camera.rotation.x = math.atan(-1 / math.sqrt(2)); var renderer = new three.webglrenderer() renderer.setsize(window.innerwidth, window.innerheight); renderer.shadowmapenabled = true var light = new three.directionallight(0xffffff, 1) light.position.set(150, 100, 100) light.castshadow = true light.shadowdarkness = 0.3 light.shadowcameravisible = true light.shadowcameraright = 50; light.shadowcameraleft = -50; light.shadowcameratop = 50; light.shadowcamerabottom = -50; scene.add(light); var ground = new three.mesh( new three.planebuffergeometry(436, 624), new three.meshlambertmaterial({color: '#808080'}) ); ground.rotation.x = -math.pi / 2; ground.receiveshadow = true scene.add(ground); this.init = function () { $('body').append(renderer.domelement); three.render(); } this.render = function () { requestanimationframe(three.render); renderer.render(scene, camera); }; } $(document).ready(function () { three.init(); });
ground mesh rotated 90 degree. can rotate light shadow map? match rotation of ground?
fiddle: http://jsfiddle.net/95t964o0/33/
Comments
Post a Comment