Hello,
this is my first post on this forum, and I hope you will be understanding if I posted it in the wrong section.
After working on many projects for mobile platforms and creating several games for WebGL, I decided to write my first WebGL application. While in games I focused on 3D graphics and other effects, this time I had to focus on the interface.
And here came the problem that I’ve been struggling with for several days:
In the editor, the text and graphics are clear, but after publishing it to the website, they become blurry. I’ve checked all browsers, tested various settings in Unity, and even after publishing, I added JavaScript in the index.html to increase the resolution, pixel count…
But the result is always the same.
Has anyone encountered this issue, and is it solvable?
In the entire project, I’m only using TMP_Text, so that shouldn’t be a problem. Besides, as you can see, the entire image looks like this, even the graphics.
I have the Canvas Scaler set to Constant Pixel Size, because if I set it to Scale With Screen Size, the window enlarges. However, I want the application to behave like a native app—meaning that when I resize the window, a larger area becomes visible rather than just a zoomed-in version of the same area.
Not sure I recall correctly what Constant Pixel Size does. Can’t hurt to try the others.
The blurriness isn’t related to quality settings perhaps? The default WebGL quality settings are lower than the usual “Ultra”. It may be using mip level 1 instead of 0 or just a lower (max) texture resolution although that should not affect the text … although, TMP uses a texture atlas.
Be sure to set the game view in the editor to the exact window size in the web build for best comparison. The default window size is relatively small, something like 800x500, and the blurriness may simply be due to that lower resolution.
Thank you for the suggestions. I changed the resolution as you recommended, but it didn’t help.
Out of curiosity, I switched the project to a desktop version and built it as well. In this case, the quality is the same as in the editor (see attachment). This suggests that it might be due to some specific WebGL settings or… honestly, I’m not sure, because I tested it on the most popular browsers, and the issue is the same everywhere. So, it’s probably not browser settings but rather something in the application itself.
The logo above the text is an image, right? That at least would tell that the blurring is of general nature, not just related to text / TMP.
If you take that image and place it as a sprite in the scene, does it look crisp? If so it would narrow the issue down to the GUI.
I’m thinking “bilinear filter” or filtering in general and vaguely recall that there’s a filtering and/or pixel-perfect setting in the GUI canvas (or scaler). If the UI isn’t aligned with pixel coordinates it could get blurry.
Hi, I’m really sorry for not getting in touch for so long. I decided to focus on the application’s mechanics and leave this topic for later.
I think I’ve found a solution. Currently, I’m developing a game for a client and working on my own application. The game has great quality, but the application does not. So, I decided to compare the settings in Unity and set everything exactly as it was in the game. However, the result was still the same.
The only difference between the game and the application was that the game ran in a specific window or fullscreen mode, using the default index.html file, while my application was supposed to run in a browser window like a regular website. So, I modified the file.
Today, I checked it again and completely changed the .css file.