Skip to main content
gamedev.net
🔒 Locked

Lighting

Started by Koobazaur Jan 18, 2007 at 6:00 PM 0 replies 350+ views
Original Post
Koobazaur
Koobazaur
I am currently learning D3D 9 from Introduction to 3D Game Programming with DirectX 9 by Frank D. Luna (http://www.gamedev.net/columns/books/bookdetails.asp?productid=386&CategoryID=8) and I am finding that he doesn't go very in-depth with the various aspects. Something I want to learn more about is Lighting. Can someone suggest a good article on this topic? I know how to set up lights (directional, point, spotlight) but I can't quite grasp how exactly the lighting process works (seems like it is only the vertexes that get lit, so if I shine directly in the middle of a wall, it just stays black). I am also confused about how diffuse light works and how to realistically set up some of the light settings (attenuation, fall off etc.) Is there any website that goes in-depth with this stuff? Help much appreciated!
Comrade, Listen! The Glorious Commonwealth's first Airship has been compromised! Who is the saboteur? Who can be saved? Uncover what the passengers are hiding and write the grisly conclusion of its final hours in an open-ended, player-driven adventure. Dziekujemy! -- Karaski: What Goes Up...
Namethatnobodyelsetook
Namethatnobodyelsetook
Fixed function lighting is done per vertex, correct. You can't expect tightly focused spot lights, or specular highlights to work nicely. Many people do not like the attenuation functions of standard lighting, and it *is* a pain to use. There is an SDK help page that covers the math.

The best way to learn lighting however is to ignore the fixed pipeline, and skip ahead to HLSL shaders and FX files. D3D10 has no fixed pipeline, and shaders are only going to become more important. As you're just learning now, you might as well learn to the modern way to do it.

With shaders, you are in charge of handling lighting yourself. While this sounds like a big deal, it's not so bad. The math is simple for directional and point lights, and you'll learn exactly how it works... plus you can do the math per pixel, giving better lighting results. In addition to emulating standard lights per pixel, you can choose to do some of the math differently. This is where you can scrap attenuation, and just do a linear falloff over your light's range. This is where you can do normal mapping.

Download FX Composer. Browse the sample FX files. Look for HLSL lighting tutorials like this one.

Topic Locked

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

Sign in to reply to this topic.