Problem using multiple render targets for deferred shading

Started by
4 comments, last by FeverGames 15 years, 2 months ago
Hi, I´m doing deferred shading for the first time and I´m having a problem with using multiple render targets and cannot figure out the cause. I´m rendering the depth to a R32F texture which I set as render target 0. To render targets 1 and 2 I set other textures to which I render color, normals etc. Now, everything I render to render targets 1 and 2 works as it should. I can render each of those channels seperately to the screen to view them. But the depth texture is always gray, looks like value 0.5f; Even when I hardcode the value in the pixel shader to other values, like 0.0f or 1.0f, then it still comes out gray. After trying many things without any success, I tried using render target 3 for the depth instead of 0, also changed the pixel shader for that so that it writes to COLOR3, and now it works. But I still cannot figure out why, and I´m stuck with rendering dummy data to render target 0 because you cannot use render targets 1, 2, and 3 without using render target 0. I ran out of ideas and have no more clue as to where in my code I should look for the fault. Does anyone have any idea why render target 0 might behave differently than other render targets. Does render target 0 have different set of rules? Or are there render states that must be set per render target? Peter
Advertisement
Maybe if you set color as RT0, normals as RT1 and depth as RT2?
GBS
Ok, I tried what you suggested.

Depth is good now but the colors are now all gray.
Have you checked to see if the debug runtimes tell you anything?
Debug runtime doesn´t say anything
Well my scene always looks fully white. If you read the tutorial on ziggyware about deferred shading (http://www.ziggyware.com/readarticle.php?article_id=155) i think they mention the same.

maybe you can post some pictures somewhere so we can see what you mean?

This topic is closed to new replies.

Advertisement