Transparency and shadows : possible breaking change

Hey monkeys, I’ve just committed a change that may break some of your code if you are using transparency and shadows.

I’ve removed the AlphaDiscardThreshold attribute from the lighting material.

If you don’t know what it was used for, then you’ll probably won’t have any issue :stuck_out_tongue:

If you do, please use the AlphaTestFalloff render state instead (usage is exactly the same).


Material mat: Common/MatDefs/Light/Lighting.j3md {

Transparent On

MaterialParameters {


AdditionalRenderState {

Blend Alpha

AlphaTestFalloff 0.05 //this is an example value




@androlo this will probably break the shadows for the Forester, let me know if you need any assistance on it.

Also I encourage you to use the same approach for discarding transparent pixels in the grass shader. remove the threshold test and just pass the alpha value as the alpha of the fragcolor. The hardware will use the AlphaTestFalloff value to discard the pixel.

It is slightly faster in the TestTransparentShadows…and slightly faster…is faster :stuck_out_tongue:

Also this removes a branching and this is priceless for low hardwares.

Also this, for once, “unbloat” the lighting shader :smiley:


Niceness, keep those breaking changes coming :slight_smile:

You had me at “faster” and “unbloat”. :wink:

Great. Thanks for the heads up. :slight_smile:

EDIT: I’ve already made copies of the shadow shaders and put into the lib, so I’ll have to change. No problems tho.

EDIT: And yes I will definitely change to alpha testing. My old stuff is in fact causing problems for people, so this was very good timing. :slight_smile:

@nehon , I have a question about AlphaDiscardThreshold:

You removed the AlphaDiscardThreshold from Lighting MatDef but it still exists in Fragment shader.

Are you going to remove AlphaDiscardThreshold from the fragment shader?

Line 58 and Line 175

aaahh… sorry, i see you have committed it too. :slight_smile:

Note this change was reverted back, see here:

@zarch said:
Note this change was reverted back, see here:

Yep, i reverted all stuff for shaderblow too. Thanks man!