books – Real-Time Rendering Tracking the latest developments in interactive rendering techniques Wed, 16 Aug 2017 13:31:51 +0000 en-US hourly 1 Seven Things for April 2, 2015 Sat, 02 Apr 2016 15:49:03 +0000 I haven’t made one of these link posts for awhile. This one’s recent news, the ones to come will have more fun stuff.

sadly, human computers mostly got “calculate this boring number” assignments and very rarely got “if i was james counterstrike and i fired this rpg at this nightorc tell me how many gibs would come out”: one of history’s true missed opportunities

Seven Things for August 19, 2015 Wed, 19 Aug 2015 13:31:18 +0000 More stuff:

  • New interactive 3D graphics books at SIGGRAPH 2015: WebGL Insights, GPU Pro 6 (Kindle right now, hardcover in September). Let me know if I missed anything (see full list here, which also includes links to Google Books previews for these new books).
  • Updated book: 7th edition of the OpenGL SuperBible. I would guess that, with Vulkan coming down the pike, and Apple going with Metal and no longer developing OpenGL (it’s back in 2010 at 4.1 in Mavericks), this will be the final edition. Future students having to learn Vulkan or DirectX 12, well, that won’t be much fun at all…
  • I mentioned yesterday how you can download the SIGGRAPH 2015 Proceedings for free this week. There’s more, in theory. Some of the links there have nothing as of right now. The Posters are worth a skim, especially since I didn’t see them at SIGGRAPH. I also liked the Studio PDF. It starts with a bunch of single-page talks that are fun to snack on, followed by a few random slidesets. Emerging Tech also has longer descriptions than on the ETech page (which has more pics and videos, however). If you gotta catch ’em all, there’s also a PDF for Panels.
  • There have been many news articles recently about not viewing screens at bedtime. Right, sure. Michael Herf (former CTO at Picasa) is the president at f.lux, one company that makes screens vary in overall spectra during the day to ameliorate the problem. He pointed me at a useful-to-researchers bit: their fluxometer site, with spectra for many different displays, all downloadable.
  • Oh, and related, a tip from Michael: Pantone stickers with differing colors (using metameric failure) under different temperature lights, so you can ensure you’re showing work under consistent lighting conditions.
  • I was impressed by HALIDE, an MIT licensed open source project for writing high performance image processing code (including GPU versions) from scratch. Most impressive is their case study for local Laplacian filters (p. 28), showing great performance with considerably less code and time coding vs. Adobe Photoshop’s efforts. Google and others use it extensively (p. 32).
  • Path tracing is all the rage for the film industry; the Arnold renderer started it (AFAIK) and others have followed suit. Here’s an entertaining path trace of interior lighting for a Minecraft scene using the free Chunky path tracer. SPP is samples per pixel:

Chunk progressive render

New CRC Books Fri, 24 Apr 2015 16:05:31 +0000 Well, newish books, from the past year. By the way, I’ve also updated our books list with all relevant new graphics books I could find. Let me know if I missed any.

This post reviews four books from CRC Press in the past year. Why CRC Press? Because they offered to send me books for review and I asked for these. I’ve listed the four books reviewed in my own order of preference, best first. Writing a book is a ton of work; I admire anyone who takes it on. I honestly dread writing a few of these reviews. Still, at the risk of being disliked, I feel obligated to give my impressions, since I was sent copies specifically for review, and I should not break that trust. These are my opinions, not my cat’s, and they could well differ from yours. Our own book would get four out of five stars by my reckoning, and lower as it ages. I’m a tough critic.

I’m also an unpaid one: I spent a few hours with each book, but certainly did not read each cover to cover (though I hope to find the time to do so with Game Engine Architecture for topics I know nothing about). So, beyond a general skim, I decided to choose a few graphics-related operations in advance and see how well each book covered them. The topics:

  • Antialiasing, since it’s important to modern applications
  • Phong shading vs. lighting, since they’re different
  • Clip coordinates, which is what vertex shaders produce

Game Engine ArchitectureGame Engine Architecture, Second Edition, by Jason Gregory, August 2014 (book’s extensive websiteGoogle Preview and Table of Contents)

Overall this is a pretty great book. It’s not meant as a graphics programming guide; rather, it’s more a course about all the aspects of actually programming a videogame. I’m impressed with its quick summaries of hundreds of different algorithms, techniques, and tools and what each is used for. It performs a valuable service, alerting the reader that a topic even exists and giving some sense of what it’s about, all in plain English. The main problem with writing about current practices is that the book is about two years old, so of course some newer techniques and tools are not covered. However, it gets you about 90% up to speed. The book is not full color, rather has color plates, and that’s just as well. Full color throughout would have been expensive and made the book quite heavy (possibly unpublishable) without adding a lot of value.

