Jump to content
  • Advertisement
Sign in to follow this  
lucky6969b

3D Render Particles in 2 render targets and 1 stencil view simulaneously

Recommended Posts

Posted (edited)
  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);
	
Edited by lucky6969b

Share this post


Link to post
Share on other sites
Advertisement

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!