About Store Forum Documentation Contact



Post Reply 
Image Quality.
Author Message
Salival Offline
Member

Post: #1
Image Quality.
Today I'm working on adding some new interface for my game and I have a question about 2D Image quality. Why are they blurred when located in the center of the screen and not in a corner? I did so the button moving along with the mouse and try move it around to see result, and it will always gets blurred if it is near the middle does not matter what coordinate. Image is always sharp in the edges of screen, why is it like that? it is very annoying.

Any ideas?

Sample Image:
(This post was last modified: 12-21-2010 04:08 PM by Salival.)
12-21-2010 03:56 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Image Quality.
Nice screen.

What are you using to draw the buttons? Button/GuiImage?
12-21-2010 04:09 PM
Find all posts by this user Quote this message in a reply
Salival Offline
Member

Post: #3
RE: Image Quality.
(12-21-2010 04:09 PM)Esenthel Wrote:  Nice screen.

What are you using to draw the buttons? Button/GuiImage?

Thanks,

I use: Button.
(This post was last modified: 12-21-2010 04:16 PM by Salival.)
12-21-2010 04:14 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Image Quality.
The issue is about aligning floating point coordinates to integer pixel coordinates.

I'll try to add automatic pixel aligning for gui objects very soon, so please wait for that.
12-21-2010 04:25 PM
Find all posts by this user Quote this message in a reply
Salival Offline
Member

Post: #5
RE: Image Quality.
(12-21-2010 04:25 PM)Esenthel Wrote:  The issue is about aligning floating point coordinates to integer pixel coordinates.

I'll try to add automatic pixel aligning for gui objects very soon, so please wait for that.

Just perfect grin
(This post was last modified: 12-21-2010 07:08 PM by Salival.)
12-21-2010 07:07 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #6
RE: Image Quality.
small changes uploaded
12-21-2010 09:53 PM
Find all posts by this user Quote this message in a reply
Salival Offline
Member

Post: #7
RE: Image Quality.
Thank you.
I tested it out, Same result as before.

Check OK button to the left and in the center.
(This post was last modified: 12-22-2010 02:39 PM by Salival.)
12-22-2010 02:03 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #8
RE: Image Quality.
can you send me the buttons, and code or .gobj file that you're using? and which resolution are you using?
12-22-2010 03:02 PM
Find all posts by this user Quote this message in a reply
Salival Offline
Member

Post: #9
RE: Image Quality.
(12-22-2010 03:02 PM)Esenthel Wrote:  can you send me the buttons, and code or .gobj file that you're using? and which resolution are you using?

Sure, Check your PM.

Ps, I current use this settings.

D.sync(true);
D.full(false);
D.mode(1360, 768);
D.shdSoft(1);
D.texFilter();
D.ambPower(0.3);
D.viewRange(200);
(This post was last modified: 12-22-2010 04:10 PM by Salival.)
12-22-2010 04:05 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #10
RE: Image Quality.
Hi,

I've just tested this, and it works ok. (DX9/DX10)

Are you sure you're using latest EsenthelEngine.lib? Could you try using Project\Rebuild?

Are you setting button size after setting resolution?

Are you using any custom methods for drawing the button (like virtual draw override?)
do you use custom viewports?
12-22-2010 04:46 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #11
RE: Image Quality.
After changing the resolution or screen scale you need to re-adjust the button size if you wish to have 1:1 per-pixel size.
12-22-2010 04:47 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #12
RE: Image Quality.
Code:
/******************************************************************************/
#include "stdafx.h"
#include "../resource.h"
/******************************************************************************/
Button LoginButton;
/******************************************************************************/
void InitPre()
{
   App.name("Project");
   App.icon=(Char*)IDI_ICON1;
   App.flag=APP_RESIZABLE|APP_MAXIMIZABLE|APP_MINIMIZABLE|APP_FULL_TOGGLE|APP_KB_EX​CLUSIVE|APP_MEM_LEAKS;//|APP_MS_EXCLUSIVE;
   D.sync(true).mode(800,600,0);
}
Bool Init()
{

Vec2 LoginBtnPos = D.pixelToScreenSize(VecI2(52,-48));
Vec2 LoginBtnSize = D.pixelToScreenSize(VecI2(93,28));

//! Create Login Button.
Gui += LoginButton.create(Rect_C(-LoginBtnPos.x, LoginBtnPos.y, LoginBtnSize.x, LoginBtnSize.y));
LoginButton.draw_mode = BUTTON_DRAW_IMAGE;
LoginButton.image=Images("c:/Btn_Normal.gfx");

   return true;
}
void Shut()
{
}
/******************************************************************************/
Bool Update()
{
   if(Kb.bp(KB_ESC))return false;
   if(Ms.b(0))LoginButton.pos(Ms.pos + Vec2(0.01, 0));
   if(Ms.b(1))LoginButton.move(Vec2(Time.d()*0.01f,0));
   Gui.update();
   return true;
}
/******************************************************************************/
void Draw()
{
   D.clear(ColorBrightness(0.8f));
   Gui.draw();
   D.text (0,0.9f,S+Time.fps());
}
/******************************************************************************/
12-22-2010 04:48 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #13
RE: Image Quality.
you can use:

draw()
{
image=... ; // set custom image
__super::draw(gpc);
}

default draw uses D.screenAlignToPixel(rect) on temporary rect (rect+gpc.offset) to align it per pixel
12-22-2010 07:03 PM
Find all posts by this user Quote this message in a reply
Post Reply