lighting question
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
-------------------------
Look here (at chapter 5) and here. You could also use lightmaps (probably more efficient in many cases), I don''t have any good resource for that though.
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
-------------------------
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
-------------------------
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
~Vendayan
"Never have a battle of wits with an unarmed man. He will surely attempt to disarm you as well"~Vendayan
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
-------------------------
Nitzan
-------------------------
www.geocities.com/nitzanw
www.scorchedearth3d.net
-------------------------
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement