Jump to content

Blurred text


pichou
 Share

Recommended Posts

I have notice that the text created with babylon gui is blur. So I tried to put a classic html div and a gui text next to each other and the result is really obvious.

I have made a playground to see it : https://www.babylonjs-playground.com/#2ARI2W#3
And attached you will find a screenshot of what I see. Plus I get the same thing with images, they are really blurred!

First I wondered if this is only on my computer/screen that it is blurred like that. Some of you also have this problem?

I have looked for a solution and the best I have found is to use the setSize function of the engine : 
https://github.com/BabylonJS/Babylon.js/blob/master/src/Engine/babylon.engine.ts#L2250

And it works I have better texts icons and images, but then a lot of other stuff were broken like the scene.pick function because the canvas size doesn't match with the screen size anymore I guess.

So I just wonder why canvas can't have a better resolution and if there is a fix maybe?

Bye bye, Pichou

text difference.PNG

Link to comment
Share on other sites

@JoshB Three.js must face the same issue if we are talking about rendering text INSIDE WebGL. As @JohnK mentioned you can also use HTML based GUI tools that will render the text perfectly.

Link to comment
Share on other sites

Hey @Deltakosh,

I know this library fabricjs which seems to have no issue to have good text rendering with webGL : http://fabricjs.com/

Plus I have made some research and found this article very interesting with a working example : http://wdobbie.com/post/gpu-text-rendering-with-vector-textures/

Then I also found this stackoverflow which list several techniques with its pros and cons : https://stackoverflow.com/questions/25956272/better-quality-text-in-webgl

Maybe you already know all of that but I hope that can help!

Cheerz, Pichou

Link to comment
Share on other sites

Hello Forum ?

From what I have gathered so far, it happens mainly cause we are not (at least in my case) rendering at native pixel size ( hardwareScalingLevel = 1 ) Here is a quick demo full scale for me ( hardwareScalingLevel = 0.5 ) where I also obvisously have to increase the texture size.

https://www.babylonjs-playground.com/#2ARI2W#8

It is actually what http://wdobbie.com/post/gpu-text-rendering-with-vector-textures/ is using:

image.png.af4ec3102c5de179a20e1f8865f3edc6.png

Hope this can help

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...