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

Started by
9 comments, last by marcClintDion 10 years, 9 months ago

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!

Advertisement

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.

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.

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

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?

Previously "Krohm"

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, 3 because you know that the testing of your faith produces perseverance. 4 Let perseverance finish its work so that you may be mature and complete, not lacking anything.

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, 3 because you know that the testing of your faith produces perseverance. 4 Let perseverance finish its work so that you may be mature and complete, not lacking anything.

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

-~-The Cow of Darkness-~-

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

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

This topic is closed to new replies.

Advertisement