realbasic-games
[Top] [All Lists]

Re: Brightness of light from distance

To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
Subject: Re: Brightness of light from distance
From: Lo Saeteurn <realbasic at miensoftware dot com>
Date: Fri, 22 Jul 2005 12:35:32 -0700
Delivered-to: realbasic-games at lists dot realsoftware dot com
References: <BDA608D4-22BF-4605-9022-D3189B53A9EC at miensoftware dot com> <A46C242A-3221-4511-B030-260116D37801 at chaoticbox dot com>
Thanks! I will try that.

On Jul 22, 2005, at 10:06 AM, Frank Condello wrote:

On 22-Jul-05, at 3:47 AM, Lo Saeteurn wrote:


Do anyone know how find how bright a point light is from a certain distance (both linear and squared)?


Quesa (quite reasonably) uses a simplified GL light model, so the attenuation factor in Quesa will always be:

    LinearAttenuationFactor = 1.0 / Distance
    QuadraticAttenuationFactor = 1.0 / Distance^2

The attenuation factor is applied to the RGB component (which is used for both the diffuse and specular term, simplifying things again). The RGB component is also scaled by a brightness value, but you also have to take into account the luminance of the light's colour. To get a normalized luminance value from an RB Color type, you can use the following:

    Luminance = (R/255)*0.30 + (G/255)*0.59 + (B/255)*0.11

So if my head's screwed on right the brightness at a given distance from a light should be:

Brightness = (Luminance*(light.Brightness/100)) * AttenuationFactor

You'll have to add the contribution for every light that reaches that point, and you might also need to consider constant luminance from directional lights, and the global ambient term.

Frank.
–––––––––––––––––––––––––––––––––
Open Source RB Goodies and Shareware
<http://developer.chaoticbox.com/>
<http://www.chaoticbox.com/>
–––––––––––––––––––––––––––––––––

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>




_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>