I was wondering if someone could help me out with this one.
I have a sphere mesh, I want to write some text on it, so I use AdvancedDynamicTexture.CreateForMesh with a TextBlock control in it. But once I do this, I can no longer add a diffuse color to the sphere. Is there a way to have both TextBlock + diffuseColor on one sphere ?
Hi,
Here’s two simple implementations:
(lines 21 to 34) Using a DynamicTexture and standardMaterial, Which I assume will allow for more complex PBR materials as well,
(38 to 57) Using the AdvancedDynamicTexture and text block with the background property:
https://www.babylonjs-playground.com/#IDRXRT#2
Sorry I’ve never UV unwrapped a sphere in Babylon so I used the plane for simplicity.
The setTimeout can be substituted for your text block control.
Do either of these work for you?
An example of text on a mesh. Change cylinder to sphere and see how it works for you.
Thanks @JohnK, I had also thought of a cloned mesh approach, my purpose of asking the question was to see if it could be done on a single mesh. Is your suggestion the recommended approach ?
@Aphillimore thanks for your response, unfortunately they don’t work in my case.
Not a recommended approach just one way that I know🙂
Thanks I’m going to go with this for now, and keep it open as unresolved to see if someone comes up with another solution.