Members - Reputation: 220
Posted 28 May 2012 - 08:57 AM
I have made a very basic UI system for my game. I basically just render textured quads and replace the textures for effects like "button hovering", "button pressing" etc.
The problem is: I design my button textures for a certain resolution. Lets say my game window is 1000x600 and a button has a size of 200x30. Now I create my button textures with a size of 200x30 and everything looks fine at resolution 1000x600. But when I increase the resolution (i.e. 1920x1200), the UI elements look too tiny. And when I scale the elements up, the elements look blurry.
Is there a common way to fix this? Right now the only simple solution I can think of is creating UI element sizes and textures for 2 resolutions and switch depending on window size (if < 1200x1000, use small elements, else big elements).
Thanks for any hints and ideas!
Members - Reputation: 976
Posted 28 May 2012 - 09:14 AM
The other thing you can try is to break your UI elements up into corner, edge and center pieces that you manipulate in different ways. This is often referred to as scale 9 (see here: http://jessewarden.c...ilverlight.html). It adds some complexity to things but is used in Flash regularly.
Depending on your UI style, you could create the entire thing from geometry and avoid bitmaps entirely.
Members - Reputation: 1135
Posted 28 May 2012 - 05:53 PM
Personally i'm using DirectWrite/Direct2D, and so i'm using actual truetype files - so any resolution at any time is quite good.
For images, proceedural tricks work nice. Use of signed distance fields to preserve silhouettes while stretching images works well, check out this whitepaper: http://developer.amd.com/documentation/presentations/legacy/Chapter2-Green-Vector_Textures.pdf
If you create your images for the higher screen resolution though, when maintaining screen-size the texture will just by default fall back to lower mip levels. You dont even need to manually switch between textures for this.
Members - Reputation: 288
Posted 29 May 2012 - 06:14 AM
So instead of making your quad <200,300> make it <0.1*width,0.2*height>, which will keep every UI element the same size relative to the screen.
I suppose this could cause some distortion when it comes to text though, so be careful. It would certainly work for non-text situations.
PhD student working on medical imaging at the University of Southampton.
Enjoyer of games, films, books and cider.