Advertisement

Render Particles in 2 render targets and 1 stencil view simulaneously

Started by July 07, 2018 11:55 PM
1 comment, last by ErnieDingo 6 years, 6 months ago
  1. For Direct3D 9, Yes, sorry, I am about to upgrade, please bear with me, is it possible to render into 2 targets and 1 stencil view simultaneously.

 


pd3dDevice->OMGetRenderTargets( 1, &pOldRTV, &pOldDSV );
	

For DX9, do I have to,

I may have some performance hit,  but that's ok, I am going to upgrade anyways


pd3dDevice->SetRenderTarget(1, pParticleView);
// Render the particles
RenderParticles( pd3dDevice, pEffect, pVB, pParticleTex, numParts, renderTechnique);

pd3dDevice->SetRenderTarget(2, pParticleColorView);

RenderParticles( pd3dDevice, pEffect, pVB, pParticleTex, numParts, renderTechnique);
	
CComPtr<IDirect3DSurface9> pStencilBuffer = 0;
pd3dDevice->GetDepthStencilSurface(&pStencilBuffer);
	
pd3dDevice->SetRenderTarget(3, pStencilBuffer);

RenderParticles( pd3dDevice, pEffect, pVB, pParticleTex, numParts, renderTechnique);
	

In short, YES.  For example in DX11,  you set your GPU code up right, you can write to both rendertargets in the same draw call and Pixelshader from what I recall.   Unsure in DX9.  But I would believe you can do that in DX9.  You should only need to call your "RenderParticles" each time.

For DX9 there is a set of limitations on this - see here DX9 Multiple Render targets.  I'm sure others in the community will give you a more in depth explanation in DX9.

Indie game developer - Game WIP

Strafe (Working Title) - Currently in need of another developer and modeler/graphic artist (professional & amateur's artists welcome)

Insane Software Facebook

This topic is closed to new replies.

Advertisement