Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your feedback on a survey! Each completed response supports our community and gives you a chance to win a $25 Amazon gift card!


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


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
10 replies to this topic

#1 BlinksTale   Members   -  Reputation: 315

Like
1Likes
Like

Posted 18 June 2013 - 07:39 PM

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 hard light-to-dark gradients. 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, 18 June 2013 - 07:43 PM.


Sponsor:

#2 TiagoCosta   Crossbones+   -  Reputation: 2487

Like
5Likes
Like

Posted 19 June 2013 - 03:28 AM

There's a shader in the Unity docs that simulates rim lighting (it's the 4th example in that page).

 

Also check wrap diffuse lighting (another shader example in the Unity docs) to fake soft lighting.

 

You can also fake the effect in the first image by using a bright ambient light so the difference between light and shadow is small.

 

I don't think the cube men is rendered in real-time, or maybe it uses multiple lights + ambient occlusion, but it was probably made by an artist.


Edited by TiagoCosta, 19 June 2013 - 03:38 AM.


#3 apatriarca   Crossbones+   -  Reputation: 1769

Like
1Likes
Like

Posted 19 June 2013 - 03:49 AM

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. 



#4 Tasty Texel   Members   -  Reputation: 1371

Like
8Likes
Like

Posted 19 June 2013 - 06:34 AM

Quite some time ago I wrote such a NPR-shader on request for a fan game:

yoshi_NPR.png

(Yoshi's design is copyrighted by Nintendo, of course. The model itself was made by a user called Otter over on the GameStudio forums)

 

It's really just the sum of various effects put together: pure rim lighting, velvet shading (once blended over the underlying albedo color and once multiplied with it), wrap diffuse lighting, blinn-phong + minnaert spec highlights, spherical harmonics for some fake ambient lighting (sampled with a reflection vector to make it a bit more high-freq) and probably some other artistic tricks. But to be honest, when watched directly from the primary light's perspective the shading was quite flat. However, there is a lot of potential for nice artistic NPR-styles. You probably have to find the one which fits best for your situation iteratively, as usual. smile.png



#5 Krohm   Crossbones+   -  Reputation: 3262

Like
2Likes
Like

Posted 20 June 2013 - 10:54 PM

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?



#6 marcClintDion   Members   -  Reputation: 431

Like
1Likes
Like

Posted 20 June 2013 - 11:58 PM

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; }  


Consider it pure joy, my brothers and sisters, whenever you face trials of many kinds, because you know that the testing of your faith produces perseverance. Let perseverance finish its work so that you may be mature and complete, not lacking anything.


#7 marcClintDion   Members   -  Reputation: 431

Like
1Likes
Like

Posted 21 June 2013 - 05:46 AM

wrap diffuse lighting

 

Thanks for the wrap lighting tip.  I found a RenderMan implementation at the following link, it's works beautifully,  I wanted a formula like this for a long time.

 

http://zj.deathfall.com/wrappeddiffuse.htm


Consider it pure joy, my brothers and sisters, whenever you face trials of many kinds, because you know that the testing of your faith produces perseverance. Let perseverance finish its work so that you may be mature and complete, not lacking anything.


#8 cowsarenotevil   Crossbones+   -  Reputation: 2109

Like
1Likes
Like

Posted 21 June 2013 - 08:10 AM

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, 21 June 2013 - 04:35 PM.

-~-The Cow of Darkness-~-

#9 Paradigm Shifter   Crossbones+   -  Reputation: 5443

Like
2Likes
Like

Posted 21 June 2013 - 09:48 AM

Half Life 2 used a "Half Lambert" diffuse term which is probably going to be cheaper than doing an acos and a divide... might be worth looking at

 

https://developer.valvesoftware.com/wiki/Half_Lambert


"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley

#10 BlinksTale   Members   -  Reputation: 315

Like
0Likes
Like

Posted 21 June 2013 - 03:29 PM

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 :)



#11 marcClintDion   Members   -  Reputation: 431

Like
0Likes
Like

Posted 21 June 2013 - 07:52 PM

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.


Consider it pure joy, my brothers and sisters, whenever you face trials of many kinds, because you know that the testing of your faith produces perseverance. Let perseverance finish its work so that you may be mature and complete, not lacking anything.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS