Jump to content
  • Advertisement
Sign in to follow this  
L. Spiro

What is the Actual Name of this Transparency Model?

This topic is 2640 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

One day I looked out a window and I could see clearly.
Then I noticed that when I looked out through a steep angle, say 1 degree, I could not see through the glass at all.

I positioned my head at 45 degrees and noticed that objects were approximately 1.4142135623730950488016887242097 times harder to see. The glass had become less translucent!
At 80 degrees, I felt that objects through the glass were 5.7587704831436335362164371093094 times more difficult to see, but since I supposed the glass had an alpha of 0.06, I could still see fairly clearly.

So I made up a mathematical formula for this strange phenomenon and added it to my engine. And there was much rejoicing.


Then one day I thought, “Hmm, I wonder if anyone else in the history of mankind has ever noticed that looking through glass at an angle causes light to pass through more of the glass before reaching your eye, and therefore makes the glass less translucent. I wonder if that person made a better mathematical model for it than I did, and what if that person even named it??”


The formula I made is simple:
alpha *= 1.0 / dot( negViewDir, surfaceNormal );

#1: Feel free to correct my formula. But I am using this for real-time graphics so I am not necessarily after the real full-sized formula. Efficient adjustments to my approximation are welcome.
#2: And what is the name of this anyway? I don’t know what to name the checkbox for my tools to enable this. “Enable…More Better…Transparency”?


L. Spiro

Share this post


Link to post
Share on other sites
Advertisement
Oh.

I’m not talking about refraction yet. I am just talking about it being harder to see through glass as you look at it through a narrower and narrower angle.
Place your head against a window and look across the glass. One part is that images will be distorted more due to refraction, but another part is that you simply won’t be able to see through the glass very well. The second part is what I want for now.


L. Spiro

Share this post


Link to post
Share on other sites
So basically you are adding attenuation inside glass to your formula?

To be technically correct there are two distinct phenomena involved:

  1. Attenuation (scattering) inside glass. You should still use refraction formula, because if you are looking onto glass from very small angle, due to refraction, light travels through glass in bigger angle. I.e. if you look at your glass from the angle 0, the path light travels through glass is not infinite. this can be calculated using Snell's law.
  2. Reflection - not only is YOUR side of glass reflecting environment light towards you but the other side of glass is reflecting away light, that could potentially come towards you through glass. The amount reflected (i.e. how much less light there is to begin with) can be calculated with Fresnel formula.
It may well be, that if you combine these two phenomena, your formula is pretty good approximation. Although I think that in case of glass attenuation is much more wavelength-dependent than reflection.

Share this post


Link to post
Share on other sites
I guess I will just call it Snell’s Translucency then. I need to refine it a bit, because it drops off a bit too fast, but I think one small adjustment will be enough.

For anyone curious, here are the results of my approximation after a slight modification:

Snell.png

The alpha of the glass was modified thusly:

_vOutColor.w *= (((1.0f / abs( dot( vViewPosToEye.xyz, vNormalizedNormal ) )) - 1.0f) * 0.25f) + 1.0f;
_vOutColor.w = min( _vOutColor.w, 1.0f );

The sides of the glass around the cockpit look reasonable, and much better than a flat alpha that I had before.


Thank you.
L. Spiro

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!