<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Blending in Limbo</title>
	<atom:link href="http://www.limbopeak.net/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.limbopeak.net/blog</link>
	<description>A repository of often offbeat Blender tutorials; and articles related to Blender and open-source</description>
	<lastBuildDate>Wed, 08 Sep 2010 17:04:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Blending multilayer skin</title>
		<link>http://www.limbopeak.net/blog/?p=1</link>
		<comments>http://www.limbopeak.net/blog/?p=1#comments</comments>
		<pubDate>Sat, 14 Aug 2010 08:35:51 +0000</pubDate>
		<dc:creator>John Merrill</dc:creator>
				<category><![CDATA[Advanced Tutorials]]></category>

		<guid isPermaLink="false">http://www.limbopeak.net/blog/?p=1</guid>
		<description><![CDATA[<p>﻿This portrait of Dr. Victor Frankenstein is my latest attempt at skin-shading in Blender.  To help diminish the trial and error that many Blender users  go through when assembling skin shaders, I have decided to outline the  process of creating the skin, and have also included a fully textured  and shaded model of <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.limbopeak.net/blog/?p=1">Blending multilayer skin</a></span>]]></description>
			<content:encoded><![CDATA[<p>﻿This portrait of Dr. Victor Frankenstein is my latest attempt at skin-shading in Blender.  To help diminish the trial and error that many Blender users  go through when assembling skin shaders, I have decided to outline the  process of creating the skin, and have also included a fully textured  and shaded model of Suzanne in a .blend file at the end of this article.</p>
<p>There is so much room for improvement in this, and every other skin shader I have seen in blender.  I would like to encourage you to experiment as much as you can with my shader, as well as others, to find any areas that can be improved.  I plan to keep working on the problem of realistic human skin and release an update to this tutorial in a few months.</p>
<div id="attachment_14" class="wp-caption alignleft" style="width: 405px"><a href="http://www.limbopeak.net/blog/wp-content/uploads/2010/08/test171.jpg" target="_blank"><img class="size-full wp-image-14   " title="test17" src="http://www.limbopeak.net/blog/wp-content/uploads/2010/08/test171.jpg" alt="" width="395" height="473" /></a><p class="wp-caption-text">Portrait of Dr. Victor Frankenstein.  Click for full-size image</p></div>
<h2>Baking Textures</h2>
<p>Skin texture maps require many subtle layers of varying detail, and blender procedural textures can provide much of the variation that is needed.  So as the first step of creating the texture maps, I experimented with various procedurals at various scales and baked the useful ones into images in my model&#8217;s UV space.   Eventually I had 10 images that were everything I needed to get a good base skin texture.  The most useful procedurals for this are &#8216;cloud&#8217; for general variation, &#8216;stucci&#8217; (with basis set to voronoi crackle) for miniscule skin cracks, and &#8216;voronoi&#8217; for bumps and pits in the skin.</p>
<p>I baked each of these three procedural textures using global coordinates at various scales that seemed appropriate.  There should be quite a few cloud textures (I used 5) ranging from very large scales to very small ones.  I made only two stucci textures at very slightly different scales, and three voronoi textures.  I also baked ambient occlusion so I would have a nice reference of the mesh&#8217;s shading when working with the texture.</p>
<p>With these images it is possible to create detailed base variations for every texture map you will need.</p>
<div id="attachment_13" class="wp-caption aligncenter" style="width: 595px"><a href="http://www.limbopeak.net/blog/wp-content/uploads/2010/08/baked.png" target="_blank"><img class="size-full wp-image-13  " title="baked" src="http://www.limbopeak.net/blog/wp-content/uploads/2010/08/baked.png" alt="" width="585" height="191" /></a><p class="wp-caption-text">Left to right: cloud, stucci (voronoi crackle), and voronoi</p></div>
<div id="attachment_72" class="wp-caption aligncenter" style="width: 583px"><a href="http://www.limbopeak.net/blog/wp-content/uploads/2010/08/variantion.png" target="_blank"><img class="size-full wp-image-72 " title="variantion" src="http://www.limbopeak.net/blog/wp-content/uploads/2010/08/variantion.png" alt="" width="573" height="191" /></a><p class="wp-caption-text">1:1 full size cropped portions of the bump, mix, and hypodermal maps,  showing variation from many layered baked textures</p></div>
<p>Next, I opened up my image editor and began building up the layers of images I baked in Blender.</p>
<p>When building up the textures, I started with a layer that has a base color, and gradually added the baked layers in, colorizing and filtering them as seemed appropriate.  Experiment with the &#8216;overlay&#8217; layer type, it can be invaluable.</p>
<p>I won&#8217;t go into more detail about the creation of the texture maps in an image editor, as there are already many in-depth tutorials on-line that cover this topic.</p>
<p>I recommend a very fine and in-depth texturing tutorial by Jeremy Johnson-Mortimer which can be found <a href="http://www.johnson-mortimer.co.uk/Text_TutP1.html  " target="_blank">here</a>.  It covers the process used to build up fine layers of detail for a face&#8217;s color map and bump map.  For creating the many color maps needed for multilayer-SSS skin, you will need to use your own judgment and intuition.</p>
<p>I will leave you with images of all of the texture maps I used, for your reference:</p>
<p style="text-align: center;"><a href="http://www.limbopeak.net/blog/wp-content/uploads/2010/08/maps2.jpg" target="_blank"><img class="size-full wp-image-9 aligncenter" title="maps" src="http://www.limbopeak.net/blog/wp-content/uploads/2010/08/maps2.jpg" alt="" width="563" height="375" /></a></p>
<h2>The Layers</h2>
<p>This skin shader uses six materials.  The hypodermal, dermal, and epidermal materials simulate the three skin layers.  There is one specular material, one glossy reflection material, and one material that is used as a mask to blend together the first three skin layer materials.  You should keep in mind that I have taken quite a bit of artistic license with which elements of color go in which layers of skin.  Referencing various scientific papers and articles about how light interacts with skin is a good starting-point.  But never be afraid to mix things up if this by-the-book approach fails to work for you.</p>
<p>Though not physically accurate, I use ramp-shading in all of my materials to tweak the results.  I use the &#8216;color&#8217; Blend method for all ramp shading.</p>
<p>There is no backscatter material in my shader because there were be no lights placed behind the head in the final image.  One can be added if necessary.   <a href="http://bensimonds.com/2010/05/31/three-layer-sss-in-blender-demystified/#more-341" target="_blank">Ben Simonds covers backscattering</a> in the tutorial for his skin shader.</p>
<p>The hypodermal and dermal materials use subsurface scattering to simulate the way light penetrates through the skin.  Keep in mind that these materials do not represent what these layers of skin actually look like when the above layers are peeled away.  They only represent the light that is reflected back to the surface.</p>
<p>The <a href="http://en.wikipedia.org/wiki/Hypodermis">hypodermal layer</a> is the deepest, and isn&#8217;t technically skin.  It is a layer of fat and blood heavily populated with veins.  For my purposes, I made its color map a faded reddish-orange. Its SSS color radii should be the largest (causing it to blur shadows the most).  The ramp shading on this layer starts with a dark brown, and fades to a bright khaki.</p>
<p>In real life, skin pigment is located at the very base of the epidermal layer.  This is so close to the <a href="http://en.wikipedia.org/wiki/Dermis">dermal layer</a> that I decided to include pigment in this layer instead.  In my shader, I made the dermal layer&#8217;s texture map the color of  the final skin.  The SSS on this layer should be very slight, but still noticeable.  The ramp shading on this layer starts with a dull brownish-red, fades to a yellowish-khaki color, and ends with the color of the skin&#8217;s pigment.</p>
<p>The <a href="http://en.wikipedia.org/wiki/Epidermis_%28skin%29" target="_blank">epidermal layer</a> is rather thin, and has a surface consisting mostly of dead skin cells.  This layer contains the bump-map, and should have no SSS enabled.  It is okay to leave this material without a color map, but I have included one anyway.  Later, after the node setup was complete, I played freely with the color ramps until I achieved a nicer result.</p>
<p>These layers represent all of the actual skin, so what&#8217;s next?  The SSS mix material.  This material should be set to shadeless. The brightness of its color map represents the thickness of the skin, and its color adds further saturation to the SSS layers.</p>
<p>Finally, we need a material to represent the sebum.  <a href="http://en.wikipedia.org/wiki/Sebaceous_gland" target="_blank">Sebum</a> is a waxy, oily layer excreted by the skin.  It tends to give faces their slight shininess, so for this layer  I used one material for specular, and another for glossy reflection.  Both of these materials should always have the bump map applied.</p>
<p>When using SSS, keep in mind that a &#8216;scale&#8217; value of 1.0 means that (as far as SSS is concerned) 1 blender unit equals one millimeter.  When I first modeled the head, I used 1 blender unit as 1 meter, and set the SSS scale value to 0.001.  Such a low scale value caused rendering errors with the SSS, so I decided to scale the head to five times its original size, and instead set the scale value to 0.005.  As everyone points out, the red radius should be the largest number, the green radius should be exactly half of the red radius, and the blue radius should be half of the green radius.</p>
<p><br class="spacer_" /></p>
<p style="text-align: center;"><a href="http://www.limbopeak.net/blog/wp-content/uploads/2010/08/shader.png" target="_blank"><img class="size-full wp-image-11 aligncenter" title="shader" src="http://www.limbopeak.net/blog/wp-content/uploads/2010/08/shader.png" alt="" width="547" height="436" /></a></p>
<p>With all materials accounted for, I turned to the nodes window.  Even though the results can be nice when using screen or add nodes, I always felt something was wrong with using these.  I opted instead  for mix nodes, with a twist.</p>
<p>Mix nodes will interpret each pixel of input into their factor channel as being a simple value between 0 and 1.  In other words, the factor channel perceives any image plugged into it as black and white.  This will make layers lose some of their color value when they are mixed.  So for the colors in the underlying layers to be amplified by the colors in the SSS mix material I had to come up with something slightly different.</p>
<p>I eventually discovered that the effect I was looking for could be achieved by splitting the RGB channels of all materials affected by the SSS mix material (including the SSS mix material itsself).  The separated RGB channels could then be mixed individually, and recombined.</p>
<p style="text-align: center;"><a href="http://www.limbopeak.net/blog/wp-content/uploads/2010/08/nodes2.png" target="_blank"><img class="size-full wp-image-7 aligncenter" title="nodes2" src="http://www.limbopeak.net/blog/wp-content/uploads/2010/08/nodes2.png" alt="" width="629" height="496" /></a></p>
<p>A complex node tree can be confusing, both to write about and to look at.  So I will talk you through the first step:</p>
<p>You take the hypodermal, dermal, and SSS mix materials, and feed each of them into a &#8216;Separate RGB&#8217; node.  Then add 3 mix nodes.  Use the first mix node to combine the red channels of each of the three materials. Use the second mix node to combine all of the green channels, and the third mix node to combine the blue channels.  When mixing, the material representing the deeper skin layer should be plugged into color1, and the higher one should be plugged into color2.</p>
<p>When you understand what&#8217;s going on in this process, you repeat this by using the same method to combine the current result with the epidermal layer.</p>
<p>After this, I applied the sebum layers with a couple of add nodes.</p>
<p>I encourage you to experiment with a similar node-tree that only uses plain mix-nodes, without the RGB manipulation that I use here.  You will find the result has much less saturation, and the hypodermis is less visible.</p>
<h2>Fine-Tuning</h2>
<p>I tested the skin in multiple lighting conditions, recreated as closely as possible to real light-intensities.  I simulated noon-time and morning sunlight, outdoor fog, and various configurations of indoor incandescent lighting.  This helped me to see how the shader reacted in different light.  After tweaking the materials in every lighting condition, the skin still wasn&#8217;t quite &#8216;real&#8217; enough.</p>
<p>Then I realized that all skin is basically that same, except for the pigment in the dermal layer.  This gave me the idea to simulate different skin pigments to fine-tune all of the shader&#8217;s materials.<br />
If you&#8217;re having problems getting the skin just right, change the pigment.  If you are making black skin, make the dermis light peach-colored.  If you are making white skin, make the dermis a very dark brown.  This will tell you if the hypodermis is too light or too dark, or if the epidermis and specular should be made stronger or weaker. Tweak your materials from this alternate dermal color until they look right when rendered together, and then return the dermis to its intended color to see how the tweaking has changed the shader.</p>
<p>Never underestimate testing a complex shader like this in as many conditions with as many variables as possible.  Just make sure you make a backup before jumping in with experimentation because you WILL very easily get lost in your own changes.  I cannot stress this enough.  Make backups at various stages in the process!</p>
<h2>Fine Hairs</h2>
<p>&#8230;and the skin is done!  Er&#8230; almost!  Human skin is bristling with tiny hairs, many of which are never even noticed without careful attention but still contribute to the look of the face.  With any face, you can add a fine layer of tiny, thin, &#8220;peach fuzz&#8221; hairs.  These are mostly noticable in dark light, and add some slight variation.<br />
Peach fuzz hairs are dense and short on the forehead, and sparse, but much longer on the upper-cheek area.</p>
<p>I also added stubble to my character.  Very, very short dark hairs with some random variation.  Beard stubble should be uniform length for the entire face, but I decided to use some longer hairs in the same particle system to add some slight craziness to the eyebrow area.</p>
<h2>The .blend</h2>
<p style="text-align: center;">There is much you can learn from studying the shader its self, so I will provide you with a .blend of the skin shader I used.  It contains scaled-down versions of all of the texture maps used in my portrait of Victor Frankenstein,  and just for fun it also includes the eyes and facial hair.</p>
<p style="text-align: center;">Notes:  This .blend was made in Blender 2.5 Beta.  You may (or may not)  experience errors if you attempt to open it in an earlier version of  Blender.  To speed up render times, the &#8216;mirror&#8217; material has been disabled and replaced with a second specular material.</p>
<p style="text-align: center;">
<div id="attachment_74" class="wp-caption aligncenter" style="width: 566px"><a href="http://www.limbopeak.net/blog/wp-content/uploads/2010/08/suzanne.jpg" target="_blank"><img class="size-full wp-image-74  " title="suzanne" src="http://www.limbopeak.net/blog/wp-content/uploads/2010/08/suzanne.jpg" alt="" width="556" height="473" /></a><p class="wp-caption-text">Suzanne has never looked so ravishing</p></div>
<p>Get the .blend: <a href="http://www.limbopeak.net/downloads/skinshading.blend" target="_blank">here</a></p>
<p><em> </em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.limbopeak.net/blog/?feed=rss2&amp;p=1</wfw:commentRss>
		<slash:comments>415</slash:comments>
		</item>
	</channel>
</rss>

