Losing quality of drawtext dynamic texture

Hi everyone,

I want to ask about drawtext. I made a question gui on my WebXR. I made a question using the dynamic texture function, more precisely “fit text into area” (Use Dynamic Texture - Babylon.js Documentation). But I have a problem, when I reduce the size of the plane, the quality of the drawtext is reduced and blurred. Is there a way to maintain the quality of drawtext (“fit text into area”) on a small mesh? thank you

From the docs

Fit Text Into an Area.

You have a plane with width and height, planeWidth and planeHeight , to form the width and height of the dynamic texture multiply both the plane width and height by the same number to maintain aspect ratio. The number to multiply by defines the sharpness of the text, low numbers produce blurred text. Now you can create the dynamic texture.

var DTWidth = planeWidth * 60;
var DTHeight = planeHeight * 60;
var dynamicTexture = new BABYLON.DynamicTexture("DynamicTexture", {width:DTWidth, height:DTHeight}, scene);

The smaller the plane the bigger the multiplier needed.

Replace 60 with 100, or 240 or whatever gives you the sharpness you need.

3 Likes

Thank you so much !!

1 Like