I suspect it’s a rendering order thing, but I don’t see a way to specify to render transparent materials last. A brief investigation led me to these sorting functions in the renderer:
I tried changing the layer and _key properties but it did not fix it. I’m wondering if anyone else can verify that this is a rendering order problem and if so, if there’s a way to fix it. Here’s the scene:
So it turns out the fix was very simple. It’s about blending, not drawing order. All I had to do was set the new material to:
this.material.blendType = pc.BLEND_NORMAL;
I was surprised to see that transparency worked even if alphaWrite was set to false. So transparency comes from how you blend pixels as you render. Which makes me wonder what the purpose of alphaWrite is then.