BasicMaterial does not support alphaTest?

I am creating my materials in scripts, not in the Editor. And BasicMaterial is preferable for me because it is faster and simpler. But does it support alphaTest at all?
I’ve tried this:

for (var j = 0; j < self.positions[_pos_id].model.meshInstances.length; ++j) {
            var new_mat = new pc.BasicMaterial();
            new_mat.color.set(1, 1, 1);
            new_mat.alphaTest = 0.1;
            new_mat.colorMap = char_textures[j];
            new_mat.opacityMap = char_textures[j];
            self.positions[_pos_id].model.meshInstances[j].material = new_mat;

But all fragments that supposed to be cut are present, they are just black. The material looks like new_mat.alphaTest = 0;
Also, I’ve tested my model with a Standard Material in the Editor and there are no problems with alphaTest.

It should do, if you can create a small reproducible project, that would be great to submit a bug report to the engine repo please

OK, I’ve made it. Here is the bug report:
I am not very familiar with GitHub, let me know if something is not right with it, I’ll fix it.

1 Like