Antialiasing: generally good coverage, though it assumes the reader already knows what jaggies actually are. Discusses MSAA and FXAA, and notes the idea of MLAA. MSAA is described correctly and clearly. FSAA is covered briefly and (properly) dismissed. CSAA is covered, since at the time it was a thing. SMAA is not discussed, since it hadn’t really been picked up by games yet at the time of writing. There’s a minor typo on page 506, “4 X MLAA” when MSAA is meant.

Phong: the term Phong doesn’t appear in the index. Perhaps this is fair enough for Phong shading, which is often replaced with the more descriptive term “per pixel shading”. I blame my age and schooling for considering these to be important terms. This book has a bit of confusion on the subject, however, mixing per pixel evaluation with the implication that texture mapping fixes Gouraud shading artifacts (p. 462). This is too bad – I want to like everything about this book, since it gets so much correct. Phong illumination is not in the index, nor is Blinn-Phong. I did finally find Blinn-Phong and Phong under “lighting” in the index. In general the index is somewhat weak, as it has less cross-referencing than I would like. Presentation of Blinn-Phong is short and succinct, which is appropriate for the survey nature of this book. A set of thumbnails showing the effect of changing the exponent would have been useful. A long Wikipedia URL is given for more information; better would have been to say “Search on ‘Blinn-Phong’ on Wikipedia”, since no one will type in the URL.

Clip coordinates: Clip coordinates for a perspective view usually have a W value that’s not 1, and clipping is done on points that have X, Y, or Z values that are outside the range [-W,W] (when W is positive). Clip coordinates are what the vertex shader produces, so are important to understand properly. Unfortunately, this book gets this topic a bit wrong, but so do most texts. This text mixes clip space with Normalized Device Coordinates (NDC). This is a common “shorthand” used to explain clipping, but something of a false savings. We as humans tend to think about clipping against the NDC coordinates, but clip space is where clipping actually happens, before dividing by W. The book does point out something that is (surprisingly) rarely mentioned in other books, that along the z-axis NDC goes from 0 to 1 for DirectX.

Summary: despite my criticisms, four out of five stars, maybe higher. It covers a huge number of subjects, has much practical advice (e.g., performance and debugging tool recommendations), and is written in a clear and intelligent style. The author clearly cares about his subject and does his best to help the reader learn all about it. As important, he cuts the fluff – I didn’t see any signs of pet topics he cares deeply about that mostly don’t matter to the field. Finally, at $62.96 for a thousand-plus page book, a great price per page.

IntroToCG Introduction to Computer Graphics: A Practical Learning Approach, by Fabio Ganovelli, Massimiliano Corsini, Sumanta Pattanaik, and Marco Di Benedetto, October 2014 (Google Preview and Table of Contentsauthors’ websitepublisher’s page)

This book is about computer graphics in general. It has a focus on interactive techniques and uses WebGL for exercises (good plan!), but also tries to give a wider view of the field. Theory is favored over practice. One factor in favor of this book is that I haven’t (yet) found any serious errors. I would expect no glaring errors from these authors, researchers all. However, there are omissions or short explanations where a bit more ink would have been useful, along with a number of typos for important terms. At 375 pages (not including table of contents), this book overall feels condensed, given its scope. I sometimes found it terse and quick to jump to equations without enough background. To its credit, there are many helpful figures. The book suffers from not being fully in color, rather including just some color plates. The small book page size makes the text feel a bit crowded.

Antialiasing: somewhat abstract coverage, first talking about line rasterization in HSV space. Mentions full-screen antialiasing, mislabelling it FSSA, but fails to note that this is rarely done in practice. Important antialiasing techniques for interactive rendering, such as MSAA and FXAA/SMAA/MLAA, are not mentioned.

Phong: properly indexed and fully covered, and a warning given to the reader to not confuse shading with illumination. The difference between Phong and Blinn-Phong is covered, though it does not discuss that the exponent in each has a considerably different effect (Game Engine Architecture notes the exponent is “slightly different”, when in fact it’s about a factor of 4 different – see “R.E versus N.H Specular Highlights,” in Graphics Gems IV, also here). Oddly, fragment and vertex shaders are not listed in the index, though fragment shaders are presented in the text for the exercises. Typo, repeated in the index: “Match banding” instead of “Mach banding”.

Clip coordinates: not incorrect, just omitted. Clip space is briefly mentioned on page 117 and the text properly notes that it is not the same as NDC. Much else along the pipeline is dealt with in some depth, but clipping in homogeneous space is given a sentence. There is an interesting pipeline figure on page 121, but clipping is left out. DirectX’s range of [0,1] for the Z axis of its space is not mentioned. Classical clipping algorithms such as Sutherland-Hodgman are covered, but without mention of clip space vs. NDC space. Proper clipping for perspective views is feeling like a lost art to me. It’s an easy topic to skip – the GPU does all the clipping nowadays – but some brief coverage can help save students from screwing up the w-coordinate when writing vertex shaders. The best (and brief) online explanations I’ve seen are here and here, and by “best” I mean “basically correct”. More on this topic later.

