1. So much of that went over my head, but the parts that didn’t were quite interesting.

  2. I didn’t really get what they meant by “Half Lambert”; a good explanation (with pictures) is on page 8 of Shading in Valve’s Source Engine (pdf). Also of interest: Half-Life 2 Shading (pdf), from 2004.

  3. And what I think a “Half Lambert” is: Normally, for diffuse light, you use Lambert’s cosine law to calculate how much a surface is “lit” by a light source. since the dot product of two vectors v and u is |v||u|cos(θ), you can find the cosine of surface’s normal (n) and of the light direction (l) by normalizing them (setting their length to 1) and doing:
    diffuse = n˙l
    and multipling diffuse by the light’s intensity.
    For surfaces that face the light directly, l and n are the same, and diffuse = 1. As the angle between the surface’s normal and the light direction increases, diffuse decreases, and reaches 0 at θ = 90° It would then become negative, but that means the surface is actually hidden from the light, so it’s not lit by it.

    This is where Valve cheats: they do 0.5 * cos(θ) + 0.5, to basically “compress” diffuse between 0 and 1. So if you have..

  4. o <— a light
    ________
    \ /
    \____/ <— an object

    Then the overhead light also lights the sides of the object, even though it’s not visible from these sides. In fact, the only way for a light no *not* light a face is if that face is completely opposite of the light direction.

    But the result actually looks good, and avoids making the side of a character that’s not exposed to the light a lot less flat than it would be with the “real” Lambert. They even square the Half Lambert to get a nicer effect. You can see cos(θ) vs. (0.5 + 0.5 cos(θ)2 on Alpha

  5. (oops, no <pre>… the object is supposed to be an inverted trapeze with an overhead light.)

Sorry, comments are closed for this post.

Spacechimp thinks you might also like...

Skip to toolbar

What Is Gamefilter?

Gamefilter is a community weblog based in spirit and intent on the great work of Matt Haughey and his staff at Metafilter. It's all about sharing links to interesting stuff on the web, but with a narrower focus on gaming-related links -- good stuff that other people might not have already seen -- and talking about them.

Anyone can join for the low low price of zero dollars, and once you're a member, you have the senses-shattering power to post new stuff right from the front end of the site, and talk about that stuff in the comment threads. You don't need an account to read GFi, but as well as giving you The Power To Post, membership also lets you

  • Thank and Favorite all the goodness
  • Build a profile page with all your stuff in one convenient place
  • Send private messages and friend/follow your favorite GFites and their unstoppable Gfiltering style
  • Feel the warm glow of satisfaction in helping grow the community
  • Do all sorts of other neat things, both now and coming in the future!

Gamefilter is part of the growing MefightClub Network of sites, including our forum home, MefightClub itself, FullGlassEmptyClip, our group blog, and Ludic Research Labs, who are a bunch of bastards.

Your genial host is stavrosthewonderchicken, the miraculous poultry who built and administers the MFC Network sites, and a bunch of other web stuff as well. He has a minor addiction to building websites. He loves you all.