Page MenuHome

BGE : depth mask rendering option for alpha mesh
AbandonedPublic

Authored by Porteries Tristan (panzergame) on Mar 8 2015, 7:34 PM.

Details

Summary

Add of a new ui option in material panel to choose render with or without depth mask enabled.
For meshes semi transparent like windows : depth mask disabled.
For meshes with only borders transparent like foliages, wire fences : depth mask enabled.

example .blend : http://www.pasteall.org/blend/34955

Diff Detail

Repository
rB Blender
Branch
ge_alpha_render

Event Timeline

Porteries Tristan (panzergame) retitled this revision from to BGE : depth mask rendering option for alpha mesh.
Porteries Tristan (panzergame) updated this object.

I don't really have a strong opinion here, but seems like the kind of change which could end up causing problems in future (at least a little risky).

Assigning to @Thomas Szepe (hg1).

source/blender/makesdna/DNA_material_types.h
220–229

These values are stored on-disk in blend files, bumping the flags will break existing blend files.

Porteries Tristan (panzergame) updated this object.

Set GEMAT_DEPTH_MASK to 8192.

Daniel Stokes (kupoman) requested changes to this revision.Mar 31 2015, 6:01 AM
Daniel Stokes (kupoman) edited edge metadata.

I'm not convinced that this is even necessary. What use cases do you see for this change? I am also not sold on the name. Something like "Write Depth", while still not great, might be a little more clear to a user what the option does. It also looks like you are displaying the option for both opaque and transparent materials, but you only have the option affecting transparent materials.

This revision now requires changes to proceed.Mar 31 2015, 6:01 AM

I talked on IRC with Tristan about his patch. Actually I don't want to apply this patch.
In his test file he used blend alpha which is basically the wrong mode for this. The right modes for things foliages clip alpha or alpha sort.
http://archive.blender.org/development/release-logs/blender-247/game-engine-alpha-blending/index.html
But Blenders alpha sort is not working good, there are a lot of issues. For multitexture mode there is no solution for clipping planes. For GLSL we could one of the implement order independent transparency (OIT) methods.

The user have to use clip alpha for foliages. This mode is made for things like this. It is displaying correct and it is much faster.