Jump to content
  • Advertisement
Sign in to follow this  
Norman Barrows

Blending skin textures

This topic is 552 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm testing Manuel Bastioni Lab.

http://www.manuelbastioni.com/manuellab.php

It's a character generator plug-in for Blender.

Couple of clicks, wait a few seconds, and you have a humanoid ready to convert to a textured and rigged skinned mesh, which you can then clothe and animate.  Really impressive stuff.  

As part of the conversion to skinned mesh, it generates a number of skin texture maps.

In Caveman 3.0, I'm just using a single skin texture for each skin tone, of which there are about 30 or so in the game.

My question is, how should i blend these output textures into a single texture for use in the game?  I'm thinking layers with some type of blend function done with a paint program. 

Bastioni Labs generates 5 skin textures for a model:

 

1. a complexion texture.

 

gallery_197293_593_1496061.png

 

2. a Dermal texture:

gallery_197293_593_380920.png

 

3. A Details texture:

gallery_197293_593_1028129.png

4. A displacement texture:

gallery_197293_593_5473.png

 

5. A Sub-dermal texture:

gallery_197293_593_1941579.png

 

The displacement texture is used for muscle and wrinkle details i suspect. The model didn't have any such details, so the texture is solid gray.  The details texture is shaved hair and makeup.  The model is an African female, so the skin tone should be dark.   Should i blend dermal, sub-dermal, complexion, and details in equal parts?  use complexion as an alpha map to blend dermal with sub-dermal? Then overwrite with detail?  I haven't started playing around with it yet. I figured someone more familiar with character texturing might know how they are supposed to be combined.

 

Adding them with translucency didn't yield much, but multiplying them all together with no translucency got me this:

gallery_197293_593_317696.jpg

 

The eye color is not correct. I haven't figured out how to control iris color yet in Bastioni Lab, but the whites of the eyes are off as well.

Edited by Norman Barrows

Share this post


Link to post
Share on other sites
Advertisement
My question is, how should i blend these output textures into a single texture for use in the game?  I'm thinking layers with some type of blend function done with a paint program. 

These skin textures are inputs for shader effects, no amount of blending will create the same kind of skin material.

Think of it like this, if you blended the normal map with the color there would be no way that it would provide the same bumps as using the normal map in the shader. In fact if you mixed the blue normal with the skin it would tint it all blue, that is similar to what happened when you added them.

You need their shader to use these textures. You could attempt to reverse engineering it, although contact them first, you don't want legal problems.

Edited by Scouting Ninja

Share this post


Link to post
Share on other sites

Should i blend dermal, sub-dermal, complexion, and details in equal parts?  use complexion as an alpha map to blend dermal with sub-dermal?

Dermal is the colour of the skin itself, while subdermal is the color of the flesh underneath - don't use the sub-dermal map at all, unless you decide to write a sub-surface scattering shader. SSS is an effect in modern games which makes skin look more like wax than like clay, by simulating the fact that diffused light rays will exit skin/wax some distance from the point that they originally entered the material. While travelling inside the material, these rays will be discolored according to the sub-dermal map. The end result is the bumps in the surface will be softer, with their dark sides more red tinted, and shadows will have a slight red tint at their beginnings.

I would probably use the dermal map as-is, or use the complexion map as an alpha value to blend between a constant dark-skin colour and a light-skin colour, and then blend the details texture over the top of that.

 

Does the details texture have an alpha channel in it? If so, it should probably be alpha-blended, otherwise probably multiply/modulate blended...

 

[edit] Looking again, it seems the area with the eyes is just flat middle-grey in the complexion texture. That hints to me that middle grey means "no change" to dermal, lighter means tinting the dermal texture towards "low melanin skin" and darker means tinting it toward "high melanin skin"?

 

One trick that we've used in the past to re-tint dermal maps to a new skin tone is:
1) Find the average colour of the dermal map (e.g. repeatedly downsample to 1x1 pixel).
2) subtract this average colour from every pixel to create a local tint map (n.b. this creates a signed result texture -- you can use a 127-signed-offset format if you need to save this to disk in 8bit...).
3) add the new skin colour to every pixel.

An alternative method is: at (2) use division instead of subtraction and at (3) use multiplication instead of addition.

Edited by Hodgman

Share this post


Link to post
Share on other sites

You should be able to bake a full render into a new UV Map. Google for 'Blender Texture Baking'. HTH

I'd second this, very useful technique in blender, with the added advantage that you can bake in ambient occlusion / whatever takes your fancy. Other than that, photoshop, gimp, etc will give you some results, except for the displacement / normal mapping if you want to bake this in (unless using an extension).

