I'm working on a simple 3d modeller and I would like to render the back facing triangles a bit darker, to easier differentiate between front and back faces. Like you can see in most modelling applications. How does one achieve is?

Should I enable back face culling and render the primitives and then enable front face culling, rotate the normals by 180 degrees and render the primitives again? Is this a practical approach?


1 Answer 1


A fragment shader receives the gl_FrontFacing system-defined input value. It will be false if the fragment was generated from a back-facing triangle, and true otherwise. So you can use that in your shader to determine how to generate a color value.


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.