GUI Button3D with black text does not work

Hi,

see PG https://playground.babylonjs.com/#7MHW65#1

if I set the text color to black it does not render, any other color seems to be fine. Is this expected behaviour? Seems odd to not be able to have black text.

Regards,
Mark.

Welcome aboard!

That’s because the emissive texture is used for the text, and the background of the emissive texture is black: it appears grey on the PG because there is a light in the scene.

So, if drawing in black, it will be the same colour than the background and won’t be visible.

You can use the diffuse texture instead of the emissive one, but then you will loose the color background of the text because it has an alpha = 0 in the texture:

https://playground.babylonjs.com/#7MHW65#3

I’m not sure it’s possible to fill the background of the text texture with the color you want…

Ah, thanks for the explanation and adjustment to the PG, it all makes sense now, perfect.
I lost a day and quite a bit of stress on this one. Before I discovered it was related to font color (an unlucky choice of black but at least I have learnt something from it) I investigated whether it was a problem with the font, the scaling, position, blend mode and a few other things but I didn’t see anything about emissive texture in the docs, unless I missed it. Thanks.

I am a Unity developer and was tasked to create a short-turnaround WebGL project to integrate into a website (couple of weeks, half time) . I started with A-Frame but then decided to switch after realising there were problems with its post processing (and a few other things) so it has been a steep learning curve with BJS under tight deadline. So I really appreciate this type of assistance from the community and the BJS ecosystem. Thanks again.

1 Like