Alpha not work when using fake albedo texture with material plugin


The plugin just rewrite the albedo shader part to use the customAlbedoTexture as the actual albedo texture. The above mesh is using the plugin and even if I set alpha to 1 in the shader, it is alpha tested by the texture1. But as you can see the above mesh don’t use the texture1.

I went through the code, it seems engine._boundTexturesCache should be reset before the above mesh render? Now the cache is reused and the texture1 is set as the albedoTexture of material2.

If this is expected(as it is really hack to enable the ALBEDO define without an albedoTexture), why the above mesh is alpha tested even if I set alpha to 1 in the shader?

Yes, it is not supported to enable some feature by changing the value of a #define in the shader code while the material is not using that feature.

Alpha testing is done in albedoOpacityBlock, so setting alpha = 1 after calling this function is too late.

Note: I’m not sure why you are not using the regular albedo texture in your example?

I’m trying to import a second albedo texture, the playground is just for displaying the problem, thanks for the explanation!