Skip to main content
gamedev.net
🔒 Locked

Basic Lighting

Started by Jerec Sep 11, 2000 at 8:30 PM 0 replies 550+ views
Original Post
Jerec
Jerec
what is the basic equation for lighting a vertex based on distance with brightness calculated in? Jerec ----------- CM Software
JerecCM Software"Oro?"
Spark
Spark
Hi,

If you just want to calculate the brightness based on the distance you can do:
    
distance = sqrt( (vertex.x-light.x)*(vertex.x-light.x) + (vertex.y-light.y)*(vertex.y-light.y) + (vertex.z-light.z)*(vertex.z-light.z) );

if (distance > maxbrightness) distance = maxbrightness;

brightness = maxbrightness - distance;

Topic Locked

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

Sign in to reply to this topic.