Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualRPTD

Posted 03 January 2013 - 01:48 PM

That is, unless you're trying to model some particular transparent material that has thickness and reflection / scattering properties, in which case this is much more complex. I didn't catch if this was an offline renderer or something you're trying to do in real time.
Real-time rendering in a game engine.
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.
Okay, let's see if I can follow. I'm working with a PBR system hence I have Surface Reflection and SubSurface Reflection. Fresnel mixes between the two of them. As mentioned the Surface reflection is already taken care of. So this leaves us with SubSurface Reflection. For solid materials the SubSurface reflection absorbs certain wavelengths and reflects what we can call albedo or surface color (diffuse reflection). For transparent materials this would now split up into two components, the SubSurface Reflection as we had but additionally transmission. If I get this correctly the transparency material property sort of describes the mix between SubSurface Reflection and Transmission. This would make sense to me since for 100% transparency there is 100% SubSurface Reflection and 0% Transmission while for 0% transparency there is 0% SubSurface Reflection and 100% Transmission (if we neglect the bending of the light ray due to Snell's Law for a minute).

So this would mean the transmitted color would be (1-transparency)*albedo . Combined with already colored light this would then end up as:
lightColor * ( 1 - transparency ) * albedo .

Let's say transparency is 0% hence fully transparent. In this case the color of the light ray travelling through the material would be:
lightColor * ( 1 - 0 ) * albedo = lightColor * 1 * albedo = lightColor * albedo.
This means a light ray travelling through a fully transparent object is fully colored by the object just that 0% of this colored light ends up in the shadow map. So adding all this together this would yield:
fragmentInShadow = [ lightColor * ( 1 - transparency ) * albedo ] * transparency

Any mistake in that one?

#2RPTD

Posted 03 January 2013 - 01:46 PM

That is, unless you're trying to model some particular transparent material that has thickness and reflection / scattering properties, in which case this is much more complex. I didn't catch if this was an offline renderer or something you're trying to do in real time.
Real-time rendering in a game engine.
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.
Okay, let's see if I can follow. I'm working with a PBR system hence I have Surface Reflection and SubSurface Reflection. Fresnel mixes between the two of them. As mentioned the Surface reflection is already taken care of. So this leaves us with SubSurface Reflection. For solid materials the SubSurface reflection absorbs certain wavelengths and reflects what we can call albedo or surface color (diffuse reflection). For transparent materials this would now split up into two components, the SubSurface Reflection as we had but additionally transmission. If I get this correctly the transparency material property sort of describes the mix between SubSurface Reflection and Transmission. This would make sense to me since for 100% transparency there is 100% SubSurface Reflection and 0% Transmission while for 0% transparency there is 0% SubSurface Reflection and 100% Transmission (if we neglect the bending of the light ray due to Snell's Law for a minute).

So this would mean the transmitted color would be (1-transparency)*albedo . Combined with already colored light this would then end up as:
lightColor * ( 1 - transparency ) * albedo .

Let's say transparency is 0% hence fully transparent. In this case the color of the light ray travelling through the material would be:
lightColor * ( 1 - 0 ) * albedo = lightColor * 1 * albedo = lightColor * albedo.
This means a light ray travelling through a fully transparent object is fully colored by the object just that 0% of this colored light ends up in the shadow map. So adding all this together this would yield:
transparentShadowColorMap = [ lightColor * ( 1 - transparency ) * albedo ] * transparency

Any mistake in that one?

#1RPTD

Posted 03 January 2013 - 01:42 PM

That is, unless you're trying to model some particular transparent material that has thickness and reflection / scattering properties, in which case this is much more complex. I didn't catch if this was an offline renderer or something you're trying to do in real time.

Real-time rendering in a game engine.

 

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.

Okay, let's see if I can follow. I'm working with a PBR system hence I have Surface Reflection and SubSurface Reflection. Fresnel mixes between the two of them. As mentioned the Surface reflection is already taken care of. So this leaves us with SubSurface Reflection. For solid materials the SubSurface reflection absorbs certain wavelengths and reflects what we can call albedo or surface color (diffuse reflection). For transparent materials this would now split up into two components, the SubSurface Reflection as we had but additionally transmission. If I get this correctly the transparency material property sort of describes the mix between SubSurface Reflection and Transmission. This would make sense to me since for 100% transparency there is 100% SubSurface Reflection and 0% Transmission while for 0% transparency there is 0% SubSurface Reflection and 100% Transmission (if we neglect the bending of the light ray due to Snell's Law for a minute).

 

So this would mean the transmitted color would be (1-transparency)*albedo . Combined with already colored light this would then end up as:

   lightColor * ( 1 - transparency ) * albedo .

 

But this doesn't work out. Let's say transparency is 0% hence fully transparent. In this case the color of the light ray travelling through the material would be:

   lightColor * ( 1 - 0 ) * albedo = lightColor * 1 * albedo = lightColor * albedo.

This though would mean a light ray travelling through a fully transparent object is fully colored by the object just that 0% of this colored light ends up in the shadow map. So adding all this together this would yield:

   transparentShadowColorMap = [ lightColor * ( 1 - transparency ) * albedo ] * transparency

 

Any mistake in that one?


PARTNERS