Hi
I'm trying to render an image as a d3d texture and apply post processing filters with pixel shaders.
I use already transformed coordinates for my vertex data:
As you can see I create a tranformed quad wit the same height and widht than the image i want to draw.
The vertex coordinates are biased by -0.5 and -0.5 (As indicated in the DirectX SDK) in order to aling the pixel centers to the texel centers.
texture sampler state magfilter & minfilter are set to D3DTEXF_POINT
I'm using this texture to test if pixel/textel are aligned:
(this image has been resized to make it morevisible, the original is 16x16)
When I debug the default pixel shader (no transform at all, only sample texture and return that value)i'm obtaining for the first row green values, or reading red values 2 times .
It seems like the pixel/texels are not centered. I also noticed that te V component of a texel coordinate can change from texel to texel even in the same row.
Anyone have any clue of how to align properly the pixels? or what am I doing wrong?
thanks
I'm trying to render an image as a d3d texture and apply post processing filters with pixel shaders.
I use already transformed coordinates for my vertex data:
Code:
TVertex quad[] ={
//x y z rhw u v
{0.0f-0.5f, 0.0f-0.5f, .5f, 1.0f, 0, 0},
{(float)m_width-0.5f, 0.0f-0.5f, .5f, 1.0f, 1, 0},
{0.0f-0.5f, (float)m_heigh-0.5f, .5f, 1.0f, 0, 1},
{(float)m_m_width-0.5f, (float)m_heigh-0.5f, .5f, 1.0f, 1, 1},
};
As you can see I create a tranformed quad wit the same height and widht than the image i want to draw.
The vertex coordinates are biased by -0.5 and -0.5 (As indicated in the DirectX SDK) in order to aling the pixel centers to the texel centers.
texture sampler state magfilter & minfilter are set to D3DTEXF_POINT
I'm using this texture to test if pixel/textel are aligned:
When I debug the default pixel shader (no transform at all, only sample texture and return that value)i'm obtaining for the first row green values, or reading red values 2 times .
It seems like the pixel/texels are not centered. I also noticed that te V component of a texel coordinate can change from texel to texel even in the same row.
Anyone have any clue of how to align properly the pixels? or what am I doing wrong?
thanks