Summary: an average of three and a half stars out of five, though it depends. This book contains solid information, could be used as a textbook for teaching graphics, or possibly a fairly-reliable (though terse) reference. It looks tough to plow through if you’re on your own, and it tends to be more theoretic than practical. In the long term, this theoretical bent is a good thing for someone learning this area – a proper foundation will serve anyone well for life, vs. memorizing ever-evolving APIs – but the book does not feel strongly connected to present-day practice. For example, it barely discusses the various types of shaders – vertex, fragment, geometry, etc. The fragment shader gets a paragraph, and no entry in the index. GLSL is mentioned but also does not have an index entry. The geometry shader is never discussed. In fairness, vertex and fragment shaders are indeed used in the WebGL exercises, there’s just not much explanation. Again, it feels like an abridged textbook, where the instructors in class would spend time on how to actually program shaders. I look forward to a second edition that is more fleshed out.


GPGPU Programming for Games and Science, by David H. Eberly, August 2014 (book’s code websiteGoogle Preview and Table of Contentspublisher’s page)

This book is tangentially related to computer graphics, but I mention it here anyway. Unlike most books about GPGPU programming, this one does not use CUDA, but rather uses DirectX’s DirectCompute. I can’t fairly assess this book, as I still haven’t taken on GPGPU.

While the book is ostensibly about GPU programming, computer graphics sneaks in here and there, and that I can comment on. Chapter 4, called “GPU Computing”, is the heart of the book. However, it spends the first part talking about vertex, pixel, and geometry shaders, rasterization, perspective projection, etc. Presenting this architecture is meant as an example of how parallelism is used within the GPU. However, this intent seems to get a bit sidetracked, with the transformation matrix stack taking up the first 8 pages. While important, this set of transforms is not all that related to parallelism beyond “SIMD can be used to evaluate dot products”. For most general GPGPU problems you won’t need to know about rendering matrices. 8 pages is not enough to teach the subject, and in an intermediate text this area could have been left out as a given.

Chapter 6, “Linear and Affine Algebra”, is an 84 page standalone chapter on this topic. It starts out talking about template classes for this area, then plows through the theory in this field. While an important area for some applications, this chapter sticks out as fairly unrelated to the rest of the chapters. The author clearly loves the topic, but this much coverage (a fifth of the book) does not serve the reader well for the topic at hand. I was strongly reminded of the quote, “In writing, you must kill all your darlings”. You have to be willing to edit out irrelevant pieces, no matter how sound and how much you love them. The author notes in the introduction, “I doubt I could write a book without mathematics, so I included chapter 6 about vector and matrix algebra.” The nature of the physical book market is “make it thick” so that it looks definitive. Putting tangential content into a book does the customer who is paying and spending time to learn about GPGPU programming a disservice. I don’t blame the author in particular, nor even the publisher. Most technical books have no real editors assigned to them, “real” in the sense of someone asking hard questions such as, “can this section of the book be trimmed back?” We have to self-edit, and we all have our blind spots.

Overall I’m a bit apprehensive about truly reading this book to learn about GPGPU programming. I had hoped that it would be a solid guide, but its organization concerns me. It seems to go a few different directions, not having a clear “here’s what I’m going to cover and here’s what you’re going to learn” feel to it. A lot of time is spent with groundwork such as floating point rounding rules, basic SIMD, etc. – it’s not until 123 pages in that the GPU is mentioned. The book feels more like a collection of articles about various elements having to do with performing computations efficiently on various forms of hardware. That said, Chapter 7, “Sample Applications”, does offer a fairly wide range of computational tasks mapped to the GPU. It’s a chapter I’ll probably come back to if I need to implement these algorithms. The author is a well-respected veteran and I trust his code to be correct. He’s done wonderful work over the years in growing his Geometric Tools site – it’s a fantastic free resource (at one point I even tried to find external grants to support his work on the site – no luck there. A MacArthur Fellowship sent his way would be great). What might have made more sense is a focused, stripped down book, half of chapter 4 and all of chapter 7, offered for $10 as an ebook treatise.

cgthroughOGLComputer Graphics Through OpenGL: From Theory to Experiments, Second Edition, by Sumanta Guha, August 2014 (book’s websiteGoogle Preview and Table of Contentspublisher’s page)

This book is, unfortunately, currently broken, because of a faulty index. The index page numbers are off by quite a bit. For example, Sutherland-Hodgeman (which should be spelled Hodgman – Angel & Shreiner’s Interactive Computer Graphics, a book I generally like, also makes that goof; no biggie) in the index is listed as page 589, but actually appears on page 556 – a 33 page error. This problem appears to be a scale problem. Entries early in the book are correct, e.g. clipping is listed as page 33 and indeed appears there. Selection is listed on page 184 and appears on page 174, a 10 page error. Near the end, homogeneous coordinates are listed as 879 but are actually 826. By curve fitting using Excel, the equation is:

 actual page number = 0.9412 * index page number + 1.4594

