0
\$\begingroup\$

I am trying to implement a Deferred Renderer in Direct3D11. I am fairly new to this. I already bought a book: Practical Rendering & Computation with Direct3D 11. However, this book doesnt answer many of my questions.

The Book just says "Call one of the Draw Commands to execute the Pipeline"

In the context of a deferred Renderer I would like to know How I can actually render the different GBuffers, merge them and put actual Lighting to my scene. Let's say my GBuffers should represent Diffuse, Specular and Normals. I understand that Vertex Shaders have Constant Buffers that represent my Camera through Matrices. Vertices get Transformed in shaders into ViewSpace. How Do I get my Diffuse/Specular/Normal information out of that?

Do I have to execute the Rendering Pipeline for every GBuffer? Technically do I just need to transform my vertices once in a VS and just execute my different GBuffer PS? The Context Object offers functions like "OMSetRenderTarget". The OutputMerger however is the last stage of the Pipeline, not the first...

The Book itself just calls "Present(0,0)" exactly once and doesnt explain how you actually put things together.

Sorry, quite a lot of different questions :(

\$\endgroup\$
1
\$\begingroup\$

In short, there's nothing super special about a deferred renderer when it comes to drawing the initial scene. You just submit your triangles via VBs/IBs, state, and the Draw* functions like any other Direct3D 11 application. The difference is that for a deferred renderer you use special shaders that write position, normal, and surface information to the render target instead of shaded final pixels, -and- you typically do this with multiple render targets bound.

If you are that new to DirectX 11, you should probably start with classic forward rendering first. Take a look at DirectX Tool Kit.

After that, additional passes with the g-buffer are effectively the same as classic full-screen post-processing, namely you just set up a pixel shader and bind your gbuffer as a texture, you bind another buffer as your render target, and then you draw a full-screen quad to fire it off. With Direct3D Hardware Feature Level 10.0 or better, you can use some tricks to make this easier. See FullScreenQuad.

Note that modern games typically use hybrid techniques known as forward+ rendering rather than deferred these days. See this article

\$\endgroup\$
  • \$\begingroup\$ Ah, Thank you very much. This actually clarifies my question. So I write a Vertex Shader and Pixel Shader that takes the Scene and outputs the different GBuffers? \$\endgroup\$ – Raildex Sep 10 '18 at 19:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.