How to prevent a light from lighting a specific mesh?
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 !
asked Mar 20 '19 at 09:51 AM in Rendering
Hi, you need to make the material of the headlamps emissive, and then put two spot facing out just in front of the lamps :)
answered Mar 20 '19 at 10:25 AM
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: https://www.youtube.com/watch?v=rv5OitYiNFU
answered Mar 20 '19 at 12:37 PM
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.
answered Mar 20 '19 at 12:26 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here