Let’s get past the index and mention it no more. A workaround is to use Google Books to search for the correct page number instead. [update: the author notes there is a corrected index available for download. Errata can also be found at his site.]

Of the four books reviewed, this one has the nicest layout and presentation. Full color, wide format, with helpful figures in the margins. Stylistically, the author attempts a chummy style with frequent exclamation points. Expect passages such as, “By the way, do you even know what a floppy disc is, young reader?! If not, look it up on Wikipedia.” The author has a typographic conceit, heading various sections with arbitrary camelcase, e.g., ExpeRimenT, ExercisE, ExAmPlE. I can’t fully replicate the feel here, because the capitalized letters are actually lowercase but of varying font size. This might be a cute little flourish if the book was excellent. It’s not cute.

The book is in its second edition. Though the cover says “Comprehensive coverage of OpenGL 4.3”, what this means is that two extra chapters were added to the end of the book. Even then, these chapters are as much an introduction to OpenGL 2.0 as 4.3; for example, they are the first places GLSL gets discussed. I had a theory that the first edition of this book came out before 2004, which would explain the dependence on pre-shader OpenGL for the vast majority of the book. I was incorrect; the first edition came out in 2010. My impression overall is that the author misses the days of the fixed function pipeline. This is understandable, and I had the same dilemma designing an introductory course: when do you hit the students with shader programming? It’s possible early on, though mysterious. You need a fair bit of understanding of the transformations used, as well as what a shading model is, to really get traction. Old OpenGL, with its built-in shader model and simple, clear, and now-vastly-inefficient way of specifying triangles makes for an appealing teaching environment.

So, I understand the desire to not throw the students into the deep end on day one. However, given 919 pages to work with, GLSL should be mentioned much earlier than page 745, along with vertex and fragment shaders and all the rest. The book actually ends 75 pages later after introducing shaders, with the rest being appendices. So, it has 75 pages to cover everything that has happened to OpenGL since 2004. This is insufficient.

The bulk of the book includes tangential topics, such as scan-based polygon rasterization. Rasterization of polygons with concavities is not used by GPUs, so is mostly irrelevant, though possibly useful for teaching about parity. However, the algorithm is then presented incorrectly, worrying about singularities with ray/edge testing instead of using the proper rounding rules (in contrast, Eberly presents rasterization correctly, on page 133 of his GPGPU book). As I say, I skimmed this book, but noticed one strange grouping along the way: the perspective matrix and rational Bézier surfaces are covered in the same chapter. This feels like a Jeopardy! clue for Letters of the Alphabet, “Perspective and Bézier surfaces have this in common.” “What is w, Alex?” I shouldn’t joke, but I then uncovered such a deep flaw in the book that I, well, read on.

Antialiasing: the basic idea of pixel coverage is discussed as the solution, so that’s fine. Multisampling is skimmed over, being described as if it was supersampling. There is also a bit of filler on page 797 about how multisampling in OpenGL 4.3 is done exactly as described on page 527. There’s no reason to say this if there’s no change from “pre-shader OpenGL”. A few pages past this topic I noticed the accumulation buffer is covered. This functionality is rarely used nowadays and doesn’t appear in OpenGL ES, but again it can be useful for teaching about motion blur, antialiasing, etc. The book describes the accumulation buffer, but doesn’t explain what it is for – a missed opportunity.

Phong: the index does note Phong lighting vs. shading. The description of Phong shading is correct and concise, and its relationship to Phong lighting described properly. However, both Gouraud and Phong shading are not illustrated in any form (and this is a full-color book), e.g., showing specular highlighting and how it improves with per pixel evaluation. Phong lighting itself is explained, though the author does not note that what he’s covering is actually Blinn-Phong. Again, there is no simple image showing how varying the specular exponent changes the highlight. There’s an odd notation on Figure 11.14, “(not exact plots)” for the various cosine to a power curves formed by varying the exponent. Why not exact?

Clip coordinates: the coverage here is deeply incorrect, not just a typo or oversight. On page 703 the pipeline is given as perspective division followed by clipping; the correct way is clipping followed by perspective division. There is also an odd step 5, “Projection to the back of the canonical box”, but that’s a minor detail. The author does understand the incredible difficulties involved if you attempt to clip after performing perspective division (for starters, you have to deal with division by zero). He spends the next few pages creating some method to deal with “semi-infinite segments”, which he also discusses elsewhere when talking about clipping. I admit to not carefully wading through his presentation, as the standard way to clip works fine. Eleven pages later he resolves his difficulties by presenting the rendering pipeline again, with a revised step “Perspective division with mechanism to handle zero w-values” (his emphasis), still performed before clipping. He clearly loves projective spaces, having a 46 page appendix on the topic. Unfortunately, he missed Appendix A in Sutherland and Hodgman’s original paper, or Blinn and Newell’s followup. This is extremely upsetting to see. The author seems like a nice person and clearly knows a fair bit, but there appears to be at least one small but serious hole in his education. We certainly made goofs in our book, and there are sections which I’d love to improve, but we did our best to read through existing literature before inventing our own solutions.

