templargfx opened this issue on Apr 27, 2010 · 103 posts
ice-boy posted Wed, 05 May 2010 at 1:43 PM
Quote - > Quote - BB : How do I use that true fresnel script you posted earlier?
The TrueFresnel function takes an IOR as an argument, and returns a node tree that calculates the correct Reflection_Value to use. It implements the Fresnel equations exactly.
I used IOR=1.45 for car paint. Use IOR=1.33 for water. Use IOR=.75 for when you're underwater. Use 1.54 or thereabouts for paint. Use IOR=20 (approx) for softly shiny metal. Use IOR=40 for shiny metal (like chrome).
How you use the output of TrueFresnel depends on the material, and also depends on whether you're making a GC material. A full explanation is many pages.
But for plain paint, simplest version, without GC in the shader:
fresnel = TrueFresnel(1.45)
specular = Blinn(...) # whatever
diffColor = .5 * RED # or whatever
diffValue = .8 * (1 - fresnel) # Conservation of energy says if you're reflecting, you're not diffusing
s = Surface(diffColor, diffValue, 1, 0, Alternate_Specular = specular)
s.Reflection_Color = Reflect()
s.Reflection_Value = fresnelFor thin glass, there are multiple internal reflections that compound the Fresnel reflectivity. And since thin glass doesn't bend light enough to matter, we use transparency instead of refraction.
The function to generate thin-glass compound reflection is 2 * r / (1 + r), where r is the ordinary Fresnel reflectance.
fresnel = TrueFresnel(1.54)
fresnel = 2 * fresnel / (1 + fresnel)
s = Surface(1, 0, 1, 0)
s.Transparency = fresnel
s.Reflection_Color = Reflect()
s.Reflection_Value = 1Of course you'd probably want to include a specular in that.
does this shader have a lot of nodes? can you please post a screenshot? its easier for me to see teh nodes.
thank you.