Render targets don't work... ...just one pass

(Visual C++ 2010, DirectX)

Hi there,

I ran into problems in my new project where I want to apply a gaussian blur shader. I've already done it before and it worked perfectly, so I just pretty much copied/pasted it, but it doesn't work, but in a very strange way...

It is simple - shader "white" takes care of classic 3d space transformations and lighting, "blurh" blurs image horizontally and "blurv" blurs it vertically, so I just want to
1) render 3D scene to a viewport-sized texture,
2) render this texture to a quad and blur it horizontally,
3) blur this texture to a quad and blur it vertically.

I am assigning trender target to the device by calling Dev->SetRenderTarget(0,surface) and I am properly setting the chain of textures. But even if I am in step 3 assigning texture of the quad to the texture in which I rendered in step 2, it seems like it always sets itself to the texture in which I was rendering in step 1 (the result is same if I paste there t0.tex or t1.tex). I have compared this code to the code of project where it is working. It does exactly the same thing, aet it doesn't assign the texture correctly.

If I comment out the rendering in step two, framerate incereses rapidly, so it actually is rendering somewhere. I tried switching textures or shaders, few different ways - it stills ignore everything in the second step. I don't have a clue, what is causing it. There's no logic in it, every texture or its surface looks right - and if it didn't, it would call an error and not set some other random texture. I even debugged the textures, they have different pointers, so they are not the same.

Here is the code (without tranformations settings and rendering):
[code]Dev->SetRenderTarget(0,; // = t0.tex surface level


//rendering mesh...

Dev->SetRenderTarget(0,; // = t1.tex surface level

//rendering screen quad...

Dev->SetRenderTarget(0,backbuf); //backbuf = back buffer surface


Could you please take a look at it and tell me, what could be wrong? I am done with ideas here... :( And sorry for my English, if it is too crappy...
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!