YOUR ACCOUNT

Login or Register to post new topics or replies
uberzev
not lyftzev

Posts: 1890
Filters: 36
Thanks in advance.
  Details E-Mail
Vladimir Golovin
Administrator
Posts: 3446
Filters: 55
Uberzev, I suppose you mean the refraction component, not filter, so I'm correcting the title.
  Details E-Mail
uberzev
not lyftzev

Posts: 1890
Filters: 36
Yeah thanks smile:D
  Details E-Mail
onyXMaster
Filter Forge, Inc.
Posts: 350
The Refraction component simulates the following:

Imagine that you have a "bead" of transparent material (i.e. glass) with flat bottom and a non-flat (specified by Height input) top. "Stick" the Source input image to the flat bottom, specify the 1/IOR (index of refraction aka refraction coefficient indirectly mapped with scaling by 4.0, see your physics book for the explanation, or visit http://scienceworld.wolfram.com/physi...tion.html) with the Refraction input and look at the "bead" from the top -- that's the result.
Unfortunately, there's no ability to specify the IOR relations larger than one, so it's always air-to-surface transfer, not vice versa which may be helpful in simulating layered materials with help of surface filters.
  Details E-Mail
byRo
an Englishman in Brazil

Posts: 138
Filters: 8
Uberzev, you beat me to it. I was going to ask the same question. smile:)

Although, like onyXMastersaid, it does behave like a transparent material with varying height - I find it pretty well impossible to predict what is going to come out on the result side.

Rô
_________________________________
My favourite question is "Why?".
My second favourite is "Why not?"
  Details E-Mail
Quasimondo
Quasimondo

Posts: 147
Filters: 32
I am under the impression that for the refraction component the "angle" between two (or four?) neighbouring pixel is measured - thus it behave different than the offset component which only looks at the individual pixel. But maybe I'm also totally wrong on this.
  Details E-Mail
Vladimir Golovin
Administrator
Posts: 3446
Filters: 55
Mario -- Internally, Filter Forge doesn't operate on pixels. But the concept is basically right, we take three samples of the Height input. The distance is not one pixel as you presumed, but much, much shorter -- ask OnyxMaster, he knows the exact distance.
  Details E-Mail
onyXMaster
Filter Forge, Inc.
Posts: 350
The normal map used for refraction calculations is approximated using 3-tap sampling (anisotropic, right/bottom-oriented, but it does not matter since our supersampling is isotropic and symmetric with centered sampling) using step which is equal to 0.001 pixels, respecting Size slider value. This dependence on Size creates unwanted effects when Image or Selection are used as inputs, but generally is very well suited for all procedural and bitmap-based components. The same algorithm is used for Surface normal map generation which is used then in lighting calculations.
  Details E-Mail
Quasimondo
Quasimondo

Posts: 147
Filters: 32
Thank you very much for this explanation - I always love to know what's happening under the hood.
  Details E-Mail
SpaceRay
SpaceRay

Posts: 12298
Filters: 35
Although this is a very old thread, is good to know better how the refraction works instead of only the explanation given in the FF Help
  Details E-Mail
Sphinx.
Filter Optimizer

Posts: 1750
Filters: 39
Quote
onyXMaster wrote:
Imagine that you have a "bead" of transparent material (i.e. glass) with flat bottom and a non-flat (specified by Height input) top. "Stick" the Source input image to the flat bottom, specify the 1/IOR (index of refraction aka refraction coefficient indirectly mapped with scaling by 4.0


I knew details about the mysterious refraction parameter were hidden deep in the ancient realms of the FF forum smile;-)

Wikipedia states the following typical valuestypical values for different materials:

Quote
Refractive Indices (Wikipedia):

Vacuum: 1

Gases at 0 °C and 1 atm
Air: 1.000293
Helium: 1.000036
Hydrogen: 1.000132
Carbon dioxide: 1.00045

Liquids at 20 °C
Water: 1.333
Ethanol: 1.36
Olive oil: 1.47

