renderingthree.jswebgldeferredshadows

Three.js - add shadows to area light using Deferred Rendering


I'm using WebGLDeferredRenderer for a simple scene (made by a cube simulating a room and two small cubes for testing shadows) but i can't show any shadows generated from the areaLight used in the scene!

In this demo there are 3 area lights but none of them generate shadows over a single object (they just illuminate the "room").

Is there any particular shader i can use to solve this problem? Or better...is there any chance to cast shadow in deferred rendering? :)


Solution

  • Shadows are not currently supported in three.js r.56 using deferred rendering with WebGLDeferredRenderer.

    Here are two examples where point lights and spot lights cast shadows using deferred rendering in three.js, but they are using a modified version of the library.

    http://alteredqualia.com/three/examples/webgl_deferred_shadowmap.html

    http://alteredqualia.com/three/examples/webgl_deferred_shadowmap_point.html

    There are no examples of area lights yet, however.

    So what you want is doable, just not yet supported, and not with area lights.

    three.js r.56