Hi everyone!
I am trying to loop on a 1280x720 texture sampler in a pixel shader. This is the code i am using:
static const float2 rtFLFTexel = float2( 1.0f/vRenderTarget.x, 1.0f/vRenderTarget.y );
static const float2 rtFLHTexel = float2( 0.5f/vRenderTarget.x, 0.5f/vRenderTarget.y );
for( int x=0;x<vRenderTarget.x; x++ )
{
for( int y=0;y<vRenderTarget.y; y++ )
{
//Get the current texture coordinates
float2 uvScreen = float2(x,y)*rtFLFTexel;
float2 uvTexture = uvScreen+rtFLHTexel;
//Get main values from light info
float4 myData = tex2Dlod(mySampler, float4(uvTexture,0,0));
//.....do stuff
}
}
The thing is that it is only sampling the first bits but the variable vRenderTarget is set to (1280, 720). I have tryed using other functions like tex2D with no success. And i have sampled it by using the values (256, 256) but then i will lose sample positions...How can i do it?.
Thanks so much in advance :)