Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#ActualBacterius

Posted 02 January 2013 - 11:14 PM

You have the right idea but not the right formula. Basically, after you apply the Fresnel equations to work out how much of the ray makes it across the medium boundary (and how much reflects off) the intensity of the ray will decrease exponentially with distance travelled (not linearly). If your medium (here, glass) has an extinction coefficient of k, the initial ray intensity is I0, and d is the distance travelled by the ray inside the medium, then:

 

 

And this is the ray intensity at a distance d. This is assuming your medium is 100% homogeneous, with no scattering occurring inside. k = 0 means the medium does not absorb any light, this is physically impossible for any medium other than the vacuum, and k = infinity means the object is completely opaque. For clear glass, k will be pretty small, since light travels well inside. For a more opaque glass, it'll be higher, and so on..

 

Note that k is wavelength-dependent, if you are rendering in RGB you'll need three different extinction coefficients, kR, kG and kB.

 

See the Beer-Lambert law, and my last article has some words on absorption (among other stuff) you might find useful. This can be implemented in real-time and is a very minor change to most renderers, both realtime and offline.


#4Bacterius

Posted 02 January 2013 - 11:12 PM

You have the right idea but not the right formula. Basically, after you apply the Fresnel equations to work out how much of the ray makes it across the medium boundary (and how much reflects off) the intensity of the ray will decrease exponentially with distance travelled (not linearly). If your medium (here, glass) has an extinction coefficient of , the initial ray intensity is , and is the distance travelled by the ray inside the medium, then:

 

 

And this is the ray intensity at a distance d. This is assuming your medium is 100% homogeneous, with no scattering occurring inside. means the medium does not absorb any light, this is physically impossible for any medium other than the vacuum, and means the object is completely opaque. For clear glass, will be pretty small, since light travels well inside. For a more opaque glass, it'll be higher, and so on..

 

Note that k is wavelength-dependent, if you are rendering in RGB you'll need three different extinction coefficients, , and .

 

See the Beer-Lambert law, and my last article has some words on absorption (among other stuff) you might find useful. This can be implemented in real-time and is a very  minor change to most renderers, both realtime and offline.


#3Bacterius

Posted 02 January 2013 - 11:11 PM

You have the right idea but not the right formula. Basically, after you apply the Fresnel equations to work out how much of the ray makes it across the medium boundary (and how much reflects off) the intensity of the ray will decrease exponentially with distance travelled (not linearly). If your medium (here, glass) has an extinction coefficient of k, the initial ray intensity is I0, and d is the distance travelled by the ray inside the medium, then:

 

 

And this is the ray intensity at a distance d. This is assuming your medium is 100% homogeneous, with no scattering occurring inside. k = 0 means the medium does not absorb any light, this is physically impossible for any medium other than the vacuum, and k = infinity means the object is completely opaque. For clear glass, k will be pretty small, since light travels well inside. For a more opaque glass, it'll be higher, and so on..

 

Note that k is wavelength-dependent, if you are rendering in RGB you'll need three different extinction coefficients, kR, kG and kB.

 

See the Beer-Lambert law, and my last article has some words on absorption (among other stuff) you might find useful. This can be implemented in real-time and is a very  minor change to most renderers, both realtime and offline.

 

PS: what the hell is wrong with the forum right now? can't post latex, can't post images..??


#2Bacterius

Posted 02 January 2013 - 11:10 PM

You have the right idea but not the right formula. Basically, after you apply the Fresnel equations to work out how much of the ray makes it across the medium boundary (and how much reflects off) the intensity of the ray will decrease exponentially with distance travelled (not linearly). If your medium (here, glass) has an extinction coefficient of k, the initial ray intensity is I0, and d is the distance travelled by the ray inside the medium, then:

 

Id = I0 * e^(-kd)

 

And this is the ray intensity at a distance d. This is assuming your medium is 100% homogeneous, with no scattering occurring inside. k = 0 means the medium does not absorb any light, this is physically impossible for any medium other than the vacuum, and k = infinity means the object is completely opaque. For clear glass, k will be pretty small, since light travels well inside. For a more opaque glass, it'll be higher, and so on..

 

Note that k is wavelength-dependent, if you are rendering in RGB you'll need three different extinction coefficients, kR, kG and kB.

 

See the Beer-Lambert law, and my last article has some words on absorption (among other stuff) you might find useful. This can be implemented in real-time and is a very  minor change to most renderers, both realtime and offline.

 

PS: what the hell is wrong with the forum right now? can't post latex, can't post images..??


#1Bacterius

Posted 02 January 2013 - 11:04 PM

You have the right idea but not the right formula. Basically, after you apply the Fresnel equations to work out how much of the ray makes it across the medium boundary (and how much reflects off) the intensity of the ray will decrease exponentially with distance travelled (not linearly). If your medium (here, glass) has an extinction coefficient of , the initial ray intensity is , and is the distance travelled by the  ray inside the medium, then:

 

 

And this is the ray intensity at a distance . This is assuming your medium is 100% homogeneous, with no scattering occurring inside. means the medium does not absorb any light, this is physically impossible for any medium other than the vacuum, and means the object is completely opaque. For clear glass, will be pretty small, since light travels well inside. For a more opaque glass, it'll be higher, and so on..

 

Note that is wavelength-dependent, if you are rendering in RGB you'll need three different extinction coefficients, , and .

 

See the Beer-Lambert law, and my last article has some words on absorption (among other stuff) you might find useful. This can be implemented in real-time and is a very  minor change to most renderers, both realtime and offline.


PARTNERS