Advertisement Jump to content
Sign in to follow this  

deferred rendering(MRT) problem...I think

This topic is 4096 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

I am currently trying to implement a deferred rendering system. I'm having a few problems. First, the vertex shader seems to silently fail when it tries to use the boneIndices, and it doesn't fail if i'm rendering normally( same exact vertex shader ). So what i'm left with is the model in his T-pose if I try to render with my deferred renderer. Second, I am currently creating, setting, and releasing the render targets every frame for the build pass of the deferred system because for some reason when I create the render targets once, and then just set and reset them every frame, I get a D3D warning starting on the second frame that tells me that it can't render to a texture that is already set. After I render to those targets, I set them as textures for the lighting pass. After I render, I reset the textures to NULL. Anyone have any insight?

Share this post

Link to post
Share on other sites
Your second problem is quite simple, you just need to set the render targets back to NULL (or to your next render target) before apply your g-buffer surfaces as a texture.

For your first problem there's not really enough information for me to help you. Have you tried debugging in PIX? If so, did your incoming vertex information look correct? Have you ensured you're setting the correct vertex declaration before rendering?

Share this post

Link to post
Share on other sites
Well here's what i'm doing in my render loop( in pseudocode, my project is on another computer at the moment )...

SetShaderTechnique( "buildpass" )
createRenderTarget( x4 )
clearRenderTarget( 0x00000000 ) ( x4 )
setRenderTarget( x4 )
resetRenderTargets( first one I set to the backbuffer, the other three to NULL )
SetShaderTechniqe( "lightingpass" )
SetTexture( x4 )
ResetTexture( NULL )( x4 )
DeleteRenderTarget()( x4 )

The creation and deletion of render targets was just to get around that problem temporarily. If I remove the creation and deletion of the render targets, the problem comes up( can't render to a texture being used as a texture blah blah blah ). This code executes just fine on the first frame, and then on the second frame renderModel fails because of that render target problem. I'm sorry I can't actually provide code right now, but does anything about this look wrong?

I haven't tried PIX, but it boggles my mind that if i'm using one effect/technique the animation works, and if I switch to my deferred effect/technique it stops working even though the vertex shader is identical( pixel shaders are different, but it fails before it gets to them, so it shouldn't matter ) .

A little back story....I was using software vertex processing, and when I switched over to hardware vertex processing, the indices( which were being passed as floats in texcood5 at the time ) stopped working, and the vertex shader failed. I switched to blendWeight and blendIndices( on the "forward" rendering shader ) and things started working. So I switched shaders to the deferred one, and poof, no go( but like I said same vs ). I'll have to give PIX a go, but i'm 99% sure that the data is correct.

sorry for the rambling...if this info is helpful, let me know if you can help. Otherwise I'll post some code once i'm on my other computer.

Share this post

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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!