0

I'm having a problem with URP Lit shader, I'm using a spotLight as a flashlight, it works for the front face of the material, but I can't get the lights to react with the back face, here is how I'm setting the material :

enter image description here

0

2 Answers 2

1
+50

Usually, a back face is not lit in a typical physical based shader as the face normal points away from the light source so that the result of the light calculation for the effect on the surface is below zero, and a face normal can not point in 2 directions at once.

Option 1: If your use case is something like a "texture only" fence or wall with some holes (basically a quad with a texture) then the easiest solution is to have additional quads for each side of the model/object with backface culling enabled.

Option 2: You could also create a Shader Graph custom shader (with the PBR Master and the "Is Front Face Node") and an if condition (branch) to check if the lit face is a front or back face, similar as in this question about Shader Graph (answer by "cxode"): Shader Graph - Lighting Back Face. If it is a backface, the face normal is multiplied by -1 (exact opposite). Note that the Master node's "Two Sided" value in the Material options needs to be set to true for this to work.

Option 3: Another way (typically done for things like grass quads or billboards) is to write a custom shader, starting from a standard lit one. Here, you change the lighting calculation so that the face normal is ignored and the lighting of the face is based on the distance to the light source only, but this is a bit more complicated.

Sign up to request clarification or add additional context in comments.

Comments

1

By defualt unity's lighting system doesn't want to light up backfaces because they are usually culled by defualt.

You could try set the Backface Tolerance to 0 in your lightmap settings which may help, but you may need to write a custom shader to handle this use case.

The real question is why do you need to render and light backfaces? It would be likely be advisable to simply add additional front-faces to your objects you want to see the backfaces of, you can even flip the texture if this behaviour is desirable. Enabling backfaces on the material level can have some pretty significant performance impacts if its used on a lot of geometry thoughout your game.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.