However, by using DirectX 9 multiple render targets (MRT), we can render up to 16 material attributes during the G-buffer creation phase (four render targets of four floating-point numbers each). A more detailed explanation appears in Section 9.3.2, on the optimization of the lighting phase.īecause deferred renderers process each object only once, conventional techniques for handling multiple material types (such as changing shaders per-object) do not translate well. In S.T.A.L.K.E.R.'s case, this is true for scenes with a few unshadowed directional lights but it's false even for a single, shadow-casting directional light (such as the sun). The actual mileage will vary depending on the data set and, more important, on your rendering engine's actual overdraw, measured as the number of pixels passing the z-test divided by the screen area.Īnother myth is that deferred shading is useless for rendering directional lights. But your application is much less likely to become bottlenecked by the CPU or the vertex pipe. The only added work is G-buffer sampling and, possibly, unpacking. When all the calculations are performed at pixel level (this is the only possible way to go with deferred shading), performance will be similar, because lighting pixel shaders for deferred renderers are not that much more complicated than those for forward renderers. The first myth-"Deferred shading is slow on current hardware"-arises mostly from the fact that the current generation of games tries to load-balance most of the lighting work between the vertex and pixel pipelines. Figures 9-1 and 9-2 show examples of a scene generated by our forward shading and deferred shading renderers, respectively.įigure 9-2 Screenshot from the Second, Deferred Shading Renderer 9.2 The Myths So, to meet our goal and to raise the visual bar-rendering high-quality, high-polygon content with fully dynamic lighting and shadowing-deferred shading was the inevitable choice. ![]() In the case of S.T.A.L.K.E.R., where we were limited both by CPU and by vertex processing and had moderate overdraw, we had almost the ideal case for deferred shading. Another factor was that forward shading engines (with traditional immediate shading architectures, such as those in Doom 3 or Far Cry) usually unnecessarily pay the high cost of repeating the same work-vertex transform, anisotropic texture filtering, parallax mapping, normal map decompression, detail texturing, and so on. Reduced CPU usage was one of the main reasons we chose deferred shading in S.T.A.L.K.E.R. ![]() Ask a representative of your favorite IHV, who will say that many games are still CPU-limited. One additional crucial fact is usually missed: the ability to cut down on large numbers of batches, which are inevitable when dynamic shadows come into the game. When most people first think about deferred shading, they envision nice algorithmic properties such as perfect depth complexity for lighting, predictable performance proportional to the lights' screen-space areas, simplified scene management, and more. Later we apply lighting as a 2D post-process using this intermediate buffer-usually called a G-buffer (Saito and Takahashi 1990)-as input to the lighting shader. With deferred shading, during scene-geometry rendering, we don't have to bother with any lighting instead, we just output lighting properties such as the position and normal of each pixel. This presentation is a good introduction to the basics, and it briefly showcases a number of techniques originally developed for and used in the game S.T.A.L.K.E.R. 9.1 Introductionįor those who are not familiar with the concepts of deferred shading, we recommend Hargreaves and Harris 2004. Because no single solution can suit all needs, this chapter should not be considered a comprehensive guide to performing deferred shading. This chapter is a post-mortem of almost two years of research and development on a renderer that is based solely on deferred shading and 100 percent dynamic lighting, targeted at high-end GPUs. The CD content, including demos and content, is available hereĬhapter 9. The CD content, including demos and content, is available on the web and for download. ![]() You can purchase a beautifully printed version of this book, and others in the series, at a 30% discount courtesy of InformIT and Addison-Wesley. GPU Gems 2 GPU Gems 2 is now available, right here, online.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |