Creating a light attenuation effect

Hi all,

I’m just wondering what would be the best solution to recreating an effect like the image below

http://www.ribot.co.uk/images/light_attenuation.png

I will only need to light the floor and no other objects in the scene, so maybe I don’t even need to use the OpenGL light state machine?

I’ve been thinking that a possible solution may be to split the floor into a large number of quads, and calculate their distance from the light source given the standard equation. Is this just extra work and should I just let OpenGL calculate it for me by using a spot light type function?

OpenGL lighting is not what you want - it’s not generally optimized and would require a very high poly count to get that kind of effect.

You probably want to look at lightmaps - basically where you project a spotlight texture onto your surface. First hit on Google looks good:

http://www.3ddrome.com/articles/dynamiclightmaps.php

Thanks cfmdobbie,

that looks exactly like what I was after! I’d never heard of lightmaps, so I didn’t know what to google. :slight_smile:

I’ll post back when I have implemented an answer.