Archived

This topic is now archived and is closed to further replies.

nitzan

lighting question

Recommended Posts

nitzan    108
Hi, I want to have a lightsource at a particular location, and I want the light to grow dimmer the farther you move away from the object. Pretty much I have a terrain and I want to be able to light up only a small portion of the terrain. Can someone give an example of how to do this ? Nitzan ------------------------- www.geocities.com/nitzanw www.scorchedearth3d.net -------------------------

Share this post


Link to post
Share on other sites
nitzan    108
I read through those articles, and while they answered many of my other questions I still didnt seem to find an answer to the one above.

Is it even possible to make a non-directional light grow dimmer the farther you move away from it ? If so how is this done ? It seems to me that the way openGL calculates lighting, the farther the vertex is the more light it will get. How do I make openGL take distance into account ?

Nitzan

-------------------------
www.geocities.com/nitzanw
www.scorchedearth3d.net
-------------------------

Share this post


Link to post
Share on other sites
Vendayan    278
I am inclined to doubt that you have ever seen that doen without lightmapping. Lightmapping is simply making a texture (in your case possibly a circular one that fades from black to white in the center) and then make a routine that will take slices or all of the lightmap and apply it to your different textures that are already on the terrain. I havent worked wiht point lights much but you may try making a black background under the terrain and then making it semitransparent and using point lights, but thats really just a theory I thought up and have never tested.

~Vendayan

Share this post


Link to post
Share on other sites
nitzan    108
Well I figured it out. You can use attenuation to dim the light from a non-directional light source. I tested this and it worked beautifully. If anyone here has the red book go to the Lighting section and read up on Light Attenuation. There is a simply equation with 3 variables (Linear, Constant and Quadratic). The lower the values the farther the light will reach.

Nitzan

-------------------------
www.geocities.com/nitzanw
www.scorchedearth3d.net
-------------------------

Share this post


Link to post
Share on other sites