最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin0浏览0评论

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/

发布评论

评论列表(0)

  1. 暂无评论