javascript - How to improve shadow quality in three.js - Stack Overflow

I have several object in a scene. And I want them moving on a wide plane, which will receive shadows. I

I have several object in a scene. And I want them moving on a wide plane, which will receive shadows. If I use only one point light or a very large directional light the shadow of a object when it moved to the corner will bee very rough (rough shadow edge) . like this:

So I’m wondering should I use a light for every object above them and follow them in order to cast a high quality shadow edge? And in some case I can not set the shadow.mapsize higher .

I have several object in a scene. And I want them moving on a wide plane, which will receive shadows. If I use only one point light or a very large directional light the shadow of a object when it moved to the corner will bee very rough (rough shadow edge) . like this:

So I’m wondering should I use a light for every object above them and follow them in order to cast a high quality shadow edge? And in some case I can not set the shadow.mapsize higher .

Share Improve this question asked Mar 17, 2018 at 3:39 欧阳维杰欧阳维杰 1,7681 gold badge17 silver badges26 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

There are a number of things that control shadow quality.

What it looks like to me, is your shadow cameras left / right / top / bottom are set too large, and its casting the shadow over too large an area.

Shadow casting lights are pretty expensive, so I would avoid trying to pensate by having multiple lights.

Try reducing the light.shadow.camera left/right/top/bottom to focus the map better on where you're objects are. Also trying increasing shadowmap size to something like 1024 or 2048 square.

Another thing that helps is to use THREE.PCFShadowmapping instead of the default. That will smooth the edges of your shadows.

edit: Also check out PCFSoftShadowMapping.. slower to render, but greatly smooths shadow edges.

Getting the shadow mapping right is a tricky process and requires a lot of fiddling.

Also, try attaching a DirectionalLightHelper to your light and also a CameraHelper to the lights camera. Those will help you figure out how big the shadow casting area is and where things are pointing.

https://i.sstatic/LQz2Z.jpg

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

相关推荐

  • javascript - How to improve shadow quality in three.js - Stack Overflow

    I have several object in a scene. And I want them moving on a wide plane, which will receive shadows. I

    9小时前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

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

关注微信