Deferred Rendering
This article covers implementing a deferred renderer in XNA Game Studio 2.0. This was originally posted on Ziggyware, and can still be found here.
The tutorial is divided in the following chapters:
- I. Introduction
- II. Creating the G-Buffer
- III. Directional Lights
- IV. Point Lights
- V. Normal mapping and Custom Content Processor
- VI. Multiple materials
- VII. Conclusions and Future Development
You can find an implementation of this tutorial in XNA Game Studio 4.0 on Roy Triesscheijn’s Blog.
-
-
#4 written by Dark! 2 years ago
Hey Catalin I’m trying to work deferred shading into my program but for some reason (btw, I’m just using the same g-buffer setup) after I set the render targets, clear them using the ziggyware renderer, and draw my object; I immediately “resolve” them to null and I save the GetTexture()’s to pngs so I can see if they’re rendering correctly. But, they are always blank, which I don’t understand. I even rendered my object with basic effect to make sure my world/view/proj matrices were setup correctly, then switched over to deferred rendering and I always get a black screen and all the render targets are blank (well the depth buffer turns out white, and the color and normal turn out opaque black). It just feels like i’ve been running through my code a hundred times and don’t see the issue…
Any help? Thanks Catalin
-
#5 written by Dark! 2 years ago
Ahh! I figured out my problem (after writing a whole test application to debug sanely in) it came from one line of code:
GraphicsDevice.RenderState.DepthBufferEnable = true;
Calling that line of code seems to cause the frame to draw blank for the first frame (then everything would turn back to normal) BUT since I had spritebatch running I ran that line every frame to reset everything from spritebatch which in turn caused every frame to turn out empty.
Thanks anyways Catalin 8) and btw amazing tutorial my friend!
-
#6 written by Wiffledude 6 months ago
o_o All dat spam….
Anyway, good article. I’m working on an XNA game engine, and to me seems deferred rendering is the best choice. As for the material system, it seems that my best option would be to go with material ID / lighting response lookup, right, perhaps with material ID rendered as a separate render target? Is that how games usually do it? Seems a bit strange to me, but sounds like it would work fairly well. -
- Comment Feed for this Post
- Catalin Zima – XNA and HLSL blog » MVP going to Seattle :)
- Garry Williams
- Instanced Deferred Render « Sgt. Conker
- Roy Triesscheijn’s Weblog » Blog Archive » End of the year news
- Roy Triesscheijn’s Weblog » Blog Archive » Deferred Rendering in XNA4.0 Source Code
- XNA 4.0 version of the Deferred Rendering code
- Introducing Karma…
- Dozens of point lights with forward rendering. | Olhovsky
- » Deferred Shading in CubeWorld RedBeard's Dev Blog
- Deferred rendering en XNA 4.0 « Aprendiendo XNA
- [PloobsEngine] Tutorial 4 – Lights and Cameras | Ploobs
- 2ème partie–Deferred Rendering et les lumières « Xavier Quincieux – XNA
- Still working | zimpsonr
- Welcome to Project Vanquish! | Project Vanquish
- Ann Smythe
- Why deferred rendering? « Clone of Duty
- New Rendering Engine | codingnick
- Tom Clifton's Weblog » Point Light Issues With Deferred Rendering
- How to Learn XNA | Gamedevtuts+
- Cool Effects (for XNA & MonoGame) ← Int6 Studios
Didn't find any related posts :(

hi,
before i begin, I can’t English well.
I have tried to make my game using the defferred rendering which you wrote.
and, i met the troble.
when i try to make RenderTarget2D on full screen or windows mode.
like this.
renderTarget = new RenderTarget2D(
Framework.Device,
texWidth, texHeight, 1,
SurfaceFormat.HalfVector4, MultiSampleType.FourSamples, 0, RenderTargetUsage.PlatformContents);
but I just heard the error message “The active render target and depth stencil surface must have the same pixel size and multisampling type.”
i know it is caused by ‘MultiSampleType.FourSamples’
Can’t i use MultiSampleType??