Book Review: HLSL Development Cookbook

Warning! Some information on this page is older than 5 years now. I keep it for reference, but it probably doesn't reflect my current knowledge and beliefs.

Aug 2013

I've been given a chance to read a book HLSL Development Cookbook published recently by Packt Publishing. Below you can find my review. Packt has proposed to offer 3 digital copies of the book. Keep reading to find out how you can win a copy.

The book has 224 pages. Its author - Doron Feinstein - works as Senior Graphics Programmer in Rockstar Games. The book is about implementing various rendering techniques in HLSL using DirectX 11. It uses new features of this API, e.g. geometry shaders, compute shaders, UAV, tesselation etc. It presents very professional approach and does not over-simply anything for educational purposes (for example, the author uses linear space for color computations, explains HDR rendering and passes reciprocal value as constant where appropriate as multiplication is faster than division).

The book assumes that reader already knows DirectX API and is able to code a framework that loads meshes, textures, constant buffers and all the stuff and pass it to GPU rendering. He should also already know the concept of shaders and the HLSL syntax, not to mention math/geometry basics of 3D graphics (like properties of dot product or transformation matrix). So this is definitely not a book for complete beginners who want to learn game programming from scratch. It does not even give complete shaders to just copy-paste into your engine, but fragments (functions) that are interesting in some technique. Which I think is good, because where per-pixel parameters of your material come from (like albedo color, normal vector, specular intensity and exponent) - whether from texture, a constant or some computations - is up to you and the book focuses on what to do with it without boring, multipage code listings.

Subsequent chapters cover following topics:

  1. Forward lighting: Describes straightforward implementation of different types of lights - hemispheric ambient light, directional light, point light, spot light and capsule light (with explanation of Lambert law for diffuse, and Blinn-Phong model of specular), as well as texture projection from point light and spot light.
  2. Deferred Shading: Introduces concept of deferred lighting (requires rendering geometry 2 times) versus deferred shading (requires rendering geometry 1 time, used in this book). Mentions different ways of storing nomals in GBuffer and of course reconstructing world-space position from Z-buffer depth. Shows implementation of same types of lights in the deferred way.
  3. Shadow Mapping: Covers shadows from spot lights and point lights, PCF (Percentage-Closer Filtering), Cascaded Shadow Maps for directional light, PCF with varying prenumbra size and visualizing shadow maps with silhouettes highlighting.
  4. Postprocessing: Describes HDR Rendering (calculates average luminance for tone mapping in compute shader) with exposure adaptation, Bloom, DOF (Depth of Field) and Bokeh (all done on GPU).
  5. Screen-space effects: Describes SSAO (Screen Space Ambient Occlusion), lens flare (using occlusion query and predicate query), reflections and sun rays, all done as screen-space effects.
  6. Environment effects: Describes dynamic decals (as an example of using stream out feature to generate mesh on GPU), distance/height-based fog and rain (as simple example of stateful particle system colliding with scene geometry, calculated entirely on GPU).

That's not a "gems"-style book with every chapter being a separate article written by different author. But each chapter is a complete "recipe" for a rendering technique, whether an implementation of particular type of light or some other visual effect. Each one of them is divided into sections:

As you can see, described topics are not some sophisticated and specialized effects like rendering foam on an ocean coast or crowd on a stadium, but fundamental techniques needed by every engine. Just as the book says: "Lighting and postprocessing are two of the most important fields in 3D rendering."

Summary: This book is not intended for complete beginners, but if only it fits the knowledge you already have and the knowledge you currently seek, I think this it can be a great step on you path of learning game/graphics programming.

Now here is how you can have a chance to win eBook copy of this book: All you need to do is head on over to the book page, look through the product description of the book and then drop a line via the comments below this post to let us know what interests you the most about this book. 3 best comments win!!! Deadline: The contest will close in 1 weeks time. Winners will be contacted by email (before the end of this month), so be sure to use your real email address when you comment.

Comments | #books #competitions #reviews Share


[Download] [Dropbox] [pub] [Mirror] [Privacy policy]
Copyright © 2004-2021