O'Reilly logo

Lua Game Development Cookbook by Mário Kašuba

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Applying highlights and shadows to the scene

This recipe will deal with per-pixel lighting and simple shadowing. It will allow you to apply one or more lights in the 3D scene. There are two types of light sources: directional and positional light. Directional light doesn't have a position and it's used mostly for daylight. Positional light has a source at a certain position. This type of light can be divided to omnidirectional and spotlight. Omnidirectional light is used mostly with light bulbs. Spotlight is often used with reflectors. Light intensity decreases with increasing distance from the light source.

This recipe will use simple shadowing. This means that surfaces that aren't directly facing the light source will be in the shadow. However, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required