Detect backfaces?

Is there already a built-in shader uniform for seeing if a given face is front-facing or back-facing? It’s useful to have materials with no culling for things like wire fences or strips of cloth, but the lighting calculations aren’t correct for the backfaces because it’s using the front facing normals. This can be fixed in the shader but I need access to some sort of uniform that lets the shader know if a face is backfacing or not,

2 Likes

If it’s OpenGL does gl_FrontFacing meet your needs?

2 Likes

u can analize dot product view direction and face normal

2 Likes

You can specify that In the material setting:

<material>
. . .
    <cull value="none" />
    <shadowcull value="none" />
</material>

Is that what you’re looking for?

Nvm, I think 1vank answers your question.

Thanks for the suggestion, as I am using OpenGL I’m just going to use gl_FrontFacing (Should have probably known about that before lol). This is a good thing to know for DirectX shaders though.