Hard Light Productions Forums
Off-Topic Discussion => Programming => Topic started by: blackhole on February 16, 2009, 04:30:20 pm
-
Result:
(http://img88.imageshack.us/img88/148/wtfpixelsiy3.png)
Shader:
float strength = 1.29878f;
float offset = 0.15534f;
float height = 2.43380f;
float move = 0.0f;
texture g_tile;
//sampler s0 : register(s0);
sampler s0 = sampler_state
{
Texture = <g_tile>;
MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;
};
float4 ps_main(float2 texCoord : TEXCOORD0) : COLOR
{
float x = texCoord.x-0.5f;
float y = strength/(texCoord.y+offset);
float ymod = strength/texCoord.y;
x = x/height;
float2 ncoord = float2((x*ymod)+move, y);
return tex2D(s0, ncoord);
}
technique ground
{
pass single
{
PixelShader = compile ps_2_0 ps_main();
}
}
Execution Code:
if(!effect) return; //later we'll put in some placeholder image, but for now just fail
_sblock->Apply();
SETEFFECTPARAM("move", COP(cDirectX)->getCamera()->x/_xreduct);
UINT iPassCount;
//effect->Begin(&iPassCount,D3DXFX_DONOTSAVESAMPLERSTATE);
effect->Begin(&iPassCount,0);
COP(cDirectX)->getDevice()->SetRenderTarget(0, rendersurface);
//COP(cDirectX)->getDevice()->SetTexture(0, _bgtex->tex);
effect->BeginPass(0);
COP(cDirectX)->DrawFullScreenQuad(0.0f,0.0f,1.0f,1.0f);
effect->EndPass();
effect->End();
COP(cDirectX)->getDevice()->SetRenderTarget(0, COP(cDirectX)->_curframe); //reset our rendertarget
WHY IS THIS NOT WORKING?!
(i'm also posting this on gamedev.net since they know more about this stuff)
-
Ok, generating mipmaps for my images would be a good idea...
solved.