Blurry Image
by Robby Friedman · in Torque X 2D · 07/12/2007 (5:34 pm) · 24 replies
Hi everyone. I'm a long time user of the other Torque products and I'm working with TorqueX now. It's my favorite yet.
I have a project in TGB and I'm porting it to TorqueX. In each Im making an 800x600 window with an 800x600 background image in it. In the TGB version everything is ok. In the TorqueX version, the background is a little bit blurry. Any ideas what it could be?
I have a project in TGB and I'm porting it to TorqueX. In each Im making an 800x600 window with an 800x600 background image in it. In the TGB version everything is ok. In the TorqueX version, the background is a little bit blurry. Any ideas what it could be?
#2
07/12/2007 (6:38 pm)
Do you mean the PreferredBackBufferWidth/Height? I have them set to 800x600. My source image is also 800x600. In TXB my camera and static sprite of the background are both 100x75.
#3
07/14/2007 (2:05 pm)
That's wierd. If you send me a copy of each project (or a simple repro) I can try to help figure it out. It sounds like it might be a tex coord issue, but it would be crazy if we hadn't noticed something like that before.
#4
07/14/2007 (3:00 pm)
Hope it's something stupid I did on my end ;) Ill send you the projects. Thanks.
#5
07/14/2007 (3:32 pm)
Cool. I'll take a look at them next time I'm at the office.
#6
07/20/2007 (8:56 am)
Im sure you're busy Tom. Any progress with this?
#7
07/20/2007 (10:13 am)
Robby, I noticed that if you don't set your settings.xml file to copy if newer, it doesnt copy into the debug folder and wont be in your .exe. Can you check to make sure your settings.xml is also set to your desired resolution in your debug folder?
#8
-
true
false
-
-
false
600
800
-
false
true
07/20/2007 (10:18 am)
I did have it set to copy if newer. Heres the entire thing. Ive tried to set PreferMutliSampling to true but that didnt have any effect.-
-
-
-
#9
07/20/2007 (1:31 pm)
I haven't gotten around to it yet. We've just been swamped getting the 3D stuff ready for GameFest. I'll try to remember to check it out before I leave the office today.
#10
Get to it when you can. Im happy to even have your attention on the issue. My game "release" is in about two weeks, so there's time to resolve this.
07/20/2007 (1:39 pm)
OMG 3D IS WAY MORE IMPORTANT! We're all excited about it ;)Get to it when you can. Im happy to even have your attention on the issue. My game "release" is in about two weeks, so there's time to resolve this.
#11
07/26/2007 (3:31 pm)
I haven't tested this yet, but we were just talking about this and it's possible that the XNA content pipeline is processing non-pow2 textures in such a way that it blurs them. Have you tried padding the bg image to make it a power of 2?
#12
07/26/2007 (4:32 pm)
No, but I'll try it tonight.
#13
07/26/2007 (4:45 pm)
I just padded my background with transparency to make it 1024x1024. It make no difference. Below is a screenshot of my source image, the TGB version, and the TorqueX version from left to right.
#14
I also noticed my images were not as sharp as the originals at 100% scale.
07/26/2007 (6:31 pm)
In DirectX, this used to be an issue with the UV coordinates and the difference between texels/pixels. I recall having to overshoot my UV's to get direct texel/pixel mapping on my quads. I don't know what's going on at the low-level of XNA or TorqueX, but perhaps this necessary correction was not made? I also noticed my images were not as sharp as the originals at 100% scale.
#15
07/26/2007 (6:49 pm)
I've managed to improve things by jumping to a background image at 1600x1200 and scaling down in Torque. It solves my immediate problems but I can tell this will probably start biting others eventually. Good luck with solving it and thanks for the help.
#16
08/08/2007 (4:42 am)
Have we a solution as opposed to a workaround?
#17
01/04/2008 (12:30 pm)
I have the same issue. While it's maybe ok with images, but it's become really important with fonts: fonts getting blured and sharpened cause of subpixel accuracy. And thats bad. We (our little game studio) bought TorqueX engine and I was able to force text drawing to truncate coordinates to int - but still have bad image quality. I think we need some kind of "switch" to turn off subpixel accuracy rendering.
#18
perhaps try changing the dimensions of the rendered bitmap object (?) by +/- one pixel ?
01/04/2008 (12:35 pm)
I dunno if this is possible,perhaps try changing the dimensions of the rendered bitmap object (?) by +/- one pixel ?
#19

Truncation of text rendering position to int:
location.X = (int) location.X;
location.Y = (int) location.Y;
FontRenderer.Instance.DrawString (font, location, color, str);

Truncation and offset to 0.5:
location.X = (int) location.X + 0.5f;
location.Y = (int) location.Y + 0.5f;
FontRenderer.Instance.DrawString (font, location, color, str);

Original font image (part of it) - this is how it should render:
01/04/2008 (12:55 pm)
Original (without my modifications) Torque X text rendering:
Truncation of text rendering position to int:
location.X = (int) location.X;
location.Y = (int) location.Y;
FontRenderer.Instance.DrawString (font, location, color, str);

Truncation and offset to 0.5:
location.X = (int) location.X + 0.5f;
location.Y = (int) location.Y + 0.5f;
FontRenderer.Instance.DrawString (font, location, color, str);

Original font image (part of it) - this is how it should render:
#20

Still, I wish we have some way to make other images not blured when they are not stretched.
01/04/2008 (1:00 pm)
Ah... nvm - this is cause of font: here what it (font) looks in Photoshop rendered black on white:
Still, I wish we have some way to make other images not blured when they are not stretched.
Torque 3D Owner Will O-Reagan
Modern Intrigues