javascript - Why is the shadow in the wrong place? (Three.js) - Stack Overflow

I have a green plane, and a red cube over it. The light is a directional light.Why is the shadow in the

I have a green plane, and a red cube over it. The light is a directional light.

Why is the shadow in the wrong place? Code: /


Edit:

If I change the light.shadowBias then the shadow on the plane is correct, but the shadow is on the cube incorrect:

/

Thanks in advance,

I have a green plane, and a red cube over it. The light is a directional light.

Why is the shadow in the wrong place? Code: http://jsfiddle/pD8dn/


Edit:

If I change the light.shadowBias then the shadow on the plane is correct, but the shadow is on the cube incorrect:

http://jsfiddle/pD8dn/4/

Thanks in advance,

Share Improve this question edited Jun 20, 2012 at 16:15 eqiproo asked Jun 20, 2012 at 11:05 eqiprooeqiproo 1,8164 gold badges18 silver badges18 bronze badges 1
  • @EmilVikström Here it is: jsfiddle/pD8dn – eqiproo Commented Jun 20, 2012 at 12:16
Add a ment  | 

1 Answer 1

Reset to default 6

This is one of the most mon artefacts for shadow maps, it's called "Peter Panning".

A workaround is to add some small bias for depth testing:

light.shadowBias = 0.001;

Exact value of the bias needs to be tuned for each scene (and unfortunately sometimes you'll not be able to get rid of all artefacts everywhere, tuning shadow maps is more art than science).

This is what works for your example:

http://jsfiddle/pD8dn/2/

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745423911a4627088.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信