I don’t think I need to give a rating. It’s unfortunate, and I’m more than a bit embarrassed and hesitant to post this review, but honestly can’t recommend the book to anyone (even with the index fixed). There looks to be much valid information in the text, but as soon as trust is severely lost, the book is no good to me.

[Update: Sumanta Guha, the author, was understandably bothered by this last review, posted to Amazon; his reply is here. I stand by my review; my main regrets are attempting to be witty by my comment, “It’s not cute” and by my Jeopardy quiz. I’ll leave those bits there, and please think less of me because of them (honestly) – I apologize for them. I should also clarify that his algorithm for performing clipping after division may be correct (as I say, I did not check it), but it’s incorrect to present such a pipeline in a book that uses OpenGL, as OpenGL performs clipping before division. My main critique is that shader programming, a major part of modern GPU programming, is given only a little coverage at the very end of the book. – Eric]

Books page updated Sat, 28 Jun 2014 02:45:26 +0000 I spent an inordinate amount of time just updating the books page at this site. It hadn’t been done for about two years – I can finally check this task off the list. It took awhile tracking down related websites for each book, especially Google Books samples, which can be quite large and worthwhile for some books. I also cleaned out older volumes from the listing and updated the recommendations list.

From what I can tell – and please do tell me if I’ve missed anything – beyond API books (OpenGL and DirectX) and the GPU Pro series, there have been very few new graphics books since 2013. The major release has been a new edition of Computer Graphics: Principles and Practice. There was also The CUDA Handbook, which is somewhat graphics related but not strictly so. I also included The HDRI Handbook; even though it’s more a user’s guide, it does have some good bits about the theory of tone mapping and much else, in an area that can use more coverage. I don’t bother listing the many books about Unity 3D, the Unreal Engine, etc., since those truly fall in the area of guides.

Anyway, that’s all until SIGGRAPH, when I can take a look at what else is out there.

Seven Things for February 1, 2014 Sat, 01 Feb 2014 14:08:56 +0000 Here we go:

Paper Books are Heavy and Have a Volume Fri, 06 Sep 2013 12:46:40 +0000 I’m moving to the Boston area on Monday. One of the 258 tasks I’ve done in preparation is to deal with my bookshelves at work. I donated 13 boxes of books and journals to the Program of Computer Graphics at Cornell:

pile o' books

I’m glad they took them – who knows, maybe they’ll eventually toss most of the piles in the recycling bin (despite the sign), but at least I won’t know about it. Me, I kept my ShaderX/GPU Pro and GPU Gems series books along with a few others. I’ve enjoyed accumulating a large computer graphics library over 30 years. Raise your hand if you remember Newman & Sproull – wow, you’re old (I kept that one for nostalgia’s sake). However, once it came down to actually moving these heavy boxes and finding a spot for them all in a home office, well…

In my perfect world I pay for a book once and have it accessible to me forever, in digital form so it’s easily searchable (and weighs nothing and takes up no shelf space). Kindle’s system is getting there, but kind of a pain, you have to install an application on your PC to look at your book collection, then download each book in full if you want to examine it. Strangely, from your Amazon account you can look at the parts you highlighted in a Kindle book you own, but not the book itself. (As an aside, there are some interesting stories I see arising over the next decade, such as “Amazon proves Freddy Fredhead is deceased and so deletes his Kindle account; family mourns”.)

The Graphics Codex, which has been mentioned in this blog in the past, is pretty close to that perfect world…but it used to only be on iOS. At the time it came out only my wife had an iPad, so my copy of the Codex is tied to her device. This limitation has changed in the past week: the codex is now available as a separate web edition. Pay for it, log in from anywhere, and it’s at your fingertips. There are external links to many different resources and articles. About my only complaint is waiting 2-5 seconds for a section to first load – yes, Time Warner Cable, we consumers would like faster internet connections like they have in highly developed countries such as Latvia, and I hope Google buries you (or you wake up and do some things better and be less monopolistic).</rant> After a section’s loaded it appears to be cached and is more like a second delay to fade in.

This computer graphics reference looks great and has a bit about a large number of topics. What’s particularly nice is knowing that this resource is growing and improving over time. You can even make suggestions for new sections to Morgan McGuire, its author. He’s also made it clear that the material is “Subject to Fair Use” in the About section of the Codex. Of course, every printed work is subject to fair use, but I take this explicit wording to mean I could snip a diagram or equation and use it in a classroom lecture (and credit it), later put the lecture up on the web, and not be concerned about a Cease and Desist takedown letter coming my way. Fun fact: as of today, there are 911,708 C&D notices in Chilling Effect’s database (and that collection is mostly just those received by Google).

