Original Post
🔒 Locked
Postprocessing problem
Advertisement
Yeah, edit your post so that its readable.
EDIT: thanks unbird! Sorry akhin, didn't mean to seam like a dick
EDIT: thanks unbird! Sorry akhin, didn't mean to seam like a dick
It's probably not his fault, the thread existed before the site change, and as I have read there are issues with the transformation, especially with source code. This helped, well, a bit at least. Hope this is the way it was:
I have a problem in mechanical/CPU side of post processing.
What I am trying to do is, before rendering my regular scene , setting
render target as my custom DX surface associated with my texture
Then I try to render that captured texture on a pre-created quad mesh...
But I have problems with it :
1) Originial scene
2) not-working postprocessing
The code I tried is below :
[/quote]
//VARIABLES
IDirect3DDevice9* m_graphicsDevice ;
EngineEffect m_effect ;
IDirect3DSurface9* m_surface;
LPDIRECT3DTEXTURE9 m_texture;
IDirect3DSurface9* m_tempBackBuffer;
ID3DXMesh* PPQuadMesh;
// INITIALIZE PHASE
m_graphicsDevice->CreateTexture(width, height, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &m_texture, NULL);
m_texture->GetSurfaceLevel(0, &m_surface);
CreateQuad(nQuadZ,nQuadWidth,nQuadHeight);
//BEGIN CAPTURE PHASE
m_graphicsDevice->GetRenderTarget(0, &m_tempBackBuffer);
m_graphicsDevice->SetRenderTarget(0, m_surface);
////////////////////////////////////////////////////////////
// RENDER NORMAL SCENE
sceneObject.Render(); // mesh with many sub parts with material and textures...
////////////////////////////////////////////////////////////
// END CAPTURE PHASE
m_graphicsDevice->SetRenderTarget(0, m_tempBackBuffer);
SAFE_RELEASE(m_tempBackBuffer);
/// FINAL RENDERING
m_effect.SetTechnique("None"); // that technique really does nothing at the moment
m_effect.SetTexture("PostProcessTexture",m_texture);
unsigned int nPass ;
m_effect.BeginRender(&nPass);
for(int i = 0 ;i<nPass;i++)
{
m_effect.BeginPass(i);
PPQuadMesh->DrawSubset(0);
m_effect.EndPass();
}
m_effect.EndRender();
////// scene object rendering
void EngineMesh::Render()
{
DWORD dwNumMaterials = materials.size();
for( DWORD i = 0; i < dwNumMaterials; i++ )
{
materials.at(i)->LoadToGraphicsDevice();
if( pCustomTexture)
graphicsDeviceHandle->SetTexture(0,pCustomTexture);
m_mesh->DrawSubset( i );
}
}
/////////// create quad code
void EnginePostProcess::CreateQuad(float nQuadZ,float nQuadWidth,float nQuadHeight)
{
D3DXCreateMeshFVF(2, 4, D3DXMESH_MANAGED, VERTEXPOSTPROCESS_FVF, m_graphicsDevice, &PPQuadMesh);
float fStartX = -1.0f;
float fStartY = -1.0f;
VertexPostProcess* v = 0;
PPQuadMesh->LockVertexBuffer(0, (void**)&v);
v[0] = VertexPostProcess( fStartX, fStartY, nQuadZ, 0.0f, 1.0f);
v[1] = VertexPostProcess( fStartX, fStartY+nQuadHeight, nQuadZ, 0.0f, 0.0f);
v[2] = VertexPostProcess( fStartX+nQuadWidth, fStartY+nQuadHeight, nQuadZ, 1.0f, 0.0f);
v[3] = VertexPostProcess( fStartX+nQuadWidth, fStartY, nQuadZ, 1.0f, 1.0f);
PPQuadMesh->UnlockVertexBuffer();
WORD* i = 0;
PPQuadMesh->LockIndexBuffer(0, (void**)&i);
i[0] = 0; i[1] = 1; i[2] = 2;
i[3] = 0; i[4] = 2; i[5] = 3;
PPQuadMesh->UnlockIndexBuffer();
std::vector<DWORD> adjacencyBuffer(PPQuadMesh->GetNumFaces() * 3);
PPQuadMesh->GenerateAdjacency(0, &adjacencyBuffer[0]);
}
How did you find the original version before the site change ?[/quote]
I didn't.
About the problem: Did not look at the code closely, but the second picture looks like you are rendering to one of the dwarf's material textures, and/or using said texture as your post-process texture. So I think you've a mixup with the textures/render-targets. If you can't spot it in the source, I'd have a look at PIX.
The only thing I could find was the broken texture scene on the screen is the very first texture of the all textures of the mesh file.
As I am looking to samples I am unable to spot the error in the code above.
How can I mixup with textures and render targets ?
And how can I debug this with PIX ?
As I am looking to samples I am unable to spot the error in the code above.
How can I mixup with textures and render targets ?
And how can I debug this with PIX ?
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement

