Fast fake SSS

March 18th, 2007 . 12 comments

I came across an article yesterday which referenced a presentation at SIGGRAPH 2004 by ATI, talking about a quick method for faking subsurface scattering in skin and had to give it a try in Blender. It’s by no means accurate, but it’s very fast and easy to set up now in Blender. The technique is apparently what they used on the Matrix: Revolutions ‘superpunch’ shot, it’s basically using UV information for finding pixel locations on the surface, by rendering a baked image of the lighting and blurring it.

Luckily, with the baking tools now in Blender, this is simple. Just set up your unwrapped model so it’s rendering as usual [1], give it a new image texture and do a Bake Render Meshes → Full Render, to get a baked image of that lighting information [2]. When you do this, it’s important to set the baking bleed margin high [3], so when you blur this image later, you don’t get the black background spilling back into the visible area.


basic render

baked lighting to the UV map

margin bleed setting

[1] Basic render

[2] Baked UV map

[3] Margin settings

Now just load that image up as an image texture on your model’s material. You can do this without saving or packing the image since it’s still in memory, but if you don’t, it’ll be lost when you next load up that blend file, so you might as well save it. The next step is to blur this image, to fake the light scattering around under the surface. You can do this in Photoshop or something, but the easiest way is to just raise the ‘Filter’ value in the image texture [4]. This sets the width of the sampling area for when the pixels are looked up during texture mapping, and is pretty much the same as blurring the image. Switch on ‘Gauss’ to use Gaussian filtering instead of the box filter. Gaussian is much softer and doesn’t leave stepping artifaces with large filter sizes like Box does. It can also help to switch off MipMaps, though this will slow down the render as a tradeoff.

Finally, you’re going to be using this image texture to provide the lighting on your object, so first turn down your diffuse shader’s reflection value (usually ‘Ref’), give this texture a UV mapping, and turn up ‘Emit’ so the material is self illuminated by the texture. There are a few ways you could go about this such as mapping the texture to affect the ‘Ref’ channel, but what I’ve done in these examples is to turn down Ref to about 0.15, Emit up to about 0.85 and map the texture to the Color channel.

Render, and there you have it [5]! I gave it a try on my recent sculpt model, and it looks interesting there too [6]. For some situations, this works just fine, but it’s only really practical for things like skin, since it’s just blurring. It won’t handle real translucency, like light coming through a leaf.

Image texture filter settings

Suzanne with fake SSS

Effect applied to a sculpt model

[4] Filter settings

[5] Suzanne rendered with the effect

[6] Applied to a sculpt model

The good thing about this technique, unlike the toon shader/shadow buffer method, is that it lets you use a standard lighting and material setup. This technique isn’t view dependent, so it will be fine in animations like flyarounds, as long as the model or light sources aren’t moving. Perhaps it would be possible to get it working in animation by means of a script – i.e. for reach frame, do the bake render, and since you’re already using that image as a texture, it should go fine. Of course this is still a cheesy hack, so bring on the real thing!

§ 12 Responses to Fast fake SSS"

  • Rui Campos says:

    Indeed it works out nicely.

    You should really make a book on Blender Materials, Lighting and Compositing, I would buy it and surely alot more people would.

    — Rui —

  • Dan Boyle says:

    ohh… a book would be nice (I’d buy it!)

    interesting article too, as always.

    -Dan

  • Matt says:

    Thanks for the vote of confidence at least 🙂 The thought of writing like that crosses my mind from time to time. If I would do it though, I’d be interested in doing more advanced stuff like about the details of how Blender’s renderer works, the pipeline, and all those sorts of technical things that aren’t really documented anywhere, but you just learn from experience and talking to people like Ton. There’s nowhere near enough documentation for Blender that’s at an advanced level – it’s all aimed at newbies, which is a shame, it keeps people at that beginner level.

    But I’m not into that at the present. Right now, while I have the opportunity, I’d rather spend my working time creating 3D than teaching about it! 🙂

  • tikki says:

    i feel kinda dumb, but how do i “give it a new image texture and do a Bake Render Meshes a*’ Full Render, to get a baked image of that lighting information”

  • Matt says:

    Hi tikki,

    You can give it a new image texture by having your faces selected in UV face select mode, and doing Image->New in the image editor. The baking options are in the top ‘Render’ menu.

  • martin says:

    As Always Matt excellent post – what kind of lighting setup are you using for the inital render, is it a combination of soft spots and area lighting

    keep up the good work – always love visiting the site as I usually pick up something new each time

    later

    M

  • Lassi (ook) says:

    Thanks for sharing! This is the first fake SSS technique I feel really comfortable using.

  • Matt says:

    Thanks for the kind comments!

    martin: Nothing special;, just spot lights. I uploaded the .blend file so you can see for yourself. The file’s not exactly in a click-and-go state to see the results above, but shouldn’t be difficult to figure out, given the instructions above.

    http://mke3.net/projects/tests/fakesss/fakesss2.blend.zip

  • martin says:

    cheers matt for that – hopefully I can get some time later to check it out

    tks again

  • martin says:

    sorry matt but i cant seem to get the baked UV mapped to appear in the UV/image editor screen – I’m applying the bake full render but it does appear to be working

    any pointers for a newbie

  • bg says:

    Hi Matt,

    I am working 90% with Maya and 10% with Blender.

    And this is one reason: there are no “real” materials for Blender!

    When will blender f.e. have finally real SSS??

    With fake SSS you will never get real skin!

    Will you make it?

  • Matt says:

    martin: make sure you’ve added a new image, with the faces of the object selected in UV face select mode.

    bg: I don’t know. Blender will have real SSS when some generous coder steps up and implements it. Right now, there don’t seem to be any plans to do so. Will I make it? No, I can’t.

Leave a Reply to tikki Cancel reply

Your email address will not be published. Required fields are marked *

What's this?

You are currently reading Fast fake SSS at Matt Ebb.

meta