HEy.
Ok i am trying to just get a simple pixel shader to work..
first i have rendered to a texture then i am drawing that texture to the screen using a sprite... I know this works.... but.. when i try to pixel shade the texture nothing... ALL it should do is make the screen brighter.. but instead it does nothing to the image... I must not be getting something
any ideas??
HERE IS MY SIMPLE FX FILE..
[SOURCE]
texture screenShot;
sampler2D sample = sampler_state
{
Texture = (screenShot);
mipfilter = LINEAR;
};
float4 MyShader( float2 Tex : TEXCOORD0 ) : COLOR0
{
float4 Color;
Color = tex2D( screenShot, Tex.xy) * 15;
return Color;
}
technique PostProcess
{
pass Pass0
{
VertexShader = null;
PixelShader = compile ps_2_0 MyShader();
}
}
[/SOURCE]
HERE IS MY INIT FOR THE SHADER...
[SOURCE]
HRESULT hr;
LPD3DXBUFFER pBufferErrors = NULL;
hr = D3DXCreateEffectFromFile( g_pd3dDevice,"my.fx",NULL, NULL,
0,NULL,&g_Effect,&pBufferErrors );
if( FAILED(hr) )
{
LPVOID pCompilErrors = pBufferErrors->GetBufferPointer();
MessageBox(NULL, (const char*)pCompilErrors, "Fx Compile Error",
MB_OK|MB_ICONEXCLAMATION);
}
hr = g_Effect->ValidateTechnique("PostProcess");
if( FAILED(hr) )
{
LPVOID pCompilErrors = pBufferErrors->GetBufferPointer();
MessageBox(NULL, (const char*)pCompilErrors, "Fx Compile Error",
MB_OK|MB_ICONEXCLAMATION);
}
[/SOURCE]
HERE IS MY CALL TO THE SHADER
[SOURCE]
g_pd3dDevice->BeginScene();
g_Effect->SetTechnique( "PostProcess" );
g_Effect->SetTexture( "screenShot", g_renderTexture );
g_pd3dDevice->SetRenderTarget( 0, g_backbuffer);
g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER ,
D3DCOLOR_COLORVALUE(0.35f, 0.53f, 0.7, 1.0f), 1.0f, 0);
g_screenSprite->Begin( D3DXSPRITE_ALPHABLEND );
UINT uPasses;
g_Effect->Begin( &uPasses, 0 );
for( UINT uPass = 0; uPass < uPasses; ++uPass )
{
g_Effect->BeginPass( uPass );
g_screenSprite->Draw(g_renderTexture,NULL,NULL,NULL,
D3DCOLOR_ARGB(255,255,255,255));
g_Effect->EndPass();
}
g_Effect->End();
g_screenSprite->End();
g_pd3dDevice->EndScene();
[/SOURCE]