blury picture in pixelspace and orthogonal projection

Please report bugs in this group. We will maybe populate a list of known bugs with a possibly modified description at a later time.

Moderator: Support

Post Reply
chriss0212
Posts: 665
Joined: 18 Jan 2012, 20:56
Location: wuppertal
Contact:

blury picture in pixelspace and orthogonal projection

Post by chriss0212 » 28 Jul 2014, 19:55

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

User avatar
Dierk Ohlerich
Posts: 74
Joined: 10 Jul 2012, 09:01
Location: Hamburg, Germany

Re: blury picture in pixelspace and orthogonal projection

Post by Dierk Ohlerich » 30 Jul 2014, 09:01

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.
Attachments
PixelPerfectTexture.vza
(14.84 KiB) Downloaded 221 times
-- Dierk Ohlerich

chriss0212
Posts: 665
Joined: 18 Jan 2012, 20:56
Location: wuppertal
Contact:

Re: blury picture in pixelspace and orthogonal projection

Post by chriss0212 » 30 Jul 2014, 21:26

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

User avatar
Dierk Ohlerich
Posts: 74
Joined: 10 Jul 2012, 09:01
Location: Hamburg, Germany

Re: blury picture in pixelspace and orthogonal projection

Post by Dierk Ohlerich » 31 Jul 2014, 08:25

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.
-- Dierk Ohlerich

Post Reply