Download

Determining light levels for an actor

Hi guys,

I’m developing a stealth game for a Uni project, and want to create a more dynamic ‘visibility’ index for the player. My current thoughts on this have been either to raycast from all active lights and calculate a value this way, or to construct a secondary shader for the player, which renders just the player’s light values (in greyscale) to an offscreen buffer. I can then sample these to obtain how lit the player is.

Does UE4 support rendering like this to an offscreen buffer, and do you think this is a plausible way to obtain a fairly quick, accurate value? Is there a better way using graphics that might work, i.e. using light/shadow maps?

I think I’ve come across a good solution to this. For reference, I used a PrecomputedLightVolume with the InterpolateIncidentRadiancePoint function to get light levels on my character from the cache.

Can you go into detail on this? I’m doing a Thief-style stealth game as well and I’ve been experimenting with different solutions, but I haven’t found any I’m totally satisfied with.

This is something similar to what i need https://forums.unrealengine.com/showthread.php?67074-Get-light-near-the-player-and-apply-to-HUD-material
But i o idea about how make that.