Can a light affect only certain objects? If not, can I fake it?

I have a moon mesh that I would like to light dynamically. At night, the only way to get shadowing on the landscape to work correctly is to turn the sun’s intensity down to 0, but this also turns off the light on the moon, causing it to always be a new moon.

Is there any way I could create a second directional light and have it affect only the moon, so that light can constantly be applied throughout the day and night? Failing that, is there a way to pass the incoming light angle as either a vector or rotator into the moon’s material and “fake” the incoming lighting?

Hi!

Unlike UE3, UE4 doesn’t have this type of functionality due to another rendering approach (deferred shading model), that of course gives its benefits. This question is highlighted here:

On the other hand if you really need some actors to be rendered in a different style you could use Post Process Materials Custom Depth feature to mask some objects in render and style them in a different pass. Please take a look at this documents:

In conjunction with Custom Lighting model for this objects you could really highlight them as you want.

Hope that’ll help!

Cheers,

@ Icannotfly,

Since you and others will not have access to the UDN link above unless you are a custom licensee here is the response that is from that post regarding lighting specific objects in UE4:

“UE4 does not have lighting channels like there were in UE3. While you can setup specific meshes/skeletal meshes to be affected by lighting or not you cannot specify a specific light to only affect certain objects this will work with all lights and not just a specific one.This cannot be done in UE4 due to deferred shading.”

Just as mentions, this is not possible due to deferred rendering for lighting.

Thanks!

Tim

Thank you for the reply. I’ll look into postprocessing to see if I can accomplish what I want.

Hi, I was wondering what solution you found in the end. Thank you!

I actually haven’t found one yet, unfortunately. Since it’s a purely visual problem, I’ve concentrated on gameplay-related issues and have put this one on the backburner.
An idea I had, but haven’t tested, was to put the moon in a box somewhere hidden from the player and do all the rotation and lighting in there, then “view” it with a camera (like the security cameras in the blueprint demo game) and render that view onto a simple plane in the world. The alpha mask in this case would come from the camera’s depth buffer. Like I said, I haven’t tried this, but I think it might work.

cool idea… had the same problem and I was testing different solutions.

Cheers!

Hi all, IDK why you guys are saying there are no lighting channels in UE4… maybe I’m missing something?..

Well… I’m using latest version currently which is 4.12.5 and Lighting Channels are part of the Details you can set when you click the static mesh, in my case, a Moon’s static mesh.

I have all my lightings by default on Channel 0 -it seems it’s a default setting- and I have set my moon’s lighting to Channel 1 and it’s not being affected by light on default channel anymore. It’s all dark, so I added another light source to the level, this time on Channel 1, to iluminate only the moon. As shown in the other images.

Have a great weekend ya’ll.
PS.- Hire me, Epic. :smiley:

1 Like

Hi,
in the object material, you can set it to translucent, then the self shadowing options will be available, turn shadow density and self shadow density to zero, your object wont have any shadows…its a work around, not sure if its the ideal way…

You are right !!! Genious !!! Thanks a lot, I just needed that feature.

@eliezercazares

At the time of the original post, there were not lighting channels in UE4. This has since been added with version 4.11 and later. The lighting channels in UE4 are also limited when compared to what was possible with UE3/UDK as well. The lighting channels in UE4 can only be used with Movable Actors and do not work with Static Lighting due to Differed Rendering. Not sure if the new Foward Renderer (4.14) will support statically baked lighting channels in the future, but not planned yet that I’m aware of.

thank you :slight_smile:
glad you got it working

yeah Tim, that’s why I specified the version I’m using. However, I wish you guys in the staff would have access to the details of the upcoming changes. You just panicked me regarding the possibility of another big change coming to lighting in Unreal Engine 4. I know it’s for the best though, but certainty would be greatly appreciated.

hi eliezercazares, do you have any solution to exclude an object (movable) from skylight ? I need to do this to a specific object (a car), when skylight illuminating the world, i want that car to not get illuminated from skylight. I haven’t looked in lighting channels very much but i don’t know if it is possible in the first place. Now 4.14 released, lots of things changed since the original post.

Hi, Finwefeanor, should be possible with lighting channels. Verify what channel your skylight is emitting, and verify what channel of light is your object receiving, try to set the car to channel lighting 1 since skylight by default is on channel 0.

Thanks for the reply eliezercazares but it seems skylight does not have any lighting channels on it, or am i looking wrong place ?

it says that lighting channels directional, spot and point lights have lighting channel, doesn’t mention from skylight Lighting Channels | Unreal Engine Documentation

i will open my project and review this by night man, I tried connecting remotely from work but “firewall”. hold on.

so, I used SkySphere, created another Directional Light called Sun with the channel settings, and then set in the SkySphere Default Properties the Source to be the Sun.

this is for replacement for skylight ? you are trying to first directional light to act as a skylight and when second d.light is the main light source ?

idk if im following you, you dont need to worry that much for the sun. as long as it rotates all around your world half of the time it will be under the map. you most likely need to create a moon that illuminates when the sun is under the map. thats it.