# Is it possible to get light intensity of each ray at run time?

**URL:** <https://forums.unrealengine.com/t/is-it-possible-to-get-light-intensity-of-each-ray-at-run-time/1420530>\
**Category:** Rendering\
**Tags:** unreal-engine, question\
**Created:** [November 25, 2023, 5:56pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-get-light-intensity-of-each-ray-at-run-time/1420530 "2023-11-25T17:56:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nonlin](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nonlin](https://forums.unrealengine.com/u/Nonlin)\
**Post date:** [November 25, 2023, 5:56pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-get-light-intensity-of-each-ray-at-run-time/1420530/1 "2023-11-25T17:56:53Z")

</div>

It would be to determine when something is in a shadow or not.

I know I can get by to some extent with a scene capture but with UE5 it seems like it should be doing a lot of this under the hood but I don’t know what’s exposed or needs manually exposing.

---

<div class="post-metadata">

**Author:** ![SupportiveEntity](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SupportiveEntity](https://forums.unrealengine.com/u/SupportiveEntity)\
**Post date:** [November 26, 2023, 8:36pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-get-light-intensity-of-each-ray-at-run-time/1420530/2 "2023-11-26T20:36:15Z")

</div>

Hey there @Nonlin! So it’d be quite the feat to check for light level, as this data is already GPU side, so the simple answer is that it’s a ton of effort and often best faked.

> [@Measure Brightness of Light on Actor](https://forums.unrealengine.com/t/measure-brightness-of-light-on-actor/461763/7):
>
> Trace from the character to the lightsource if the trace reaches the light then the character is lit, else it is in shadow. I’ve seen people trace from sockets attached to the character to get a better representation than using a single trace. To determine the quantity of light hitting the character you would calculate that based on the light’s falloff and intensity. Won’t account for indirect lighting. There are tutorials all over youtube for this btw, and plugins on the marketplace.

---

<div class="post-metadata">

**Author:** ![Nonlin](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nonlin](https://forums.unrealengine.com/u/Nonlin)\
**Post date:** [November 26, 2023, 8:47pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-get-light-intensity-of-each-ray-at-run-time/1420530/3 "2023-11-26T20:47:45Z")

</div>

Thanks for the input.

Would be nice if these feature get exposed to be accessed to make some newt Simulations or game mechanics.

Does seem like overkill for the moment but may take a deeper dive one day.

---

<div class="post-metadata">

**Author:** ![SupportiveEntity](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SupportiveEntity](https://forums.unrealengine.com/u/SupportiveEntity)\
**Post date:** [November 26, 2023, 10:12pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-get-light-intensity-of-each-ray-at-run-time/1420530/4 "2023-11-26T22:12:50Z")

</div>

Absolutely! Since the source is available, it’s entirely possible, but would require some solid software engineering props to do effectively. The complexity is compounded by the fact there’s multiple overlapping lighting systems at play.

---

<div class="post-metadata">

**Author:** ![BananableOffense](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BananableOffense](https://forums.unrealengine.com/u/BananableOffense)\
**Post date:** [November 27, 2023, 4:48am UTC](https://forums.unrealengine.com/t/is-it-possible-to-get-light-intensity-of-each-ray-at-run-time/1420530/5 "2023-11-27T04:48:49Z")

</div>

And while technically possible, it is quite expensive to pass data backwards from the GPU to the CPU, especially at large scales. This is why the method most take is to capture a texture (render target) that coarsely represents the scene, which can then be sampled on the CPU.

---

<div class="post-metadata">

**Author:** ![SupportiveEntity](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SupportiveEntity](https://forums.unrealengine.com/u/SupportiveEntity)\
**Post date:** [November 27, 2023, 8:52am UTC](https://forums.unrealengine.com/t/is-it-possible-to-get-light-intensity-of-each-ray-at-run-time/1420530/6 "2023-11-27T08:52:07Z")

</div>

Agree 100% here, scene captures are a common method users use for this, however scene captures are also quite expensive resource wise if you have to update them constantly.
