[SOLVED] Question regarding transparent models and optimization

Hi guys!

Another quick question, again regarding optimization.

As an example, see this model I imported into Blender:
(red arrows show transparent parts)

This model has one diffuse texture. Question is that should I export the whole model as a single batched mesh and set it up like this:

mat.setFloat("AlphaDiscardThreshold", 0.5f);

or I should export the transparent parts as a separate geometry and only setup the material on that to be transparent:


and use non-transparent material on rest of the model?

To be a bit more clear, is the first approach less optimized than the second one? and will it have a noticeable impact?


Hey Ali_RS,

I think the first approach is cheaper. Just one draw call and the fragment shader simply discards transparent pixels. As for the second approach, I think rendering two geometries and blending is more expensive than discarding fragments.

The best thing would be to simply create a test case and look at the results on your device.

1 Like


dont see much difference from your second option.

there you will anyway need set AlphaDiscordThreshold too, but just for smaller geometry.

i dont think it will take much to just check if alpha require pixel to discard, shaders anyway do a lot more advanced calculations. So i might be wrong but i think the same as @alrik that first option is better.

1 Like

Guys, thanks so much for your inputs. Good to know that. Will keep using the first approach then.

I asked because I think I had read somewhere in the forum that AlphaDiscordThreshold is costly.

Thanks again for the help.

Yes, transparent objects are more expensive in the sense that some z buffer optimizations cannot be done. But unless you plan on rendering 3,000 of this particular model, it won’t really matter.

For Mythruna, having grass on used to be really slow on some computers… but that was also 10 years ago. And that was thousands of semi-transparent triangles.

1 Like


one thing come to mind regarding this topic.

For some transparent areas, you might want use different min/mag mipmapping that might look worse for not transparent areas (i mean if you use for example Fence transparent texture, i needed use other mipmappings, because it became invisible from some distance)

so in above case, for visual performance, second option sounds better. (or maybe i just dont know something)

1 Like