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?


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.

| improve this answer | |
  • $\begingroup$ Very helpful, thanks very much! $\endgroup$ – Lenny White May 12 at 2:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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