Notes on Skin Shading

If you've followed my musings for a while, you'll know that I real-time skin shading is one of my favorite topics to read about, regardless of what I'm actually working on professionally. It's been a while since I've posted on the subject which is a bit remiss since there's a useful note on Pre-Integrated Skin Shading that I believe I've neglected to post here (I skimmed through my history and couldn't see anything about even though I know I had the intent to), and a few useful presentations have discussed techniques in the past year or two that I've never mentioned here. For reference, a younger version of myself has written very mediocre posts on the topic here and here. I figure I ought to continue that trend.

First and foremost, in response to my original post about implementing Pre-Integrated Skin Shading (PISS) into Unity3d, David Neubelt from Ready at Dawn (and I saw it on the comments at least somewhere where that post got reposted) pointed out a minor bit of incorrect math in the generation of the look-up texture. If you the examine the math in Penner's slides, you'll see the following figure:

$ D(\theta) = \dfrac { \int_{-\pi}^{\pi} \cos (\theta + x) \cdot R(2 \sin (x / 2))\,dx } { \int_{-\pi}^{\pi} R(2 \sin (x / 2))\,dx } $

What's of interest here is the limits of the integral. If you go and look at my Unity code in my old post about PISS, you might notice in the sample code that I use $-\pi \over 2$ to $\pi \over 2$ for the integral's loop. This is an error that I carried over from Penner's sample code in GPU Pro 2. When corrected to $-\pi$ to $\pi$ to match the integrals in the equations, there are only subtle changes, but those subtle changes are for free at run-time from improving the look-up texture quality, so there's no reason not to have them.

Speaking of David from Ready at Dawn, him and Matt Pettineo have included their experiences with using PISS in the upcoming title The Order: 1866 in their presentations at SIGGRAPH and GDC. They include useful math for combining PISS with Spherical Harmonic lighting. In fact, all of the sets of course notes from the Physically Based Shading course at SIGGRAPH are worth looking at if you haven't already.

Finally, I saw John Hable's talk at GDC this year about his experiences with trying to produce high quality, compressed facial animation. The interesting bit about his presentation is that he touches briefly about skin rendering towards the end. He has an interesting approach on shading that goes back to Texture Space Diffusion, which is what most modern techniques have used as a reference for a high quality result but have tried to get away from for more performant options. The key bit to Hable's approach is that instead of doing multiple convolutions, he does a one-pass approximation in a 256x256 texture. It seems like this might have some advantages in certain contexts over PISS or screen-space techniques, but obviously it suffers from the inevitable scaling issues of needing to process a separate texture for each character visible on screen at the same time.