However given that the plugin is giving you all these channels (for free essentially), I'd be tempted to change your character shader to include at least an extra channel for something like a combined specularity / roughness channel (you could stick it in the alpha of an RGBA texture for instance?). You could probably derive your desired channel with a bit of tweaking / artistic license. :)

(this is presuming you are using normal forward shading and it would easy to put in a specific character shader)

Share this post


Link to post
Share on other sites
You should be able to bake a full render into a new UV Map. Google for 'Blender Texture Baking'. HTH

Baking is a good idea, although you would have lots of problems. Shadows, specular and shading will be frozen, making the model conflict with the shading in game.

Splitting the bakes into passes would be a better idea. You can bake color using the full render pass and turning off the shadows and specular.

Bake a specular map using Blenders specular bake options, if it can't pull the specular from the shader then make one in Photoshop/ Gimp by averaging a BW of the collor texture.

Bake a subsurface from the shader with Blender, if you can't, then invert your normals and bake a AO map to get a thickness map, use it as your subsurface input.

Edit: Blender can't bake thickness it doesn't cull backfaces during render; most render software don't. Use Xnormal.

For a glossy map the oil layer should work, see if you can bake it. If you can't bake it using lights or by mixing textures you have. I would start with ((Dermal texture BW * complexion texture) thickness map) then maybe use a leveler to get the right look and brush in some highlights.

 

This setup should work with all simple skin shaders.

Edited by Scouting Ninja

Share this post


Link to post
Share on other sites

These skin textures are inputs for shader effects

I sort of suspected as much. 

don't use the sub-dermal map at all, unless you decide to write a sub-surface scattering shader.

The output from Bastioni is designed with games in mind, so i'm not surprised that it generates all this data - much more than i currently use. Apparently the skeleton is designed to be compatible with popular mocap formats as well.

You need their shader to use these textures.

To use them directly - yes.   I'll have to check into their shader. they make mention of it. but quick renders in blender aren't that impressive.  OTOH, i only use Blender for modeling and animation, not rendering, So its probably just me not knowing what i'm doing. 

You should be able to bake a full render into a new UV Map

A good point. if they don't have shader code i can use, but their shader output is satisfactory, i can use Blender to make the final texture. But if their shader output in blender is not satisfactory, i'll have to blend them myself - either pre-baked, or with my own shader.

Does the details texture have an alpha channel in it?

Unknown. Haven't checked out any alpha yet. In paint.net, i get blend (alpha) values from 0-255, and about a dozen blend methods (add, mul, dodge, etc) to work with.

it seems the area with the eyes is just flat middle-grey in the complexion texture. That hints to me that middle grey means "no change" to dermal

yes, i noticed that too.  I would have thought that the eyes would have blank areas  the way the teeth do.  In the game, i draw eyes as separate static meshes attached to the head bone.  I've already tested cutting the eyes out of these new skinned meshes. works just fine. I should be able to plug the existing eyes right in, no problem.  So i'm not totally spazing when it comes to the eyes.  A non-trivial amount of time was spent getting the existing eye textures just right. They can even do motion tracking - although Bastioni Lab comes with full face morph animation capabilities.

One trick that we've used in the past to re-tint dermal maps to a new skin tone is:

I've had good results from paint.net and tweaking brightness, contrast, hue, saturation, and input and output levels.  I was able to create all the skin tones from a single dermal texture. But i'm still not happy with my asian skin tones, and would like a greater variety of skin tones for some of the darker skin tone groups. The problem is that sub-saharan african skintones cover a narrower spectrum of shades than northern european skin tones for example. So you can cover sub-saharran with 3 tones, but need 5 for europe. Adding more choices for sub-saharran would be nice, but  the differences would be more subtle.

One advantage of your method is that you don't clamp to 0.0 thru 1.0 during your intermediate calculations. Using a paint program, you're more limited in the range over which you can manipulate values.

So i guess the way to proceed is...

1. see if there is shader code available. if so use it.

2. try baking it together in blender

3. try blending them in paint.net or some other paint program, using alpha if provided, and perhaps with 0.5 = no change on the complexion texture.  that would mean the complexion texture goes from -256 to 255, and is then compressed down to the range -128 thru 127. i wonder if they expand it back out to +/- 255 before applying it, or if they just apply a value in the range +/- 128.

Share this post


Link to post
Share on other sites

I'd be tempted to change your character shader to include at least an extra channel for something like a combined specularity / roughness channel

I suspect that would be the displacement texture. Bastioni can do muscles, veins, wrinkles, folds of fat, all kinds of stuff.  This particular model is of a young female of normal body mass and somewhat light musculature, so no bulging muscles with veins popping out, no double chin lines, no eye wrinkles, etc. I think all those show up in the displacement texture.

 

