Skip to main content
gamedev.net
🔒 Locked

Howto: wrong lighting :)

Started by quasty Oct 11, 2006 at 10:20 AM 11 replies 3.1k views
Original Post
quasty
quasty
Hi, I'm trying to modify a lambertian diffuse lighting in a way that the light covers an object further than it should. I've made a little draft for it: Image Hosted by ImageShack.us I want to lit the parts of the object marked wrong. I imagined it like the light area on the object is somehow stretched. I had the idea of bending the surface normal used for the NdotL term a bit in the direction if the light source depended on how small the first NdotL term is getting. So the light area is a bit overlapping its correct borders but will shadow out correctly. Does anybody have an idea on how to do this? thank you very much
Grey_
Grey_
Why don't you just scale/remap the dot to whatever you want? so right now it's 1 to -1, just remap it to 1 to 0 or whatever you want. You could also look at doing a 1D texture look up to take the technique further.
http://www.radi-8.com | http://www.neotokyohq.com
Lotuspec
Lotuspec
What your after looks alot like the lighting model (they call it 'half-lambert') used in the Source engine (http://www.ati.com/developer/siggraph06/Mitchell-ShadingInValvesSourceEngine.pdf).

So instead of using:
NdotL
You could use:
((NdotL*0.5)+0.5)^2
Cypher19
Cypher19
Quote:
Original post by Grey_
Why don't you just scale/remap the dot to whatever you want? so right now it's 1 to -1, just remap it to 1 to 0 or whatever you want. You could also look at doing a 1D texture look up to take the technique further.


QFT. If you do a little scale/bias to bring the dot product result into the range 1 to -0.5 or whatever you want, that'll do exactly what you need.
quasty
quasty
Thank you.

It was the first thing I tried. But it wouldn't work for *me*. The reason it didn't worked: I forgot I always clamped the NdotL values (to [1.0...0.0]) [embarrass]

Quote:
What your after looks alot like the lighting model (they call it 'half-lambert') used in the Source engine (http://www.ati.com/developer/siggraph06/Mitchell-ShadingInValvesSourceEngine.pdf).

So instead of using:
NdotL
You could use:
((NdotL*0.5)+0.5)^2
Very interesting and looks indeed quite nice! Thanks
Matt Aufderheide
Matt Aufderheide
I am wondering what is the point of such lighting. it doent seem like it can look natural.. is it used for some special effect?
mattnewport
mattnewport
It's a cheap way to fake a certain amount of subsurface scattering. On a human face for example a light shining from behind will scatter through the translucent layers of the skin and off fine hairs on the skin which will give a bit of a rim lighting type effect. Pushing the light a bit around the 'correct' cut off point for opaque lambertian diffuse lighting captures some of the visual look of the complex light transport that's going on for a translucent object. For skin shaders it's common to also tint the light that bleeds around the edges slightly red to approximate the effect of scattered light passing through blood vessels.

[edit]Here's an example of backlighting in a real photo, notice how light bleeds around the edges of the face:

quasty
quasty
Quote:
Original post by mattnewport
It's a cheap way to fake a certain amount of subsurface scattering
And this I had in mind [smile]

rapso
rapso
Quote:
Original post by quasty
Does anybody have an idea on how to do this?


NdotL*0.75+0.25 would give you the requested result, but to simulate subsurfacescattering it would be better to use the viewdirection instead of the lightdir, something like;

float SSS=pow(1.f-dot(N,ViewDir),8);


mikiex
mikiex
http://download.nvidia.com/developer/presentations/2004/Iron_Developer/English_CinematicEffectsII_Sept04.pdf#search=%22wrap%20lighting%20nvidia%22

sometimes refered to as wrap lighting, its the basis for main skin shaders
used in current games
zedzeek
zedzeek
Quote:
Here's an example of backlighting in a real photo, notice how light bleeds around the edges of the face:

this is true, so im being a prick :)
but here im sure its also due to the hair on the face / jumper (like the hair on the head but obviously much shorter)
mattnewport
mattnewport
Quote:
Original post by zedzeek
this is true, so im being a prick :)
but here im sure its also due to the hair on the face / jumper (like the hair on the head but obviously much shorter)

Which is why I said:
Quote:
On a human face for example a light shining from behind will scatter through the translucent layers of the skin and off fine hairs on the skin

[grin]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.