Archive for February, 2011

3D Graphics with XNA Game Studio 4.0 – Review

Monday, February 14th, 2011

I recently got a copy of the  new 3D Graphics with XNA Game Studio 4.0, which (complexity wise at least) is a good follow up book for the previous XNA GDBE I just finished going through. This new book skips entirely over the 2D aspects of XNA game development and dives straight in to getting some pretty 3D graphics on the screen. My personal preference (as I noted in my review of XNA GDBE) is towards the 3D side of graphics and game development, so I felt a lot more at home in the code and content of this book.

Sean James doesn’t fool around with a lot of fluff and fillers in the book, which I see as both an asset and a liability. It is an asset for anyone who is highly familiar with the topics in the book but hasn’t personally implemented many of them. In this case the book can be used as a great reference for code (which is most of the content of the book after all) and not have to worry about the explanations of the code blocks. This specific use is actually mentioned in the book itself as one of the uses. There are a few comments sprinkled around the C# and the HLSL code to help you along if you need it, but not so much to get in the way of quickly skimming and finding what you are looking for.

I consider this same aspect a liability depending on the person who is actually reading the book. For someone who has not done a lot of HLSL or other shader development, the amount of HLSL code with very little explanation can seem daunting, but could of course also be a great challenge for anyone who really likes to learn and grow in their abilities and is perfectly fine with having to work for their knowledge (which is much more the kind of learner that I am.) I don’t say this as a criticism of the book or its writing style, as many of the code blocks in my own tutorials are put together in the same way (although I do try to make things as easy to understand as I can). I mostly am mentioning this to let people know that if they aren’t comfortable having to think a little bit about the code they are looking at, they might want to look for their code samples elsewhere.

One of the best things about this book that I have personally had a hard time finding anywhere else is actually the great amount of HLSL code for the various different types of effects presented in the book. Deferred lighting (called prelighting in the book), skinned animations, diffuse and specular lighting, materials and shadowing are all very advanced and difficult to learn effects in shaders and all of them are presented in this book in one easy to use format. Many of these topics are ones that I have been considering implementing in my own engine for a long time, but haven’t really found any concise examples of how others have implemented similar features in their own games, and haven’t found the time to just dive in and figure the whole thing out from scratch myself.

The one problem I had with the book is the lack of color visuals that I feel the topics in this book really require to get across the level of understanding of what visually is really happening in the code. One place where this becomes incredibly obvious is in one of the images that is explained as having been generated by adding eight colored point lights to a scene with a teapot, where the image itself simply looks like a single spot light shining down from above. Using a colored image to show the color blending of the lights and the point light effect instead of the plain gray spot type output that the image looks like it is showing would greatly enhance the effect that having images at all adds to the content of the chapters. Many of the Game Development Gems books get around this issue by just including large number of high resolution glossy color print pages in the middle of the book that can be turned to whenever any other chapter needs to reference a graphic or visual help to really get their concepts across. I really feel like this is probably the only thing missing from this book.

In the end, 3D Graphics with XNA Game Studio 4.0 is a great intermediate to advanced XNA book and an especially good reference for anyone looking to start learning or to learn more HLSL shading and advanced rendering techniques. As I mentioned before, finding this much good shader code across so many varied topics in one place has been almost impossible for me in the past, and I am incredibly happy that someone has finally put something out there to help other like me be able to find and learn these topics better without scouring the internet for days at a time.

Overall I am incredibly impressed with the content and the code in this book and can’t wait to find a good way to implement similar effects into the HMEngine in hopefully a way that is easy enough for everyone to understand. Hopefully I can just find the time to get some of it done!

Book Link:

Sample Chapter:

Do NOT follow this link or you will be banned from the site!