POV-Ray : Newsgroups : povray.programming : We need Fresnel reflectance. Server Time
29 Jul 2024 00:33:54 EDT (-0400)
  We need Fresnel reflectance. (Message 1 to 4 of 4)  
From: Steve H 
Subject: We need Fresnel reflectance.
Date: 18 May 1999 13:40:37
Message: <37418d36.368306418@news.povray.org>
On an aside question: 

   Does anyone have the source for POV 3.1e, not 3.1a ,  for win95?


And now for the meat and potatos:

Along with the new radiosity, I'm going to add Fresnel reflectance to objects
that already contain reflection.   That is, unless one of you wants to beat me
to it!  The equation for fresnel reflectance based off regular reflection is 

fresnel_reflection = reflection + 
((1.0-(V dot R)) * (1.0-reflection))*amount

Where V is the vector coming out of the intersection point towards the
viewpoint (reversed traced ray)  and R is the reflected vector. All are
normalized of course.  "amount" is a number <= 1.0 and  > 0.0 that says how
much the effect takes place.  You'll need to add keyword "fresnel" as a toggle
and "amount" as a parameter in finish{} statements.  If fresnel is on,
reflection should be merely replaced by the above equation. Viola.   

 (For you physicists, yes, this equation ignores the wavelength of the light.
I suppose this makes some "big difference" in some "laser laboratory"
somewhere.)

 Fresnel reflection first caught my attention in a number of scenes from 3D
Studio Max.  Some of the renders were amazingly realistic.   It adds a gloss
to objects like nothing else I've ever seen.  It some cases it even makes
objects look wet. 

It basically follows the rule that the more shallow the angle of incidence,
the more reflected light takes over.  If the light is reflected almost
directly back towards the eye then the less reflected light plays and the more
the diffuse or transmitted component takes over.    If you've been in a
swimming pool once in your life you've already seen this effect.  

Some real-life surfaces that actually have this are
-Water.
-Laminated wood.
-Car finishes.
- Anything glossy.  

In general, glass and certain metals do not have this property.   This is the
reason, if you've noticed, that water tends to look more like molten glass in
ray-traced scenes than photorealistic water.   Have at it...

------------------------
Steve H.


Post a reply to this message

From: Ron Parker
Subject: Re: We need Fresnel reflectance.
Date: 18 May 1999 14:12:23
Message: <37419f77.0@news.povray.org>
On Tue, 18 May 1999 16:52:34 GMT, Steve H. wrote:
>On an aside question: 
>
>   Does anyone have the source for POV 3.1e, not 3.1a ,  for win95?

Not yet.  I'm eagerly awaiting it as well, so I can get rid of all these
people who are asking me why the superpatch doesn't work when the official
3.1e is installed. (I get those questions by email as well as in newsgroups.
It's driving me nuts.)

>Along with the new radiosity, I'm going to add Fresnel reflectance to objects
>that already contain reflection.   That is, unless one of you wants to beat me
>to it!

You might want to check out Wyzard's variable/blurred reflection patch first.
It's supposed to do Fresnel reflectance.  It's included in the superpatch, or 
you can get a standalone POV 3.0 version.  Both are at 
http://twysted.net/patchstation .


Post a reply to this message

From: Steve H 
Subject: Re: We need Fresnel reflectance.
Date: 27 May 1999 01:59:35
Message: <374ccf6d.501658662@news.povray.org>
On 18 May 1999 13:12:23 -0500, par### [at] fwicom (Ron Parker) wrote:

>On Tue, 18 May 1999 16:52:34 GMT, Steve H. wrote:
>>On an aside question: 
>>
>>   Does anyone have the source for POV 3.1e, not 3.1a ,  for win95?
>
>Not yet.  I'm eagerly awaiting it as well, so I can get rid of all these
>people who are asking me why the superpatch doesn't work when the official
>3.1e is installed. (I get those questions by email as well as in newsgroups.
>It's driving me nuts.)
>

:)

Hey, since you are in the business of patching there is a small fix that you
can add to your patch that I found a long time ago.  In render.c  starting at
line 2332

 if (create_ray(Ray, x+dx, y+dy, nr))
      {
        Trace_Level = 1;

        Increase_Counter(stats[Number_Of_Samples]);

        Trace(Ray, C, 1.0);

        Clip_Colour(C, C);

         gamma_correct(C);

        Add_Colour(Colour, Colour, C);
      }
      else
      {
        Make_ColourA(C, 0.0, 0.0, 0.0, 0.0, 1.0);
      }


This snippet is in the function Focal_Blur().  It is inside a loop that is
tracing several samples for the blurring calculation.   Notice that it gamma
corrects each individual sample.   I was tracing a scene awhile back where I
was using alot of different focal blur settings.  I noticed that the higher I
took the blur sample the brighter the rendered picture would look.  You might
even consider this a "bug" of sorts.  

 There is a mathematical reason that this happens, namely, since gamma
correction is not a linear function, it cannot be distributed among a sum of
colors without error in the average color.  

To fix this problem, remove the gamma_correct(C); line altogethor.  And at the
end of the whole function do a gamma_correct(Colour) before returning.  Voila.

I posted a large message about this problem several months ago and it fell
between the newsgroup cracks, I suppose you could say, and went unnoticed.


>
>You might want to check out Wyzard's variable/blurred reflection patch first.
>It's supposed to do Fresnel reflectance.  It's included in the superpatch, or

>you can get a standalone POV 3.0 version.  Both are at 
>http://twysted.net/patchstation .
>

I got a URL Not Found for that one.  Maybe there is another place?  Thanks,

-----------
Steve H.


Post a reply to this message

From: Ron Parker
Subject: Re: We need Fresnel reflectance.
Date: 27 May 1999 10:33:39
Message: <374d49b3.0@news.povray.org>
On Thu, 27 May 1999 05:12:15 GMT, Steve H. wrote:
>I posted a large message about this problem several months ago and it fell
>between the newsgroup cracks, I suppose you could say, and went unnoticed.

I remember the message.  If you grab the 3.1e DOS or Linux source, you'll
find that it's been fixed in those versions, so it's been fixed in the
3.1e Windows version and in the Superpatch as well.

>>You might want to check out Wyzard's variable/blurred reflection patch first.
>>It's supposed to do Fresnel reflectance.  It's included in the superpatch, or
>>you can get a standalone POV 3.0 version.  Both are at 
>>http://twysted.net/patchstation .
>
>I got a URL Not Found for that one.  Maybe there is another place?  Thanks,

twysted.net went offline recently, as discussed in povray.general.  I'm
working on getting the superpatch online somewhere else.  I don't know of
anywhere else you could get wyzpov.  If you don't mind getting your hands
dirty, the generic source for the current superpatch is at
http://www2.fwi.com/~parkerr/super31e.zip  
Hints on what you need to add to your project file, makefile, or whatever
to build the superpatch can be found in a recent posting on the unofficial 
patches newsgroup, and more hints on building for Unix are in the povray.unix
group.  Yes, I'm working on consolidating all of this.  

Documentation on the old (3.1a) superpatch features isn't included, but if you 
really need it I can email you a copy of the docs.

Also, a little heavily-unsupported trick:  if you increment EDITDLLVERSION
at the top of pvedit.h you can apparently use the 3.1a code with the 3.1e
editor.  I haven't had any problems yet, but be aware that some of the APIs
might have changed and you could get a crash in some obscure place.  My
next version of the superpatch will work with both the 3.1a and 3.1e editors,
though I'll only support using the 3.1a editor.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.