Material design - Emissive only in shadow? (Think: City lights on a planet Earth)

How to create an emissive map that works only in a shadow part of my object? (shadow from a directional light)

Think of it as on what happens on the earth - on a day side you just see the surface, however in a night side cities glow yellow. If I would use a simple EmissiveColor my cities would glow both: day and night.

You only see artificial lights on the shadow side of the earth from space because their strength is tiny compared to the sun. You just need a really strong directional light.


I’m quite sure that I cannot see the lights on a daylight side of the earth because street lights are not turned on in a middle of a day. :wink:
Besides, I’m looking specifically for a way to ad emissive that works on a shadow side of an object while leaving the lit side intact, not for the earth maps, it was just an example.

Bump? Anyone?

yes here.

Dont think to big:

To achieve that we need firstly find out what part of the mesh is shadowed and what not.
That is something quite hard for UE4…
But we can use world direction vectors.

Means u take the direction from the light and then use it in a blend.

What is actual use case of this? Because of deferred nature of rendering pipeline shadow information is simply not available when you are in material shader stage.

Kanizitas came up with a good idea of using world directions and simply showing the texture on a side of my object that’s opposite to the directional light source. I didn’t have much time to work on it yet, and I predict having a problem with figuring out which side is opposite to the light source, but on a purely conceptual level - it seems to be doing exactly what I’d want it to do.

I know it won’t work with multiple light sources or point lights or… well… anything else than one directional light, but for my scene - that’s all I need :slight_smile:

When dot(normal, lightDir) is negative side is opposite.

hehehe, thank you :slight_smile: