Sign in to follow this  
BlinksTale

"Soft" shader, or, how do I get this skin-lighting effect?

Recommended Posts

BlinksTale    318

You guys always know how to pull off these fancy tricks, so perhaps you can help me with this. Nintendo's newest round of games all have this amazing "soft" look to them visually, no more [url=http://i.imgur.com/AfDGgae.jpg]hard light-to-dark gradients[/url]. Instead, there's backlighting or that layered skin effect, underlighting, *something*. That's what I'm trying to figure out, and then how to do it.

 

Examples:

 

w7GX0Vd.jpg

Kirby here, and maybe Pikachu's chest just under his arm.

 

r1ntijA.jpg

These two cube men, with some ridiculously soft lighting/shadowing system, although I think it might be different from the others.

 

JU8oT4L.jpg

The back of this girls head, just under her hairline. It definitely glows, but only at the edge of her head.

 

XfzRrtZ.jpg

Here Pascal, the red otter, has the glow all around his head. The girl also has it, but on her jawline.

 

So I'm guessing the glow is a reflection, due to what fancy-schmancy art class still life taught me.

 

ox3oze9.gif

^art skewl

 

Although I'm also inclined to think it's a skin transparency layering mimicking thing, like the PS4 demo by David Cage (only significantly cheaper on the processor, I'm sure).

 

And I still think that Cube Men one is a different shader/lighting/thing altogether, but I don't know how to describe it compared to the others.

 

So, thoughts? Directions? Help? I want my game to have friendly, soft, and welcoming visuals. So far, all of the above do an excellent job of that, so I'd like to learn what I can from them. Many thanks!

Edited by BlinksTale

Share this post


Link to post
Share on other sites
apatriarca    2365

All the examples except the cube men are in my opinion just faked rim lights. The basic idea is to add light in regions where the eye and surface normal are roughly perpendicular. The Unity example posted by TiagoCosta implement this technique. This technique does not simulate some kind of reflection but the effect of the back (or rim) light in the three point lighting system used in traditional art. I suggest learning about it. This kind of lighting is for example used to highlight the actors separating them from the background. 

Share this post


Link to post
Share on other sites
Krohm    5030

Maybe you could took a look at that Valve publication about Team Fortress 2 where they go in detail about character lighting. Does this qualify for what you want?

Share this post


Link to post
Share on other sites
marcClintDion    435

s6ft.png

 

Here is a GLSL shader called 'X-ray' that was published by ATI.  I think if you configure it a bit you may be able to achieve the effect you are looking for.

 

 

 

 

//============VERTEX SHADER

 

varying vec3 Normal; varying vec3 invertPosition; varying vec4 Color; void main() {  vec4 Position = gl_ModelViewMatrix * gl_Vertex;    invertPosition  = Position.xyz - vec3(0);  //_____This vec3(0)is not doing anything but I left in in so you can see what was originally in the shader    Normal  = gl_NormalMatrix * gl_Normal;    Color = vec4(0.1, 0.2, 0.3, 1.0);    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;   } //==================================================

 

//===========FRAGMENT

 

varying vec3 Normal; varying vec3 invertPosition; varying vec4 Color; // globals float edgefalloff = -1.0; // entry point void main() {   float opac = dot(normalize(-Normal), normalize(-invertPosition));   opac = abs(opac);   opac = 1.0-pow(opac, edgefalloff);   opac = 1.0 - opac;     //Cs = dot(opac, Color);     gl_FragColor =  opac * Color;   gl_FragColor.a = opac; }  

Share this post


Link to post
Share on other sites
cowsarenotevil    3005

It looks to me that those screenshots mostly show off similar, but not necessarily identical, effects. In particular, the third ones look like they achieve the "softness" mostly in a way that isn't viewing-angle sensitive (they both also seem to show specular lighting with a low specular power, but it's not necessarily anything special). The second one looks like it has a lot of ambient/environment light to give it the softness.

 

The first and fourth ones seem to show off lighting that gets brighter as the incident angle is more perpendicular to the camera; as mentioned there are a lot of ways to achieve this; the NVIDIA Shader Library has some "velvet" and "fuzz" materials that might be of use.

 

If you just want to play with some common algorithms, Blender supports a few shading models with its internal renderer; you might look at Minnaert (with a <1 "darkness" value) and Fresnel for viewing-angle sensitive lighting, and Oren-Nayar for a "rougher" (relative to Lambert), but still purely diffuse material.

 

Finally, if you specifically want the "skin transparency layering mimicking thing" the keyword to look for is "subsurface scattering"; to my knowledge the most common way to fake this in real time is to sum layers made by blurring the lighting in UV space.

 

EDIT: Wrote "blending modes" where I didn't mean to write "blending modes" at all.

EDIT: Wrote <0 when I meant <1

Edited by cowsarenotevil

Share this post


Link to post
Share on other sites
BlinksTale    318

Fuzz edge is definitely the effect I was looking for (very similar to velvet though), which looks to be a variant of rim lighting, and the wrap diffuse lighting will help too! Thank you all, this is far more than I could have asked for :)

Share this post


Link to post
Share on other sites
marcClintDion    435
Half Life 2 used a "Half Lambert" diffuse term

 

Yup, another excellent formula.  I saw this half life formula described as "the dot product from the Lambertian model is scaled by ½, add ½ and squared"

 

I interpreted this as the following -> ((NdotL1 * 0.5) + 0.5) * ((NdotL1 * 0.5) + 0.5) 

 

The model looks very similar as with the above RenderMan equation but this one better retains the illusion of depth.  Thanks for the tip.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this