# Splinter Cell like light meter

**URL:** <https://forums.unrealengine.com/t/splinter-cell-like-light-meter/310493>\
**Category:** Rendering\
**Tags:** unreal-engine, Lighting, question\
**Created:** [March 11, 2015, 2:49pm UTC](https://forums.unrealengine.com/t/splinter-cell-like-light-meter/310493 "2015-03-11T14:49:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Skuvnar](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Skuvnar](https://forums.unrealengine.com/u/Skuvnar)\
**Post date:** [March 11, 2015, 2:49pm UTC](https://forums.unrealengine.com/t/splinter-cell-like-light-meter/310493/1 "2015-03-11T14:49:54Z")

</div>

What are the best options for getting the amount of light that is being cast onto the player character.

I’ve been thinking about it for a while but there are multiple issues with every solution I’ve come up with.

---

<div class="post-metadata">

**Author:** ![Co](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Co](https://forums.unrealengine.com/u/Co)\
**Post date:** [March 11, 2015, 5:31pm UTC](https://forums.unrealengine.com/t/splinter-cell-like-light-meter/310493/2 "2015-03-11T17:31:18Z")

</div>

I faced the same needs and i did like this:

OnBeginPlay: store all Level lights in GameMode with a TArray (to prevent getting lights in tick)

Then i added a special component to my Character that checks these lights during tick according to their type :

- distance then LineTraceTest for PointsLights
- distance then angle then LineTraceTest for SpotLights
- LineTraceTest for DirectionalLights

When the character is computed “visible” from a light i then apply an empiric formula using the light color, intensity and the character position within the light influence (Sphere, Cone).

It is not fantastic but it’s good enough for my need.

The sad part is that in UE3 there was the DynamicLightEnvironmentComponent that did the exact job we’re looking for but it has not been kept in UE4 :’(

---

<div class="post-metadata">

**Author:** ![Skuvnar](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Skuvnar](https://forums.unrealengine.com/u/Skuvnar)\
**Post date:** [March 11, 2015, 6:04pm UTC](https://forums.unrealengine.com/t/splinter-cell-like-light-meter/310493/3 "2015-03-11T18:04:26Z")

</div>

Yeah, this was along the lines of what I had planned. The issue is that it you can’t get away with multiple traces for each light source to check if some parts are lit, and others are not.

But it’s certainly better than nothing. Thanks for letting me know.

---

<div class="post-metadata">

**Author:** ![Co](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Co](https://forums.unrealengine.com/u/Co)\
**Post date:** [March 11, 2015, 6:13pm UTC](https://forums.unrealengine.com/t/splinter-cell-like-light-meter/310493/4 "2015-03-11T18:13:31Z")

</div>

We could improve precision by pushing multiple asynchronous line trace and postpone light influence update by 1 or 2 frame, it really depends on how many lights you’ve got in your level. (check out WorldCollisionAsync.cpp)

---

<div class="post-metadata">

**Author:** ![Skuvnar](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Skuvnar](https://forums.unrealengine.com/u/Skuvnar)\
**Post date:** [April 5, 2015, 9:36pm UTC](https://forums.unrealengine.com/t/splinter-cell-like-light-meter/310493/5 "2015-04-05T21:36:19Z")

</div>

So I tried out your solution and worked really well. Want to submit as an answer, so you can get the credit?

---

<div class="post-metadata">

**Author:** ![Co](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Co](https://forums.unrealengine.com/u/Co)\
**Post date:** [April 7, 2015, 7:29am UTC](https://forums.unrealengine.com/t/splinter-cell-like-light-meter/310493/6 "2015-04-07T07:29:01Z")

</div>

Yes you can accept it, i may update this post later when i’ll come back to optimize/improve this feature 😉
