Pixel coordinates

Started by
3 comments, last by Numsgil 13 years, 5 months ago
When a pixel is rasterized to be sent to the pixel shader, are the coordinates of the pixel in the top left corner, the center, or some other corner? Does it depend on any flags or options?

That is, given a pixel at (4, 5), is the pixel's bounds (4,5) to (5,6), or (3.5, 4.5) to (4.5, 5.5)?

I've tried looking through a few different sources, but I can't find a concrete answer. I could write a test to find out, but I'm betting someone knows off hand.
[size=2]Darwinbots - [size=2]Artificial life simulation
Advertisement
For D3D9 pixel centers are at integer coordinates while texel centers are at 0.5, while in D3D10/D3D11 they're both at 0.5.
This would be DX9 (XNA actually).

Just so I'm sure I understand, when you say Texel centers are at 0.5, does that mean only when sampling from a texture inside a shader? Otherwise, when triangles are rasterized to be sent to the pixel shader, their pixels are sampled at the center of the pixel?
[size=2]Darwinbots - [size=2]Artificial life simulation
Yup. This is why you need to offset values by a half-texel when converting screen coordinates to texture coordinates. See this for more details.
Excellent link, thankyou.
[size=2]Darwinbots - [size=2]Artificial life simulation

This topic is closed to new replies.

Advertisement