This is a nice feature of the web edition: you can snip from the pages. One downside is that all the lovely formatting comes at a cost: you can’t copy and paste the text characters themselves from the pages displayed. That’s mostly a quibble – I need this functionality only for code, which I probably won’t want in the same style as shown, anyway. All in all, I’m happy to buy this reference in this form, knowing I can access it at any time on any device.

And there are some nice things to snip; feast your squinties on these screenshots – click on an image for the full resolution version. The Graphics Codex is not a perfect final form of all that I’d like in a book (e.g., I can’t bookmark, highlight, write in the margins), but it’s definitely a step along the way, especially in terms of accessibility, quality, and price ($10).

Graphics Codex 1

Graphics Codex 3

Graphics Codex 2 Graphics Codex 4












“Game Development Tools 2” CFP Tue, 09 Apr 2013 05:50:15 +0000 Marwan Ansari has put out a call for participation for “Game Development Tools 2”. Proposals are due July 1, for publication around SIGGRAPH 2014. Among other things, Marwan’s the author of some wonderful (old but still useful) comprehensive articles on GPU image processing, freely downloadable in the “ShaderX^2 Tips and Tricks book”.

You can use Amazon’s Look Inside feature to see some of the first book in the “Game Development Tools” series, and the demos for the first book are also available.

Graphics Codex version 1.7 Released Mon, 03 Dec 2012 19:01:13 +0000 [This is a guest post from Morgan McGuire. His Graphics Codex is a pretty great thing for anyone who wants just about all graphics formulae and algorithms at their fingertips. It’s not a perfect venue yet, but I think this is an extremely interesting alternative to books, since the app can be constantly updated and improved. With links to working code for many of the algorithms, my first question, “how do I copy and paste?”, is covered. – Eric]

The Graphics Codex 1.7 costs $9.99 on the App Store. You can install it on multiple iOS devices (I use both an iPad and an iPhone). You also receive free (approximately-) monthly updates of new content and features. It supports all iPads, iPhones, and iPod touches with iOS 5 or later [my experience is that you need iOS 6 – there’s a refresh problem with anything older; evidently Apple has changed its scrolling support], although I recommend at least an iPad 2, iPhone 3, or iPod 4.

The Graphics Codex contains about 200 entries on essential computer graphics equations, algorithms, data, and figures. These span quite a range. For example, they include: the formal definition of the BSDF, source code for a shadow map pixel shader, LaTeX commands for image formatting, and figures commonly used in teaching. For me, the historical figures are particularly fun. The staff at the Chapin rare books library helped me to track down first editions of books including Newton’s Opticks, Durer’s perspective manuscripts, and even Lambert’s work. I then scanned these so that you can get Lambert’s law from his original derivation–a kind of vicarious graphics tourism. When lecturing, I connect my iPad to the classroom projector to display these; the students use their iPhones and iPads to pull up equations and details of what I’m writing on the board.

Every month I add new entries based on what I use in my own graphics work and requests that I receive by e-mail. I read all reviews posted on iTunes as well and respond to them with changes. I currently have a queue of 44 new entries to be added. For each one, I cite a primary source and actually implement the algorithm to ensure correctness. The citations include links to canonical (e.g., ACM Digital Library) and free (e.g., author version) PDFs in most cases, so you can quickly jump directly to the source to learn more. Since many functions are also supported under various APIs, I link to DirectX, OpenGL, Mitsuba, etc., documentation as well.

In addition to the reference material, version 1.7 includes “Lecture Notes on Rendering”: twelve long-form chapters suitable for use in an introductory (ray tracing) computer graphics course. This semester I taught graphics at Williams College using this as the primary reading material. I supplemented it with a few chapters from Fundamentals of Computer Graphics 3rd edition, Computer Graphics: Principles & Practice 3rd edition [to be released May 6, 2013 – Morgan is a coauthor], and two research papers: Kajiya’86 and Jensen ’96. The next three chapters I will add in future updates are deep explanations of Photon Mapping, Importance Sampling, and Color Theory. All of these can be used with any API, but are explicitly supported by the open source G3D Innovation Engine graphics library. G3D now includes a complete photon mapping ray tracer that matches the notation and structure of the renderers described in the lecture notes.

On the technical side, I completely rewrote the layout and scrolling engine for this release. The new GPU-accelerated version allows scrolling before layout completes, making even the longest chapters respond nearly instantly. The underlying code uses LaTeX for math typesetting and that runs on a second thread, so if you scroll really fast you’ll see the equations inserted as they are completed. I use dynamic layout instead of static (e.g., PDF) so that content can respond to changing device orientation and re-layout on font change rather than forcing the reader to scroll horizontally. This version also includes support for iPhone 5, iPod 5, and iPad mini resolutions and processors. I recommend using the latest iOS version 6.0.1 because that has the best GPU drivers, but the app supports everything back to iOS 5.1.

