Why can you not turn off backface culling in code

This seems like such a rudimentary feature to completely turn off backface culling. I’m not talking about GL.invertCulling, since this just flips between front and back. Rendering water will require both front and back faces. How unity is currently setup you’d need to render everything twice for the reflection. This seems like such a hit in your perfomance that I cannot grasp why you would not enable users to completely toggle off culling from a script. I’m aware you can do this in a shader, but what if you have tons of custom shaders. You’d need 2 of each (one with culling and one without).

Or am I completely missing something here and it is possible?

Roderick

2 way material, in the material/shader settings.

You’d still need 2 different versions of each shader

So is this just literally not possible?

A decision on cull or not backfaces is made in the shader code. Since every renderer may have multiple shaders, you need to configure all of them and to make sure they support such configuration. Or, you may sligtly modify default shaders so they would rely on some sort global value to decide to cull or not to cull. Or, you may create material manager class and register all material there in some list and change their options when needed.

1 Like