# Understanding shadowMap.camera

**URL:** <https://discourse.threejs.org/t/understanding-shadowmap-camera/1032>\
**Category:** Questions\
**Tags:** shadows, shadow-material\
**Created:** [October 17, 2017, 12:33am UTC](https://discourse.threejs.org/t/understanding-shadowmap-camera/1032 "2017-10-17T00:33:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![trusktr](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/trusktr/32/13726_2.png) [@trusktr](https://discourse.threejs.org/u/trusktr)\
**Post date:** [October 17, 2017, 12:33am UTC](https://discourse.threejs.org/t/understanding-shadowmap-camera/1032/1 "2017-10-17T00:33:37Z")

</div>

If I take a guess, the shadow map camera is the one from the light’s perspective? So then the `far` value for that camera determines how far away shadows can appear? If objects are further than that from a light, the shadows don’t appear?

Did I guess right?

(I’ll play around with it to try to decipher it)

---

<div class="post-metadata">

**Author:** ![TheCodeCrafter](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/thecodecrafter/32/50_2.png) [@TheCodeCrafter](https://discourse.threejs.org/u/TheCodeCrafter)\
**Post date:** [October 17, 2017, 2:55pm UTC](https://discourse.threejs.org/t/understanding-shadowmap-camera/1032/2 "2017-10-17T14:55:37Z")

</div>

> [@trusktr](#):
>
> If I take a guess, the shadow map camera is the one from the light’s perspective? So then the far value for that camera determines how far away shadows can appear? If objects are further than that from a light, the shadows don’t appear?

@trusktr

Yes, that is the purpose of `far`. It says basically how far away the shadow is even relevant plus it’s comparison to other lights (the sun outdoes a simple lamp, so the lamp wont cast any shadow). So it’s not only distance, but almost like power.

```
light.shadow.mapSize.width = 512; // default
light.shadow.mapSize.height = 512; // default
light.shadow.camera.near = 0.5; // default
light.shadow.camera.far = 500 // default

```

I hope that answers your question 🙂

---

<div class="post-metadata">

**Author:** ![trusktr](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/trusktr/32/13726_2.png) [@trusktr](https://discourse.threejs.org/u/trusktr)\
**Post date:** [October 17, 2017, 6:20pm UTC](https://discourse.threejs.org/t/understanding-shadowmap-camera/1032/3 "2017-10-17T18:20:51Z")

</div>

> [@TheCodeCrafter](#):
>
> light.shadow.camera.far

Cool, thanks for painting that picture @TheCodeCrafter. Do you mean `light.shadow.camera.far` is like power? Does the shadow abruptly cut off after that point?

So (I’m guessing) in our scenes we need to take care to make sure the light camera always encompasses the objects that shadow will be rendered on, otherwise the Z clipping of the shadow area could cause irregular shadow shapes on the receiving objects if they are intersecting with the `far` plane of the light camera.

Interesting. I’m trying to make things easy in [my API](https://github.com/trusktr/infamous), so I think what I’ll do is somehow allow the user to specify a light, which objects are receivers of shadows from that light, then my API internally would adjust the light camera dimensions to make sure it automatically encompasses the furthest object. I want the dev experience to be super simple (for HTML devs that may not know much JavaScript let alone how to write an algorithm to dynamically adjust the camera frustum).

---

<div class="post-metadata">

**Author:** ![TheCodeCrafter](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/thecodecrafter/32/50_2.png) [@TheCodeCrafter](https://discourse.threejs.org/u/TheCodeCrafter)\
**Post date:** [October 17, 2017, 8:06pm UTC](https://discourse.threejs.org/t/understanding-shadowmap-camera/1032/4 "2017-10-17T20:06:41Z")

</div>

> [@trusktr](#):
>
> Does the shadow abruptly cut off after that point?

No, like I said, that represents the _power_ of such, it isn’t a hard distance. So, there is still smooth lighting.

---

<div class="post-metadata">

**Author:** ![looeee](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/looeee/32/59_2.png) [@looeee](https://discourse.threejs.org/u/looeee)\
**Post date:** [October 18, 2017, 1:44am UTC](https://discourse.threejs.org/t/understanding-shadowmap-camera/1032/5 "2017-10-18T01:44:30Z")

</div>

@TheCodeCrafter Have you tested that? As far as I know, shadows will cut off abruptly after the `shadow.camera.far` point.
