How to Force All Mesh Normals to Point Along a Vector

I’m trying to make all of a mesh’s normals face along a particular direction.

I want them to point in the opposite direction of the single directional light in the game. This is so that the mesh doesn’t have any lighting on it but can still cast and receive light mapped shadows.

Using an unlit / emissive material is no good in this case because I want it to receive light mapped shadows.

Lights aren’t exposed to materials because of deferred shading. If this only matters for the sun then you know that is always above the horizon. You can just set the normals to point straight down which will always face away from the sun no matter its direction.

Hello,

We think this post contains useful information which we would like to share with our public UE4 community. With your approval, we would like to make a copy of this post on the public AnswerHub which includes the discussion but strips out your username and company name.

Please let us know if you are okay with this. Thanks!

When you mean straight down do you mean directly away from the sun? Or down in world space?

I mean down in world space. Assuming there is ground and a horizon then the sun can’t get below the horizon and still light objects. That means a normal pointing straight down will be guaranteed to never be lit by the sun regardless of the time of day.

Sure, go for it.