Looking for tips on Dying Light-style uv flashlight effect

Hey!

I’m looking to create an effect that makes an object’s emission glow brighter after it gets lit by a specific light, or set of lights, then slowly fades back to default values when the light is turned off.

Like this effect from theBlu (at about 8 seconds into the video):

Or similar to Dying Light’s uv flashlight (around 3:40 in):

However, I’m pretty sure Dying Light’s effect lights up the entire zombie instead of just the portion that was lit with the flashlight, which isn’t what I’m looking for.

My original idea for the effect was to use a shader pass to do lighting calculation, Graphics.Blit that into an ‘intensity map’ texture, then do another pass by multiplying samples from the intensity map with the object’s emission map. This worked for my initial tests with a quad oriented to what was essentially screen space. However, as I learned, Graphics.Blit assumes a full-screen quad and therefore doesn’t have the proper vertices necessary to perform lighting calculations.

Does anyone have other ideas on how I might achieve this effect?

All help is appreciated :slight_smile:

  1. Render the lighting on the object in question in UV space to a RenderTexture. (You’ll need to do your own shadowing)
  2. Apply the dimming effect. (There could be a map with dimming speed even. I’d use exponential decay)
  3. Use the resulting texture as emission.

Rendering in UV space is done by using the texture coordinates as position output from the vertex shader. You will need to unwrap the UV’s.

Can you use unity to make 3D renderings of UV flashlight?This is a crazy idea


From https://www.tank007.com