I can’t stress enough how liberating and rewarding it has been as an author to release material as an app instead of a book. There are no delays because I release content incrementally instead of in discrete editions, and the quality remains uncompromised by artificial publishing and marketing deadlines–I only release material when it is polished. Direct feedback from readers allows me to support them with appropriate content, and there are zero known errors; as soon as errata is collected, I simply patch the content and push it out to everyone. Selling for 10-20% of the cost of a textbook allows me to reach the hobbyists, indie developers, and students who will be tomorrow’s great developers and researchers. The down side, of course, is that I rely on “word of mouth” (e.g., blogs and Twitter) to promote the app, whereas traditional publications have marketing budgets and campaigns. Now that the app has a critical mass of content, I’m starting to promote it more actively. I look forward to readers letting me know what new features and entries to add in future months.

[p.s. here are links for the Graphics Codex homepage, and Morgan’s twitter feed (actually, he has two) and blog.]

]]> 6
Seven Things for October 28, 2012 Mon, 29 Oct 2012 01:29:00 +0000
  • There’s a new introductory book out, Foundations of 3D Computer Graphics, by Steven Gortler. I should get my copy tomorrow. Skimming through the first few chapters (you can see these on Amazon), the focus is definitely on solid theory, which I appreciate. I look forward to spending some quality time with it. (thanks, Pete)
  • The acronym for the day is MOOC, Massive Open Online Course, a free course for anyone with a reasonable computer. Everybody’s doing it: Ravi Ramamoorthi with Foundations of Computer Graphics, I’m working on the course Interactive Rendering, John Owens and Dave Luebke are doing Introduction to Parallel Programming, etc.
  • Sean Lilley has a great slideset summarizing the history of shadow algorithms for GPUs, made for this University of Pennsylvania class. Sean and others are currently working on a GigaVoxel and Sparse Textures project, blogging as they go. (thanks, Patrick)
  • You’ve probably heard of the Valve Employee Handbook. This video gives a nice summary in just two minutes. Fascinating company structure! Sounds lovely and inspiring. But, telecommuting is out. (thanks, Jason)
  • NGUI’s history: more about UI that “true” 3D graphics, but it’s for Unity. A pretty interesting tale! Moral, maybe: make libraries, not games (thanks, Renaldas)
  • A WebGL demo from another universe. Note the value set on line 10. (thanks, marpi)
  • This mask creeps me out. Instructions how to build one are here. (thanks, BoingBoing)
  • ]]>
    Books: The Good, The Bad, and Some Third Category Thu, 11 Oct 2012 17:45:05 +0000 Due to a long plane flight, this week I started reading up on WebGL in earnest, going beyond the various tutorials on the web. The two books recommended to me that I’ve started on (and skimmed through in their entirety – I need to sit down with each in front of a computer):

    WebGL: Up and Running, by Tony Parisi, O’Reilly Press, August 2012. More info about the book here, including a sample. I recall Tony from way back in the days of VRML, he had one of the first viewers for that file format, so he’s been working in this area of 3D graphics for the web for a long time. This looks to be a good book if your goal is indeed to get something on the screen fast. It’s readable, and I appreciate his use of URLs to WebGL demos and resources and (properly credited) Wikimedia images. The code samples for the book are here on github.

    It uses the popular three.js library to insulate you from the OpenGL ES roots of WebGL and hide its raw API nature. The author of three.js, Mr.doob (I don’t make these names up), notes that his work is “a lightweight 3D library with a very low level of complexity — in other words, for dummies”. Which is a fine thing, and I think I’ll be using it myself to teach introductory computer graphics. However, if you want to gaze at the occult pulsing mutation spawned of JavaScript + OpenGL ES + DOM + JSON + HTML 5, I mean, unleash the full power of WebGL itself, you’ll want to read the next book instead.

    WebGL Beginner’s Guide, by Diego Cantor and Brandon Jones, Packt Publishing, June 2012 (code here). This is a pretty impressive book overall. The authors deal with WebGL directly, adding only the glMatrix library on github to make matrix manipulation easier (this is about as minimal as you can get). This book walks through much of what WebGL does (essentially, the same as OpenGL, of course), giving lots of code examples and worthwhile illustrations. Some example programs are quite nice, with useful user interfaces allowing you to twiddle values and see the effect. The book deals with more advanced topics towards the end, such as how to render offscreen and sample the results (their example is for performing picking). There are a few minor problems with layout on my iPad (a few illustrations don’t fit and there’s an awkward scrolling interface that doesn’t quite work), and some occasional lapses in grammar, but overall the book is fine. Occasionally the authors will get distracted by side topics, like a full derivation of why you use the inverse transpose of the matrix for transforming normals, or explaining a shader that does simple ray tracing. In general, however, the book works through the key areas of the WebGL API and warns you of potential problems along the way. WebGL itself exposes you directly to vertex and fragment shaders, so if you are planning to do some serious work in this area, this book is perhaps a better choice that Parisi’s (that said, three.js itself gives you easy access to shaders).

    Personally, these two WebGL books were cheap enough on Kindle that I bought them both. The Beginner’s Guide in particular is a much better deal on Kindle – a third the physical book’s price. They’re actually better on Kindle, in that they’re in color; the physical books are printed with grayscale images. There are other books on WebGL, but these were the two recommended to me and they are both reasonable choices, depending on your goals. I would not recommend either if your primary goal is learning the fundamentals of computer graphics (though there’s a bit of that type of material in each). For learning WebGL itself and the basics of what it offers, both books are fine, with the “WebGL Beginner’s Guide” being aimed at the more “to the metal” programmer.

    JavaScript: The Good Parts, by Douglas Crockford, O’Reilly Press, May 2008. If you use WebGL, you’ll have to know at least a bit about JavaScript. Patrick Cozzi mentioned this as a reasonable guide, along with other writings by the author. I’ve only started it, but it’s pretty amusing. The book’s approach is to indeed teach only the good parts about the language and not let you know how to use the bad parts. The author recommends only one of the dozens of books on JavaScript, JavaScript: The Definitive Guide. He feels the rest are, to quote, “quite awful.”

    Update: I finished this book and thought it got better as it went along. It starts out a bit language-wonkish, too much about grammar. Skip that chapter. The most useful parts were the appendices, where he explains the various parts of JavaScript clearly and succinctly, calls out the dangerous and evil parts of the language, and explains how to steer clear of them. The author came up with JSLint, which checks your code for badness, but to be honest it’s way too a strict schoolmarm for me, hitting me on the knuckles whenever I put a left brace “{” on the wrong line. I recommend JSHint instead.

    Enough on WebGL and JavaScript, my current interests. I’ll mention just two more books that I’ve only just glanced at and so can jump to conclusions.

    Real-Time Graphics Rendering Engine (Advanced Topics in Science and Technology in China), by Hujun Bao and Wei Hua, Springer Publishing. Shame on you, Springer, for shame. A 300 page book for $169 is bad enough, but this one has a slap-dash translation that could probably have been done better by Google Translate. I’m judging only from the “Look Inside” text I can access on the Amazon listing, but I see things like a section labelled “Rending Modle” on page 5. This might be a fine book in its native Chinese, the bits of material I tried to read seemed sound enough, but the translation is, well, judge for yourself. Here’s the end of chapter summary, a section I picked at random:

    “Real-time rendering is always formed as a pipeline composed of consequential data processing and graphics calculations to generate final rasterized images. In order to achieve amazing rendering effects as well as real-time performance, GPU techniques, especially shader techniques, are introduced to utilize programmable pipelines and the parallel computing structure. Virtual geometric 3D models are transformed to be located in a virtual scene by geometrical transformation matrices. Material and/or other visual properties are then attached to those geometrical models to compute visually pleasant rendering results. As the performance of real-time rendering applications is highly emphasized, tailored shading techniques and BRDF models are employed to achieve real-time rendering results with balanced visual effects.”

    I feel terrible for these authors whose work has been so shabbily thrown between two covers.

    However, there is certainly a worse book out there, and I have to give the full-sized cover from its Amazon listing, since I expect it to disappear any day now and I want to keep it as a memento.

    Suck it, bizzatches, I got me my own book on Amazon. Yes, the title is my name, it’s ostensibly a biography; I’m not the author. I ran across it yesterday morning, and it almost made me laugh. Almost, because I hate these “books”. It’s clearly by the same people who came up with all those other automated offerings, VDM Publishing.

    I’ve posted about this so-called publisher before, here and here. VDM now has a new imprint, “Cel Publishing” (one of seventy-nine!), I expect because the Alphascript and Betascript Publisher books are fast disappearing from Amazon’s catalog as the complaints and returns roll in. The short version is that this firm has a program that grabs a random Wikipedia page and follow links from it. Once there’s enough material for a book-sized book, it spits out the contents. Some human – in this case allegedly one “Iustinus Tim Avery” (anagram server’s first hit is “Autism University”) – slaps a cover on it and it’s put in the catalog, to be published on demand.

    The most creative part of the process used to be the cover choice. In the past they were sometimes pretty amusing, but it looks like Cel Publishing has removed that fun part of the job for the “editor” and instead just uses random abstract patterns. I personally think of myself as more of a splash of chartreuse paint, but so be it. Also, the book is clearly underpriced at $38 for 60 pages. What did make me laugh is that there’s now a review of the book (thanks, Matt!).