How to Make a Light Source ignore a specific actor, or actor ignore a specific light

Well, im working on something like a fog of war, Where things near the character are brighter than things hidden from his line of sight, as in, the walls and objects casts a shadow as if a light is attached to the character. But i can just Set cast shadows to false, as i want my character to interact with other light sources in the game. Any thoughts on the way to achieve this?

maybe a silly question, but… why worry about pixels that are out of the line of sight? the player will never know whether it’s shadowed if he can’t see it.

well… what i want is basically something like this… so the walls and objects casts shadows like this according to my characters movement and line of sight.

I’m also interested in achieving this effect, haven’t found a solution yet.

I don’t think I fully grasp what you’re trying to achieve, because I feel like if the light was attached to the player, the line of sight would be the same as the player’s. Just give it a large attenuation radius and have the Environment Intensity of the whole level set to zero to make everything else black.

The problem is that the light attached to the player will cast a shadow from the player as well. The desired effect is that the player will cast shadows from all light sources except for his own line of sight light.

Exactly what dbInteractive said. What i want, is for my player to interact with other light sources in the world, but not with the light source attached to himself.

oh that can be handled with light channels. Make a custom light channel for the fog of war light source and then make sure everything but the player belongs to it.

After doing some googling on light channels, it seems they don’t currently exist in UE4.

https://answers.unrealengine.com/questions/21792/is-there-light-channels-in-ue4.html

That may very well be. I had to stop and see for myself. I found a reference to light channels in the matinee document here and so I opened the editor to have a look around. I couldn’t find them. But I wonder if they’re a hidden setting? I suppose lights have probably been completely redone due to PBR so that may be wishful thinking. If you have a code monkey maybe it’s possible to snip the code from UDK and make custom light classes for your game?
I’m kind of blown away by the deprecation of light channels. Was very efficient for optimizing.

Lighting channels don’t exist because lighting is now deferred. You can’t ignore specific actors with specific lights, or anything like that any more.

ok maybe a texture effect is the only way to go.
how about again back to finding a way to get the playerpawn XYZ passed to the material editor, then on your materials do a dot product with playerpawnXYZ*world normal and anything with a negative gets clipped to zero then use a sphere mask to multiply the results if you want a penumbra.
Hope that’s a good idea I’m about to go to bed so I typed it before thinking too much about it. Thanks for the heads up Ambershee.

For fog of war, materials and shaders are a good way to go - post processing may be a good bet.

I have very little experience creating materials and shaders, and post-processing in general. Any tips or starting points I can look into?

Same, not that experience with them, so any pointers to the right direction regarding how to tie the line of sight and materials together would be greatly apprectiated appreciated.

This is quite a hard effect to achieve, so I won’t downplay the amount of R&D you’re going to have to do. I would for example look at something like drawing visible data to a render target, where each pixel corresponds to a specific world coordinate, then translating those into something relevant in post process. There are several stages to that effect (including some programming and a lot of math), but I reckon it has a reasonable chance of delivering something useful.

if you can get the playerpawn I think we can get the rest with:
in your materials you add a branch that takes <<playerpawnXYZ>> and then a 3constant set to <<0,0,1>> with a transform from tangent to ???space. I’m fuzzy on this transform bit because I don’t mess around with vectors much other than world to tangent transforms Plus your camera isn’t the player’s POV. But what you are going to need to do is to make sure that the Z normal of the TEXTURE (the texture will be tangent space) no matter which way it’s facing in world space can be multiplied against the player position in world space. (a dot product)
normalize the result and then run that into a lerp node for whichever channels you’re using in each material. Have the B input be a simple constant with a value of zero and the A input (the channel that will show wherever the dot product returns a value of 1) contains the intended effect. Base,normal,spec etc…
See this way any surface that is not facing the player will return a negative value and since we clamped it the lerp will see it as zero and use the black from the constant1 node.
I think the only trick here is figuring out how to get the player XYZ but I think there is a node that can connect to either matinee or kismet or both that can be used to pass that value.
I JUST got UE4 the other night so I am busy porting one of my own things over, and I"m not quite comfortable yet messing around with anything else otherwise I would be messing around with it myself. But give me about a week if you haven’t solved it by then I should know my way around enough to be able to keep my jobs straight.