I'm creating an image processingish app in direct3D that does most work in PS2 shaders. I'm using multiple textures per pass, and the textures may be different sizes and aspect ratios - then I want to filter and stretch things to fit the window with minimal blurring. Usually, the images of the exact size of the window or an even multiple, I need NO/minimal filtering to be evidient. I'd like to use the same sampler setup for both.
So, my current solution is: Ortho projection 0 to 1, full window quad 0 to 1, with UVs 0 to 1, and GAUSSIANQUAD filter. I've verified by image diff that this does what I want when textures are exact or a multiple of the window size. I'm pretty happy with the filtering on image resize.
Does anyone see problems, or have ideas for improvement? Is there a more accurate sampling method or UV scheme? I was suprised that I didn't have to offset verts by 0.5 screen pixels, or UVs by 0.5/texWidth, etc. It all just worked.
Thanks,
-Zach
P.S. Currently, my projection is like thiis (0 to 1):
D3DXMatrixOrthoOffCenterLH( &g_matProj, 0.0f, 1.0,
0.0f, 1.0f,
0.0f, 1.0f);
UVs are 0 to 1, and I have a single quad 0 to 1, and my sampler looks like this:
sampler srcSamp = sampler_state {
texture = <srcTex>;
AddressU = CLAMP;
AddressV = CLAMP;
AddressW = CLAMP;
MIPFILTER = NONE;
MINFILTER = GAUSSIANQUAD;
MAGFILTER = GAUSSIANQUAD;
};
So, my current solution is: Ortho projection 0 to 1, full window quad 0 to 1, with UVs 0 to 1, and GAUSSIANQUAD filter. I've verified by image diff that this does what I want when textures are exact or a multiple of the window size. I'm pretty happy with the filtering on image resize.
Does anyone see problems, or have ideas for improvement? Is there a more accurate sampling method or UV scheme? I was suprised that I didn't have to offset verts by 0.5 screen pixels, or UVs by 0.5/texWidth, etc. It all just worked.
Thanks,
-Zach
P.S. Currently, my projection is like thiis (0 to 1):
D3DXMatrixOrthoOffCenterLH( &g_matProj, 0.0f, 1.0,
0.0f, 1.0f,
0.0f, 1.0f);
UVs are 0 to 1, and I have a single quad 0 to 1, and my sampler looks like this:
sampler srcSamp = sampler_state {
texture = <srcTex>;
AddressU = CLAMP;
AddressV = CLAMP;
AddressW = CLAMP;
MIPFILTER = NONE;
MINFILTER = GAUSSIANQUAD;
MAGFILTER = GAUSSIANQUAD;
};