Jump to content
  • Advertisement
Sign in to follow this  
VISQI

Pixel Motion Blur Error

This topic is 2782 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hey guys,
I have been trying to implement the Pixel motion blur demo from the DX SDK samples, but my problem is that the render targets are not getting anything.
here is the code to give a better picture.


void BlurApp::Render()
{
//Swap
LPDIRECT3DSURFACE9 TempSurf = mCurrVelSurf;
mCurrVelSurf = mPrevVelSurf;
mPrevVelSurf = TempSurf;

LPDIRECT3DTEXTURE9 TempTex = mCurrVelTex;
mCurrVelTex = mPrevVelTex;
mPrevVelTex = TempTex;

//Clear The RTs
V(gd3dDev->Clear(0, 0, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, 0x00000000,
1.0f, 0));
V(gd3dDev->SetRenderTarget(0, mCurrVelSurf));
V(gd3dDev->Clear(0, 0, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, 0x00000000,
1.0f, 0));
V(gd3dDev->SetRenderTarget(0, mFullscreenSurf));
V(gd3dDev->Clear(0, 0, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, 0x00000000,
1.0f, 0));

V(BlurFX->SetValue(HEyePosW, gCamera->Pos(), sizeof(D3DXVECTOR3)));
V(BlurFX->SetFloat(HBlurConst, 0.75f));

RenderToTextures();

V(gd3dDev->SetRenderTarget(0, mBBRT));

if(SUCCEEDED(gd3dDev->BeginScene()))
{
V(BlurFX->SetTechnique(HBlurTech));

UINT NumPasses;
V(BlurFX->Begin(&NumPasses, 0));
V(BlurFX->BeginPass(0));

V(BlurFX->SetTexture(HCurrVelTex, mCurrVelTex));
V(BlurFX->SetTexture(HPrevVelTex, mPrevVelTex));
V(BlurFX->SetTexture(HFullscreenTex, mFullscreenTex));

V(BlurFX->CommitChanges());

V(gd3dDev->SetStreamSource(0, mFullscreenVB, 0, sizeof(PTvertex)));
V(gd3dDev->SetVertexDeclaration(PTvertex::Decl));
V(gd3dDev->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 2));

V(BlurFX->EndPass());
V(BlurFX->End());

gFPS->Render();

V(gd3dDev->EndScene());
}

V(gd3dDev->Present(0, 0, 0, 0));
}

Basically, i am rendering the Velocities and Coloring to a texture in RenderToTextures() method. After that i just map that texture to a quad, and in the pixel shader, i do the motion blur algorithm based on the velocity of each pixel.


My problem is that the Texture is not getting any input(checked from PIX), and i checked all the values at debug runtime and they are all solid and running.
DX SDK code really made me go nuts, and i barely understood the code after looking at it for about 2 days(ain't joking), so if any one can just take a quick look at my code, i would REALLY appreciate that because i don't want to have wasted 4 days on bad code.


I really need the help on this one guys
Appreciated

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!