Help Please - Blurry Image
by Patryck Pabllo · in Torque X 2D · 06/15/2009 (2:14 pm) · 5 replies
I am converting my game developed in XNA + SpriteBach rendering to TorqueX 2D, in the Torque rendering I have an unwanted blurry effect. The image on the right side is XNA + SpriteBach rendering and the left side is TorqueX 2D rendering, exist some solution to not lost quality of the original image in the TorqueX 2D rendering process?
See image example: http://img13.imageshack.us/img13/157/blurryimageexample.png
Regards by help,
See image example: http://img13.imageshack.us/img13/157/blurryimageexample.png
Regards by help,
About the author
#2
I had something similar and I solved it by updating the default shader, SimpleEffect.fx. This file can be found in TorqueCore under Content > effects.
In the SimpleVS function there is a line:
I changed this to:
After this every is super crisp and sharp. I just got started learning about shaders so I'm a little...um...blurry...on the details but my present understand is that shaders work with a coordinate system based on the center of a pixel whereas we usually measure from the top left. Hence the 0.5 offset. I'm sure someone here can give a better explanation though.
06/15/2009 (4:40 pm)
Heya Patryck,I had something similar and I solved it by updating the default shader, SimpleEffect.fx. This file can be found in TorqueCore under Content > effects.
In the SimpleVS function there is a line:
output.texCoord = input.texCoord;
I changed this to:
// Where viewport_inv_width and _height are variables indicating // the width and height of the display in pixels. output.texCoord.x = input.texCoord.x + 0.5 / viewport_inv_width; output.texCoord.y = input.texCoord.y + 0.5 / viewport_inv_height;
After this every is super crisp and sharp. I just got started learning about shaders so I'm a little...um...blurry...on the details but my present understand is that shaders work with a coordinate system based on the center of a pixel whereas we usually measure from the top left. Hence the 0.5 offset. I'm sure someone here can give a better explanation though.
#3
06/16/2009 (6:03 am)
Yep, that's basically what it is. A more lengthy explanation can be found here: msdn.microsoft.com/en-us/library/bb219690(VS.85).aspx
#4
http://www.garagegames.com/community/forums/viewthread/77031
06/16/2009 (1:41 pm)
I changed that in the shader:http://www.garagegames.com/community/forums/viewthread/77031
#5
06/17/2009 (6:45 am)
Hi guys, thank you for the help of all, the changes posted here really solved the problem.
Torque 3D Owner Gavin Beard
Byte Logic
I would presume this is something to do with the basic material antialiasing the images. As far as I can see the only way to disable it would be to create a new material with it disabled. I may well be wrong on this though.