Text in Polygon

Hello, I will write a simple text inside the polygon, but when I print the text, the polygon disappears. What could be the reason for this? I request your help.

rounded rectangle | Babylon.js Playground (babylonjs.com)

Text Code:
image

That’s because the GUI is used as an opacity/emissive texture on the mesh, so it will change the mesh’s transparency. To avoid this, you can either paint the entire GUI: rounded rectangle | Babylon.js Playground (babylonjs.com) (line 57), or reset the opacity texture: rounded rectangle | Babylon.js Playground (babylonjs.com) (line 56)

3 Likes

This is interesting and it works, thanks. In this case, if I want to make opacity=0.5, how do I do it. Will I not be able to use Opacity?

If there is no solution for this, I would like to share that the promin was solved by writing differently, but the other writing method was much better :). Thank you for your help.

rounded rectangle | Babylon.js Playground (babylonjs.com)

You can set the background color with transparency

2 Likes

Thanks, this is exactly what I wanted.