How to prevent a light from lighting a specific mesh?

Hello,

I am trying to add a dynamic, shadow casting light on a skeletal car mesh, to use as headlamps. I would like to avoid using multiple ones for performance reasons.

If I put the light right in front of the car, when getting close to a wall, you can see the light actually originates from the center of the car’s hood and not its sides. Like this :

If I put the light back inside the car so the spotlight’s cone fits with the position of the headlamps, it will then shadow the car’s mesh and leave artifacts:

Both results are unsatisfactory. To me the solution would be to tell the light not to shadow the car’s mesh, but I can’t seem to find a way to do this.

Is there a solution I missed? How do car games like GTA avoid this problem?

Thank you for your help !

  1. Static Mesh components contain the option “Cast shadows”. Unchecking this will prevent it from creating dynamic shadows and exclude the object in a light bake.

  2. You can edit the material assigned to the static mesh and change it’s shading model to unlit, this will prevent the material from being affected by light. You can then control the brightness of the material using the emissive colour.

2 Likes

Hi, you need to make the material of the headlamps emissive, and then put two spot facing out just in front of the lamps :slight_smile:

1 Like

You cannot ask a light to ignore specific actors. To achieve the affect you want, you will need to look at setting up lighting channels in your project, note these can only be applied to moveable objects (as I currently understand).

There are tutorials etc on YouTube: Channel Setup For Character Lighting - Episode 28 - YouTube

You cannot ask a light to ignore specific actors. To achieve the affect you want, you will need to look at setting up lighting channels in your project, note these can only be applied to moveable objects (as I currently understand).

There are tutorials etc on YouTube: Channel Setup For Character Lighting - Episode 28 - YouTube

Thank you both for answering but it does not solve my problem.

@ClockworkOcean , I was asking for a solution with a single light. My project cannot take the performance hit from doubling the number of dynamic shadow casting lights, and my light measurements will be for a single source, not two.

@Alekann01 , I still need the vehicle to cast shadows from other sources, and the mesh to have adequately lit materials.

I think you will struggle to make things look right without two lights… ( leakage etc ). :frowning:

Oh snap! I thought there are no lighting channels in UE4. At least that’s what one of the official staff members posted in response to a previous question.

1 Like