Download

Secondary bounce light from flashlight possible?

I was watching a video of Escape From Tarkov the other day, and was so impressed by the way it handles lighting that I had to look up what engine it was using. Unity 5 apparently.

One thing that was really impressive was that when the player shone his flashlight on a red metal door, a large part of the room lit up with a red color. It really sold the lighting.

I know Alien Isolation did something similar with it’s flashlight.

So what I’m wondering is if it’s possible to achieve that effect in UE4? Even if it has to be some hack, like raytrace to the flashlight surface point and move a pointlight there that takes on the color of whatever the surface the ray hit (if that’s possible). So yeah… Possible?

You can use LPV (Light Propagation Volume)

https://docs.unrealengine.com/latest/INT/Engine/Rendering/LightingAndShadows/LightPropagationVolumes/

Oh, very nice. I’ll play around with it some. Hope it’s not as performance demanding as it looks to be. :slight_smile:

I’ve heard some developers place place a point light near where a flash light hits a wall/object and pull the color of the light based off the asset it’s pointing at.

Yeah, that’s the hack I thought of as well, but the problem might be getting the color of the hit surface

Okay, so here’s how I have had it set up in the past:

  • To start with, you need to parent a SceneCapture2D component to your camera/light/whatever. Set the FOV fairly small - I’ve found about 10 degrees works best. Under the capture options, set it to BaseColor.
  • Next, make a RenderTarget and point your SceneCapture at it. Use a low resolution, say 32x32.
  • Make three new LightFunction materials. In each one, hook up your RenderTarget’s red, green and blue channels respectively, so that you have one channel per material.
  • Place three pointlights in your blueprint, and switch off their shadow casting. Give each of the lights one of your R/G/B light functions, and set their light color to match.

What should happen is your scene capture picks up the base color from whatever it is you’re looking at, renders it into a small texture swatch, which is then distributed to each of your three lights to rebuild the color.

The technique does have its limitations, since any highly contrasting textures are going to cause issues. If thats the case, you may want to run each of your RenderTargets through a SpiralBlur, to try and even out the color variations on the surface.

I did it by assigning RGB values via the physics material, so you could easily apply physics materials to static meshes specifying the color of an asset. There’s probably a much more elegant way to use a similar approach, but I’m more of an artist and this is my first BluePrint outside of following tutorials.

I added a brightness falloff based off distance, probably should also increase/decrease the radius based off distance as well.

remember to set the “min roughness” of the point lights to 1, this would roughly simulate diffuse only light, which is what you want for a bounce. Otherwise you’ll get multiple highlights on shinier surfaces.