Trending
Opinion: How will Project 2025 impact game developers?
The Heritage Foundation's manifesto for the possible next administration could do great harm to many, including large portions of the game development community.
In Real-Time Shader Programming, Ron Fosner describes the essential elements necessary for developing shaders in a very approachable full-color book that spans just over 400 pages.
May 15, 2003
Author: by Jeremy Jessup
In Real-Time Shader Programming, Ron Fosner describes the essential elements necessary for developing shaders in a very approachable full-color book that spans just over 400 pages. Your $49 also gets you a CD with a beta version of ATI's RenderMonkey and coded examples of many of the shaders discussed in the text.
Beginning with elementary vector math, the book moves quickly into lighting theory. The lighting chapter highlights the mathematical approximation of physically based lighting using the traditional ambient, specular, diffuse, and emissive colors in a scene. Representations for reflection and refraction are derived from Snell's law and Fresnel equations. Finally, non-photorealistic rendering (NPR) from cel shading, tonal art maps, and hatching is covered through pictures and a wealth of external references. The chapter makes for an enjoyable read by providing an understandable background to lighting techniques for non-seasoned graphics programmers.
Fosner describes how to set up the DirectX pipeline to use shaders. While he touches on some of the nuances you're likely to encounter, the DirectX section seemed a bit sparse compared to the earlier chapters. The DirectX setup calls specific to shaders were well documented; however, the chapter didn't dwell on creating the pipeline.
The book then describes several current shader creation and visualization tools. This chapter is relatively short, perhaps due in part to the newness and hence volatility of cutting-edge shader tools. While high-level shader tools, such as Nvidia's Cg and Microsoft's High-Level Shading Language were briefly mentioned, the focus was on the shader language primitives. As such, it provided a sound fundamental shader approach that is universal to all higher-level shader implementations.
With the groundwork firmly in place, a wealth of shader examples follows. Starting with the minimal vertex shader, additional functionality is layered to build more complex shaders. Sample shaders are developed using the lighting equations presented earlier. While it may take a little time to digest some of the more sophisticated examples, such as the cartoon shader, the text provides adequate descriptive detail coupled with helpful color pictures to make it easier.
The final chapter provides a vertex and pixel command reference. Each command describes the supported shader version, usage, and a short example. The book covers shader implementations for both DirectX 8.x and DirectX 9. Differences between the two versions are noted throughout the sample code and reference section. When appropriate, additional notes on specific DirectX versions are also provided, and Fosner does a good job of providing references throughout the book for further information on a subject.
While having familiarity with the rendering pipeline, I found this book very approachable and easy to understand despite not being a low-level graphics programmer. The writing and companion tools provided challenged me to explore the world of shaders and attempt to write some of my own. The tools were a great aid, since they freed me from having to write my own engine and instead let me focus on the actual shader code. Writing in pseudo-assembly may not seem like fun, but it was - especially when I could experiment with one of the precoded routines Fosner supplied and view the results of a vertex or pixel shader routine through RenderMonkey instantly.
Shaders will play an increasingly important role in game development. Fosner's book presents the introductory groundwork necessary for developing custom shaders. For the experienced shader programmer the book's depth may not satisfy, but to those new to shaders or want to experiment with different rendering effects, this book is a great place to start.
Read more about:
FeaturesYou May Also Like