Page MenuHome

GLSL mode BackFace Culling
Closed, ResolvedPublicPATCH

Description

In order to address an issue raised by lots of my fellow game artists I've created this patch to implement viewport backface culling in the GLSL mode and solid mode.
By default it is off, to maintain blenders current display mode and I've added a new checkbox in the user preferences ->system settings to enable this labelled "Back Face Culling", under the VBO option.
Once enabled via system preferences, the backface culling is controlled at the material level using the materials game settings (BGE) backface checkbox, so you can have a mixture of single and double sided materials in the viewport.
Patch and screen grabs in the attached zip file.

Any comments welcome.


-Si

Event Timeline

Nice patch, that's just what I need!

+1

Now I can preview the toon edges using solidify modifier with my patch:

http://projects.blender.org/tracker/index.php?func=detail&aid=31444&group_id=9&atid=127

However, I think the checkbox should be placed near "Material Mode" drop-down menu in 3D view's properties rather than in the user preferences window, because I want the flag of the culling to be saved in each .blend file together with the material mode.

* This should indeed be in the 3D view display panel, not a user preference.
* The glDisable(GL_CULL_FACE); calls should not be in the user interface code. Any mesh drawing code should set this and then disable it. If we have to disable this culling in unrelated places it will become confusing.
* "SK - change" comments should be left out of the patch.

ok..
I've sorted the UI code issues. I'll look into moving the flag from user prefs to scene data so it's saved with the scene. It was done that way as our environment artists just wanted it on all the time.
Thanks for the feedback.

Almost done the changes suggested. I'll update the patch file etc on Monday. :)

Updated Patch to address comments above.

BFCull_V2.patch

Updated to apply to the latest trunk (r46911).

BFCull_V3.patch

- Style cleanup
- Removed unnecessary hunks that modify only whitespaces

Patch applied, thanks! I did some changes to make it work with non-mesh object and avoid use of global variables.

Brecht Van Lommel (brecht) changed the task status from Unknown Status to Resolved.May 25 2012, 11:27 AM