Gracias Gracias:  3
Resultados 1 al 4 de 4

Tema: Skin Shading using multi-layered SSS

  1. #1
    Administrador y fundador. Avatar de 3dpoder
    Fecha de ingreso
    Apr 2002

    Skin Shading using multi-layered SSS

    Skin Shading using multi-layered SSS
    By Victor Malherbe

    Skin Shading using multi-layered SSS-1_pagina_1_imagen_0007.jpg

    Organic materials are probably some of the most difficult to setup, since their realism does not rely solely on the quality of their textures. CG skin often looks plastic, and, when subsurface scattering is turned on, skin tends to look like wax. Over the past few weeks, I have been trying to achieve realism when rendering skin, or at least, to obtain a skin shader which would not look terrible when rendered. After some research, I began to build a kind of “multi-layered” skin shader, which could take into account the various layers of human skin. In Blender, it means using one material for each of the layers of the skin (epidermis, dermis, and so on), mixing them together within the material nodes editor so as to obtain the final output.


    Step One: The Structure of Skin

    First, let's deal with the diffusion of our material: we will setup the specular highlights separately. Before trying to simulate the appearance of skin, we must understand its composition:

    • The upper layer of the skin is the epidermis, which scatters the light slightly. It is yellowish/grey. Under the feet for example, the epidermis is quite thick, which is why the skin appears almost yellow.
    • Then comes the dermis - it is almost red, because of the blood. Unlike the epidermis, it scatters the light a lot.
    • Though the underlying tissues (muscles, organs, cartilage, etc.) are almost unnoticeable, we will have to simulate a kind of "bak scattering" - when the ears are lit from behind, for instance, they appear red. The bak scattering could have been done within the dermal layer, since there is a “Back” factor in the SSS panel of Blender, which allows setting the front scattering and the bak scattering separately. But in the end, it enables more control to separate the bak scattering from the dermal scattering.
    • One last note about the structure of skin: in theory, there is nothing above the epidermis. However, using SSS (even in a very subtle way) will subdue the bumps of your textured models. That's why we will have to apply another layer, which will be an un-scattering diffuse layer. Doing so, you will be able to conserve all the bumpiness of your textures, and only this layer will be textured (concerning the diffuse shaders).
    • Simply take a look at the drawing, which sums up what we need to simulate. Knowing all this, we are able to begin Blending, and setting our materials.

    Subsurface scattering, alos known as SSS, is a phenomenon which has to do with the translucency of some objects, which is to say that they are not fully reflective, and neither transparent. The light beams simply bounce on reflective surfaces. They go through transparent and uniform objects, being deflected two times (when they hit the surface, and when they exit the object). But translucent objects scatter the incoming light, deflecting the beams several times in a chaotic way before the beams exit. This produces a very software looking surface. Objects that exhibit this behavior are, for example, milk, wax, potatoes, etc. Many organic objects tend to scatter light.

    Step Two : The Unscattered Diffuse
    Lighting setup: before starting the shading, we have to set up a quick, and yet usable, test scene. I've used a head model provided by Maqs on the forums, who alos gave me permission to display his model in this article.

    He deserves all thanks, since he alos helped me a lot in building my shader. You can alos use the default Monkey head mesh instead of Maqs' head model ([Space] Add>>Mesh>>Monkey), or even a head imported from MakeHuman (File>>Import>>Wavefront).

    My lighting setup is quite simple: a main Lamp (Add>>Lamp>>Lamp) to illuminate the head (with software raytraced shadows turned on) and a "Rim" lamp with a slightly blueish tint, lighting the object from behind in order to make the edges stand out. Now we can start the shading itself. Add a new material to your object (in the Materials panel, «add new»), and call it "un-scattered_diffuse". Give it a natural skin color, and set the diffuse reflection to Oren-Nayar. The Oren-Nayar diffuse shader takes into account, when rendering, hypothetical microscopic bumps on the surface, which allows it to simulate rough surfaces such as clay, clothes, dry rocks, etc. So it helps achieve a more natural shading. Don't forget to put the Spec slíder to 0.00, since we will take care of the speculars later. If you painted some nice textures for your model, apply them now, except for the specular textures. It is important to understand that even though the epidermis is the upper layer of the skin, we will not texture it, since the scattering effect would blur the bumps too much.

    Step Three : The Epidermal Layer

    Now it's on to the epidermal layer. We have to build a shader which should look like a corpse without blood, since the blood flows mainly through the dermis. In the end, it has to look gray and yellow, and needs a quite subtle SSS effect. After having added another material called “epidermis”, give it a yellowish gray color as if it was desaturated skin, and take a look at the settings I've used for the SSS (I will not detail everything, since we have to set three layers using SSS; I prefer using screenshots). Just keep in mind that for every layer, the Red radius will be twice as large as the Green radius, and the Blue radius will remain two times smaller than the Green radius (based on scientific measurements)

    Just a quik note about the SSS scale: in theory, we should be using exactly the same scale factor for all layers incorporating SSS, because our object has a fixed size. However, since the SSS radii of epidermis, dermis, and bak scattering differ strongly, it would lead to handling tiny SSS radii for the epidermis, and huge SSS radii for the other layers. Operating in this way would be imprecise, and because we're working step-by-step it is actually better to set each layer separately, without wondering if the scale factor is the same for every layer.

    Step Four : The Dermal Layer

    In reality, the dermis is red or orange, because of the blood flowing through it. When it is time to combine all diffuse layers together, we will need to be able to notice the underlying blood of the skin. So, add another material and name it “dermis”, and set a rather reddish orange tint for it. Unlike the epidermal, the dermal layer has to scatter light a lot, so we are dealing with far bigger SSS radii. Simply chek the screenshot so as to see the settings I've used. Note that we put the “Back” factor to 0.00, since the bak scattering will be handled with another shader. Once again, don't forget to put the Spec slíder to zero.

    The SSS color is set to blue. Indeed, I have noticed that setting the SSS color to blue caused the terminators (transitional areas between light and shadow) to take on the complementary orange tint, and that is what we want to happen.

    Step Five : The Bak Scattering

    Now we can take care of the bak scattering. I have preferred to separate it from the dermal layer. Doing so, we have more control on the subsurface scattering effect. Add yet another material called “back_scattering” for example, and set its color to almost black, but not pure blak - if your shader or texture has a pure blak area, nothing will ever scatter because any color multiplied by blak is still blak (pure blak is coded by [0, 0, 0]). Now in the SSS panel, turn the SSS color to red, and set the SSS radii to be quite large. It actually depends on the size of your model, but in my case I wanted to see some red on the ears, but not too much (otherwise, it would have given the feeling that the model was really tiny).

    Note that the “Back” factor of the SSS is at its maximum, whereas the “Front” factor is turned to 0. Again, put the Spec to 0.

    Step Six: Mixing All Diffuse Layers Using Material Nodes

    Let's start: add another material called “Combined_shaders”, and turn on the Node button. Open the Material Nodes editor, and within the editor load each material we created previously, using [Space]>>Add>>Input>>Material. Do it four times, and for each node assign one of the skin materials. Now it's time to mix all of the layers together. Add a screen operator using [Space]>>Add>>Color>>Mix and change the mixing method to "Screen" instead of "Mix". Now, link the epidermis to the first input of the "Screen" operator, and link the dermis to the second input. Leave the mix factor at the default value, which is 0.50. Now you can do the same with the “Back_scattering” material, using an “Add” operator this time.

    The bak scattering will be black, except in areas where the model is lit from behind. Using "Add", we are assured that the darque areas of the bak scattering won't change anything in the render, since adding pure blak ([0, 0, 0]) changes nothing. Take care to set the “Fac” to 1.00, otherwise the bak scattering will not be fully added. Of course, if you notice that the bak scattering it too strong, you can easily reduce the “Fac” instead of changing the original SSS parameters. And finally, combine the “unscattered_diffuse” with the other materials using another "Screen" operator. This time, I turned the “Fac” to 0.60. You can decide if you want to see a rather translucent skin, or a quite reflective skin which does not absorb a lot of light. To finish, link the "Screen" node to the “Output” material.

    Note: “Error” parameter: for tests renders, you should set it to about 0.5, or even 1.0. For final renders you can set it to 0.1, or even 0.05 if you want, in the case of a large render and/or more accurate calculation. In my quik tests I landed at 0.2, since I wanted quite clean renders without having to wait too long. That's all for the diffuse shaders. Now we have to mix all of these together within the Material Nodes editor in order to render all layers at the same time.

    You may have noticed that I inserted an “RGB Curves” controller after the combination of the Epidermis and Dermis. Indeed, it is far better to tweaque the color of the skin this way, rather than having to change the SSS parameters in the materials panel.

    One last thing about the "Screen" operator: in theory, we should be using a “Mix” operator to combine the layers, since we simply want the various layers to appear all together. However, the "Screen" operator provides better results, whereas a "Mix" operator tends to make the skin look flat. You should alos use a "Screen" operator, in my opinión, provided your lighting setup is not too “extreme”, so to say. In extreme lighting conditions, for example, a very strong sunlight, using a "Screen" operator will make the colors totally wrong. In the end though, whether you use "Mix" or "Screen" actually depends on the specific situation.

    It is starting to look pretty good. And yet, it still looks like rubber. Seemingly, some specular highlights are missing . so let's jump to part two!


    Step Seven: Specular Reflections on Two Layers

    The highlights that we intend to simulate come from two sources: the skin speculars (which are quite software and large) and the speculars due to the sweat on the skin, which will be brighter and more concentrated. Both specular terms will have a blueish tint, so as to counterbalance the yellow color of the skin diffusion. I personally chose to use the default Cook-Torrance specular shader, since it allows us to simulate a kind of Fresnel effect, unlike the Phong specular shader, for example (highlights have to appear brighter at grazing angles)

    Add another shader to your model and name it “Skin_soft_speculars” for example. Don't forget to put the "Ref" value to 0.0, since we are not dealing with the diffusion anymore. You can alos set the base color of the object to be pure black.

    Note: When talking about reflective surfaces, the Fresnel effect is often involved. Indeed, the reflectance of most surfaces is not the same at grazing angles, compared to the reflectance of these surfaces when seen head-on. This is called the Fresnel effect. You can see an example of this phenomenon if you look at a window: at grazing angles, you cannot see through it, the surface of the glass being more reflective than when viewed normally.

    Or in the node editor, when you have added your materials, you can turn off the “Diff” button. The most important is that these shaders only provide speculars. The Cook-Torrance specular shader is activated. Since we want the skin speculars to be software and large, set the "Spec" value to 0.1, and the "Hard" value to 10. After having put the specular color to a slightly blueish tint, you can go on and create another material, which will be called “Sweat_hard_speculars” or something similar. The only difference is that the "Spec" slíder is set to 0.3, and the "Hard" value to 30.

    Step Eight: Mixing the Specular Terms with the Diffusion –- Final Nodal Tree

    Both layers of speculars are now done. Select your “Combined_shaders” material, and open the node editor once again. Start by adding your specular materials in the node setup. Mix both specular shaders with another “Screen” operator (as usual, [Space]>>Add>>Color>>Mix and turn the mix method to "Screen"). Set the Screen factor (“Fac”) to 1.0. After this screen operator, you can insert another “RGB Curves” controller, as I did, since it enables faster control for the brightness of the speculars. To finish, add the last "Screen" operator, which will screen the speculars on top of the diffuse part of the shader. Set its factor to 1.0. The image above shows the nodal tree concerning the specular part of the shader, and the screenshot below shows the completed nodal network.

    Our shader is now ready to use. Of course, there are lots of aspects that could, and should be improved in order to achieve photo-realism. If you are not yet growing bored, perhaps you would like to go on reading. Part Three awaits you!


    In this part, I will try to give you some tricks/tips, an overview of what could be improved in the shader we've built, and beyond that some rendering tips aimed at achieving more realism.

    1. Proper Highlights Using Software Raytraced Reflections

    You may have noticed several times that specular highlights are a poor way of simulating the real behavior of light. In theory, highlights occur because brighter-than-usual objects are reflected. Speculars are in fact a cheap way of obtaining highlights. They are not able to reflect anything else that lights objects, and on top of that (in Blender at least) specular highlights do not match the correct shape of the reflected object.

    Simply take a look at the comparison on the right, and you will notice that first, specular highlights do not reflect the environment (the orange plane and the blue sky). Then, you should see how strange the shape of specular highlights become at grazing angles. They look round, whereas they should have the shape of an arc of circle, just like on the render with software reflections.

    What if we tried to do correct highlights using raytraced reflectionsí It would be expensive in terms of render-time, of course. Yet, at least we will obtain something more satisfying. Let's give it a try. All we will need to do is add another shader, which will use only software reflections, and then combine it with the original shader. I will leave it up to you to decide whether you want it to fully or only partly replace the speculars, due to the amount of render-time. Our first consideration is that since we want to see highlights only, our surface cannot be fully reflective. So how are we going to see white highlights if our material only reflects 50% of the lightí White objects would appear only 50% white, when reflected at 50%. The answer is simple: thanks to the “Emit” parameter, we are able to shade objects that are "whiter than white”. Doing so, we will get proper highlights on a surface which does not reflect all light. Just chek the render below, which shows the reflections of three planes. These three planes only have one difference: their “Emit” value is increasing, from left to right.

    If you want to use software reflections instead of specular highlights, or at least combine them together, you should keep in mind that reflections do not show the Lamp objects. So you will have to setup additional stand-in objects that can be reflected, such as spheres for standard Lamps, planes for Area Lamps. even emitting monkeys, or whatever else may be needed. You will have to place these objects at the same location and orientation of the Lamp objects, and on another layer (if you put a sphere at the exact location of a Lamp with shadows turned on, then of course there will be shadows everywhere, since the light would not even escape from within the sphere)

    Instead of entering the details of the parameters to use, I did a screenshot of the values I used to obtain the next render. Thirty- two samples are a good compromise between render time and quality. For final renders, you should use 64 or even 128 samples. Beyond these values, the noise is so unnoticeable that we can barely see the difference.

    I thinque that's all we can say about software reflections. Now all you have to do is insert your new shader into the nodal tree of the skin shader, and screen it above the diffuse part of the shader. If you want more realism, you might want to use two layers of software reflections so as to replace the old speculars. It would be logical, since we alos called two specular terms in our original nodal tree.

    2. Improving the Shader Further

    The shader we have been building is a “generic” material, which is intended to fit a lot of situations. And yet, it can be customized depending on what kind of skin you want to render. For instance, you might want to see "fuzzy" skin. Then your material should be software looking, with a kind of Fresnel effect, simulating the countless strands which appear more obvious when seen at grazing angles. Such an effect can be done by playing with some “Normal” and “Geometry” nodes in the Material Nodes editor. Or, if you do not want to do it with nodes, you can simply use a “Minnaert” diffuse shader instead of the Oren-Nayar shader I chose to use for the un-scattered diffuse. Note that the “edge enhancement” effect can alos be done using raytraced software reflections with some Fresnel. It's up to you to tweaque the material to your liking: what I propose is just a "skeleton", a base concept that you can modify and adapt as desired. Another idea to explore: when building our nodal tree, all mixing factors were fixed, but you might want to use textures to control these “Fac” values. For instance, the "Screen" factor between the dermis and the epidermis is set to 0.6, whereas it is not constant in the reality: under your feet, the skin appears yellow because the epidermis is quite thick; the lips appear almost red because the epidermis is thin in that precise area, and so on. Nothing will prevent you from painting a texture which defines the thickness of the epidermis, and then to insert it into your nodal tree so as to obtain the desired effect. Or, you might even just allow the red values of the color texture give you a "fake" epidermal thickness.

    3. Some Rendering Tips

    In conclusion, some rendering/post-processing tricks may be in order to increase the realism of your skin renders. The first trik is quite simple: so as to enhance the contrast/lighting of your render, you can use the overlay node in post-processing, by overlaying the render with itself. Of course, the colors can be tweaked using RGB Curves, some contrast corrections, and so on.

    Another piece of advice I would give is to use Ambient Occlusion! Indeed, skin tends to enlighten itself. The closer two areas are, the more saturated (orange, in the case of skin) they will look, because of the numerous bounces of light between those areas. And what is great with AO is that to some extent, it provides “distance values” of the rendered polygons. You simply need to adjust your AO pass so as to be orange, and then to multiply it to your render, just like on the image below. You will notice for instance, that the eyelids and the lips are better “drawn”, so to speak.

    In the end, we have achieved a quite realistic shader which will, I hope, help you to get rid of the commonly seen plasticlooking skin. Firstly, I would like to thanque the Blender community, which gave me a lot of helpful advice . and above all, thanque you for reading. All I need to wish you now is "Happy Blending!" Below are some test renders, showing what can be done with this shader. No post-processing was used, except for the glow.

    Some weird lighting setups on Maqs' head model

    by Victor Malherbe

    Miniaturas adjuntadas Miniaturas adjuntadas Skin Shading using multi-layered SSS-1_pagina_1_imagen_0007.jpg   Skin Shading using multi-layered SSS-1_pagina_2_imagen_0006.jpg   Skin Shading using multi-layered SSS-1_pagina_2_imagen_0007.jpg   Skin Shading using multi-layered SSS-1_pagina_2_imagen_0008.jpg  

    Skin Shading using multi-layered SSS-1_pagina_3_imagen_0006.jpg   Skin Shading using multi-layered SSS-1_pagina_3_imagen_0007.jpg   Skin Shading using multi-layered SSS-1_pagina_4_imagen_0006.jpg   Skin Shading using multi-layered SSS-1_pagina_5_imagen_0006.jpg  

    Skin Shading using multi-layered SSS-1_pagina_6_imagen_0006.jpg   Skin Shading using multi-layered SSS-1_pagina_6_imagen_0007.jpg  
    Última edición por 3dpoder; 24-05-2010 a las 23:00
    Si vas a subir un trabajo al foro, hazlo adjuntando la imagen, archivo, vídeo o lo que sea, no publicando enlaces de otros sitios.

    |Agradecer cuando alguien te ayuda es de ser agradecido|

  2. #2
    Miembro Nuevo
    Fecha de ingreso
    May 2010

    Re: Skin Shading using multi-layered SSS

    thanque you for the tut
    It explained allot, but can you re upload the images allot was guess work

  3. #3
    Administrador y fundador. Avatar de 3dpoder
    Fecha de ingreso
    Apr 2002

    Re: Skin Shading using multi-layered SSS

    En unas horas estaran online de nuevo, un saludo.
    Si vas a subir un trabajo al foro, hazlo adjuntando la imagen, archivo, vídeo o lo que sea, no publicando enlaces de otros sitios.

    |Agradecer cuando alguien te ayuda es de ser agradecido|

  4. #4
    Miembro Avatar de final20
    Fecha de ingreso
    Mar 2010

    Re: Skin Shading using multi-layered SSS

    Gracias por el tutorial, este ira directito a favoritos para cuando me toque estudiar materiales y texturas ^^

    Adicto al 3D, tan adicto que cuando veo los azulejos del baño me quiero poner a acomodar vertices