Solids
Ice: 1.31
Fused silica (quartz): 1.46
PMMA (acrylic, plexiglas, lucite, perspex): 1.49
Window glass: 1.52
Polycarbonate (Lexan™): 1.58
Flint glass (typical): 1.62
Sapphire: 1.77
Cubic zirconia: 2.15
Diamond: 2.42
Moissanite: 2.65


Does this mean that we should divide conventional refraction index values by 4 (in relation to what onyXMaster states above) to get the corresponding refraction?

E.g. water refraction index in FF = 1.333 / 4 = 0.33325?
  Details E-Mail
GMM
Moderator
Filter Forge, Inc
Posts: 3491
Quote
Sphinx. wrote:
Does this mean that we should divide conventional refraction index values by 4 (in relation to what onyXMaster states above) to get the corresponding refraction?


I'm afraid refraction values used in FF have no direct relation to conventional refraction indices. I've asked the developers to look into the component code, and it seems the [0...100] slider is mapped to the IOR range of [infinity... 1].
  Details E-Mail
Sphinx.
Filter Optimizer

Posts: 1750
Filters: 39
Thanks, are you sure it not the other way around? I.e. FF Refraction [0...100] slider is mapped to the IOR range of [1..infinity]? Or maybe inverted FF Refraction range?

That would make more sense as there is no distortion if FF refraction is 0 (which again is what I would expect with a real world refraction index of 1)
  Details E-Mail
emme
Posts: 718
Filters: 8
I wonder what an IOR of infinity would mean in reality smile:D

I guess we could try set up a test scene in a 3D renderer to find out what values would match the IOR of water/glass ect. Like render a half of a glass sphere with a grid below it and tweak the refraction value in FF to match the distortion. Should work right?
  Details E-Mail
GMM
Moderator
Filter Forge, Inc
Posts: 3491
Quote
Sphinx. wrote:
are you sure it not the other way around? I.e. FF Refraction [0...100] slider is mapped to the IOR range of [1..infinity]? Or maybe inverted FF Refraction range?


I have little understanding how it really works. The exact formula that is fed into the renderer is as follows:
asin((1 - slider_value)*normal_projection_length).

I'm afraid I can't explain this code and don't have any more details to share.
  Details E-Mail
Sphinx.
Filter Optimizer

Posts: 1750
Filters: 39
Quote
GMM wrote:
I have little understanding how it really works. The exact formula that is fed into the renderer is as follows:
asin((1 - slider_value)*normal_projection_length).


Thanks, that makes sense - the slider is inverted like I expected. I'll see if I can figure out the relation to the conventional numbers smile:-)

Quote
emme wrote:
I wonder what an IOR of infinity would mean in reality

I guess we could try set up a test scene in a 3D renderer to find out what values would match the IOR of water/glass ect. Like render a half of a glass sphere with a grid below it and tweak the refraction value in FF to match the distortion. Should work right?


IOR of infinity? A piece of black hole core would be involved here, I guess smile;-)

Your experiment would definitely be a help, also to verify a solution a some point smile:-)
  Details E-Mail
emme
Posts: 718
Filters: 8
Yup smile:D

Will try this at some point. (not the black hole core... the 3D thing)
  Details E-Mail
emme
Posts: 718
Filters: 8
Ok, here is a test. I rendered the reference images in Blender, then matched the refraction in FF. There is something wonky with the normal calculation at the top of the hemisphere in FF. Or it could be a problem with free ellipse / circular arc math. Other than that, the refractions match very closely with these values.

IOR 1.333 (water) -> 4.5
IOR 1.450 (glass) -> 5.5

  Details E-Mail

Join Our Community!

Filter Forge has a thriving, vibrant, knowledgeable user community. Feel free to join us and have fun!

33,712 Registered Users
+19 new in 30 days!

153,533 Posts
+31 new in 30 days!

15,348 Topics
+73 new in year!

Create an Account

Online Users Last minute:

24 unregistered users.