>> For a glossy map the oil layer should work, see if you can bake it. If you can't bake it using lights or by mixing textures you have. I would start with ((Dermal texture BW * complexion texture) thickness map) then maybe use a leveler to get the right look and brush in some highlights.

tell me about oil layers and thickness please. These are both sliders in Bastioni. Oil layer appears to affect shinyness (specular). Thickness works with dermal vs sub-dermal?  The effect was not very noticeable. 

Share this post


Link to post
Share on other sites

tell me about oil layers and thickness please. These are both sliders in Bastioni. Oil layer appears to affect shinyness (specular). Thickness works with dermal vs sub-dermal?  The effect was not very noticeable. 

The oil is specular intensity/ gloss, or maybe the BPR roughness/ gloss, they aren't that different you will just need to tweak the baked oil value.

AO attempts to find out how far a normal is from a other, so if a inverted mesh is used it looks how far the inside is from the other inside normals.

I tested the thickness in Blender and it doesn't work, because Blender doesn't cull the backface. Blender can bake actual subsurface maps.

Use Xnormal to bake thickness maps for free. If you only have a low poly mesh, load it into Xnormal as both the high and low mesh. Don't flip your normals when using Xnormal to bake thickness maps, just bake as you always would.

Most material software like Substance can bake thickness, Modo also can using the flipped normals trick(Last when I used it). Thickness is only a substitute for a real subsurface, it won't be as good as the real thing.

Share this post


Link to post
Share on other sites

Well, this is all i found RE: shaders in Bastioni Lab...

Looks like its for Blender Cycles.  But it does describe the purpose of some of the textures.  Unfortunately i'm not up to speed on all the latest character rendering techniques. so i can't just look at them and go "oh! ok, just do this and that..." 

===================================== From the online docs ======================================

Define the skin and textures

From version 1.3.0, ManuelbastioniLAB provides a poweful skin editor.

Behind the simple interface there is a set of complex shaders for human skin, human eyes, toon skin and toon eyes. These shaders are developed in order to simulate the variety of skin tones and work under any lighting condition.

 

  1. An advanced human skin shader
  2. An advanced toon skin shader
  3. Shaders for eyes

The skin editor is visually divided in three parts:

  1. Bump/displacement controls
  2. Parameters editor
  3. Save textures controls

Bump/displacement controls

skin_editor_01.png

The button "Update displacement" is the gui for the displacement system, an algorithm that automatically creates the bump map from the values of age, mass and tone parameters. For example, an older character will have more wrinkles, while a muscled character will have more noticeable veins.

You should use this button to update the bump/displacement each time you change the meta parameters.

Using Cycles in realtime, some time the viewport is not updated with the recalculated bump.

The button "Enable displacement preview" will show the displacement directly in the viewport, in realtime. Anyway, since usually the displacement is matter of little details, it's also required to press the button "Enable subdivision preview". This button subdivides the model in realtime, so it has enough resolution to show the displacement effects.

Subdivision in realtime is very CPU consuming and should be used only for a quick preview.

Parameters editor

The parameters editor is composed by an intuivive set of sliders for easily modify the values of skin complexion, skin bump, skin oil, skin saturation, skin subsurface scattering and more. The editor also provides controls for the eyes hue, tone and saturation.

One of most important parameters is the complexion. It modifies the color in order to vary from very light skin to very dark one. It's not just the brightness, but a complex result obtained using the samples from an image included in the lab data.

skin_editor_02.png

The skin model used in the shader is composed by two layers, the subdermal (veins and muscles) and the dermal (external skin): the variety of the human skin tone on the body is mostly determined by the interaction of these two layers. ManuelbastioniLAB 1.3 provides two parameters to control them: the skin_subderm and the skin_saturation.

The skin_subderm controls the thickness of the dermal layer. Low values are for very thin and transparent dermal layer that shows the reddish subdermal. High values are for thick and dense dermal that is more opaque and creates less light scattering.

skin_editor_03.png

The parameter skin_saturation controls the color saturation of the dermal layer. This parameter, combined with the complexion, permits to cover practically any human skin tone.

skin_editor_04.png

Another important factor is the amount of the oil layer. It's a thin layer that protects the skin, more noticeable in some body parts and almost invisible in others. In lab 1.3 it's assumed an uniform distribution of the oil. More accurate controls will be added in future releases.

skin_editor_05.png

Save textures controls

Each time the button "Update displacement" is pressed, the system recalculates the displacement map using the values of meta parameters. This map can be saved with the "Save displacement image" button, in order to be usable in external engines or infinalized characters.

The dermal and subdermal textures can be saved too, using the dedicated buttons.

|Back to index|

Edited by Norman Barrows

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!