Temas similares

  1. Maya layered shader en mental ray
    Por Morfografica en el foro Render, Iluminación y Cámaras
    Respuestas: 2
    Último mensaje: 24-06-2009, 16:21
  2. Blender Multi Layered Plastic Shaders
    Por 3dpoder en el foro Blender Art Magazine nº12 (in English)
    Respuestas: 0
    Último mensaje: 13-06-2009, 02:04
  3. Convertir EditablePoly+skin --- gt; EditableMEsh+skin
    Por DraKKaR en el foro Infografía General
    Respuestas: 2
    Último mensaje: 19-03-2008, 15:04
  4. Shading map
    Por Prometeo en el foro Materiales y Texturizado
    Respuestas: 0
    Último mensaje: 07-01-2008, 09:04
  5. Cel shading
    Por xanatose en el foro Render, Iluminación y Cámaras
    Respuestas: 6
    Último mensaje: 04-10-2005, 11:00

Actualmente estos son sus permisos de publicación en el foro.

  • -No puedes crear nuevos temas al no estar registrado o no haber iniciado sesión en el foro.
  • -No puedes responder temas al no estar registrado o no haber iniciado sesión en el foro.
  • -No puedes subir archivos adjuntos al no estar registrado o no haber iniciado sesión en el foro.
  • -No puedes editar tus mensajes al no estar registrado o no haber iniciado sesión en el foro.