Page 1 of 1
blury picture in pixelspace and orthogonal projection
Posted: 28 Jul 2014, 19:55
by chriss0212
with textures we are working a lot in native pixel space. what i can see sometime ( mostly all times) is, that we have to move x or y position of the rectangle by 0,5 pixel to get a native view of the texture! i have same effect with othogonal projection and in pixelspace!
greetz
chritian
Re: blury picture in pixelspace and orthogonal projection
Posted: 30 Jul 2014, 09:01
by Dierk Ohlerich
This 0.5 pixel offset has to do with an "unfortunate" design decision in DirectX 9 (compared to OpenGL). It has to do with the definition of where the pixel center actually is inside a pixel. Microsoft switched to the more intuitive rules of OpenGL with DirectX 10 and later, but for now we are stuck with DirectX 9.
An explanation about what happens can be found here :
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
If you use the "pixel space" node, this is taken care for.
I made a little example how to use the node correctly - and incorrectly.
Re: blury picture in pixelspace and orthogonal projection
Posted: 30 Jul 2014, 21:26
by chriss0212
hi dierk...thx for info...
so instead of setting the rctangle to corner i use the plus 0.5 pix method....otherwise we got problems by rotating it.....readjusting of the rotation center!
and:
for 2d gui things i will still use the orthogonal projection....this is scaling correct by resizing the viewport...but of cours is not anymore pixel perfect!
and thx for the hint to use point interpolation in orthogonal pixel perfect scenes...same quality like the pixel space node
greetz
christian
Re: blury picture in pixelspace and orthogonal projection
Posted: 31 Jul 2014, 08:25
by Dierk Ohlerich
If you switch texture filtering to point filtering (from anisotropic or linear), there will be no blurring, assuming there is no scaling.
The only danger is that if the coordinates are exactly in the middle between two pixels, the GPU might round different for some of the vertices. This will result in a clearly visible diagonal line. If this happens, just move the rectangle a little bit and it will snap into position. But be careful: Worst thing that could happen is that it looks OK in your office but later looks bad on the production machine.