POV-Ray : Newsgroups : povray.programming : Determine reflectivity Server Time
21 Dec 2024 13:52:39 EST (-0500)
  Determine reflectivity (Message 1 to 3 of 3)  
From: Pfingstei
Subject: Determine reflectivity
Date: 8 Feb 2008 11:00:01
Message: <web.47ac7a3c9b35cd3a4df537e50@news.povray.org>
Hello POV Ray community;

I have a question concerning the function "determine_reflectivity" (contained in
lighting.cpp) which computes the reflectivity factors for a secondary ray.

As input we need the scalar product between the ray vector and the surface
normal = cosine of the angle between the two vectors (variable: cos_angle).

In the function "determine_reflectivity" the proceeding is as follows:

1.) Compute variable Reflection_frac

Reflection_Frac = pow(1.0 - cos_angle, Reflection_Falloff);

2.) Compute reflectivity by linear combination

CRGBLinComb2(reflectivity, Reflection_Frac, Reflection_Max, (1 -
Reflection_Frac), Reflection_Min);

Pseudocode: reflectivity = Reflection_Frac * Reflection_Max +
(1-Reflection_Frac)*Reflection_Min



Some considerations:

If the ray hits the surface perpendicular (i.e. direction of ray vector = -
direction of surface normal), cos_angle finally becomes 1, since the angle
between the two vectors is zero.

What follows is, that the variable Reflection_Frac gets zero in function
"determine_reflectivity".

In the end, the linear combination becomes shorter:

Pseudocode: reflectivity = 0 * Reflection_Max + (1-0)*Reflection_Min =
Reflection_Min

Same for an angle of 90 degrees (and falloff 1):
- Reflection_Frac gets 1
- reflectivity = Reflection_Max

My problem is: if I illuminate a surface with rays perpendicular to the surface,
I would not expect a reflectivity equal to the minimum threshold. I would expect
Reflection_Max! Same for an angle of 90 degrees between ray and surface normal:
I would expect Reflection_Min, not Reflection_Max!

Has anyone an idea to solve the problem? Where's my error in reasoning? It would
be very helpful for me.

Thank you very much!


Post a reply to this message

From: Trevor G Quayle
Subject: Re: Determine reflectivity
Date: 8 Feb 2008 11:25:00
Message: <web.47ac821c3a69c762c150d4c10@news.povray.org>
"Pfingstei" <Pfi### [at] gmxde> wrote:
> Hello POV Ray community;
>
> I have a question concerning the function "determine_reflectivity" (contained in
> lighting.cpp) which computes the reflectivity factors for a secondary ray.
>
> As input we need the scalar product between the ray vector and the surface
> normal = cosine of the angle between the two vectors (variable: cos_angle).
>
> In the function "determine_reflectivity" the proceeding is as follows:
>
> 1.) Compute variable Reflection_frac
>
> Reflection_Frac = pow(1.0 - cos_angle, Reflection_Falloff);
>
> 2.) Compute reflectivity by linear combination
>
> CRGBLinComb2(reflectivity, Reflection_Frac, Reflection_Max, (1 -
> Reflection_Frac), Reflection_Min);
>
> Pseudocode: reflectivity = Reflection_Frac * Reflection_Max +
> (1-Reflection_Frac)*Reflection_Min
>
>
>
> Some considerations:
>
> If the ray hits the surface perpendicular (i.e. direction of ray vector = -
> direction of surface normal), cos_angle finally becomes 1, since the angle
> between the two vectors is zero.
>
> What follows is, that the variable Reflection_Frac gets zero in function
> "determine_reflectivity".
>
> In the end, the linear combination becomes shorter:
>
> Pseudocode: reflectivity = 0 * Reflection_Max + (1-0)*Reflection_Min =
> Reflection_Min
>
> Same for an angle of 90 degrees (and falloff 1):
> - Reflection_Frac gets 1
> - reflectivity = Reflection_Max
>
> My problem is: if I illuminate a surface with rays perpendicular to the surface,
> I would not expect a reflectivity equal to the minimum threshold. I would expect
> Reflection_Max! Same for an angle of 90 degrees between ray and surface normal:
> I would expect Reflection_Min, not Reflection_Max!
>
> Has anyone an idea to solve the problem? Where's my error in reasoning? It would
> be very helpful for me.
>
> Thank you very much!

Variable reflection in POV is not a realistic implementation,  but rather an
artistic interpretation.  Max simply corresponds to 90deg, min to 0deg.  There
is nothing that limits max to be greater than min.  But, in the end, this
simply a linear (or whatever the exponent is) variable reflection.

Fresnel reflection is a little more realistic, as it is based on ior and does
give higher reflectivity at the shallow angles and steeper angles as you are
expecting.  It still isn't an exact simulation of real-life, but much closer.
Real fresnel and refraction has two components a real and imaginary, POV only
uses the real component which corresponds to the IOR.

-tgq


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Determine reflectivity
Date: 9 Feb 2008 04:56:41
Message: <47ad78d9@news.povray.org>
Pfingstei wrote:
> My problem is: if I illuminate a surface with rays perpendicular to the surface,
> I would not expect a reflectivity equal to the minimum threshold. I would expect
> Reflection_Max! Same for an angle of 90 degrees between ray and surface normal:
> I would expect Reflection_Min, not Reflection_Max!
> 
> Has anyone an idea to solve the problem? Where's my error in reasoning? It would
> be very helpful for me.

I would strongly recommend you get yourself a book on ray-tracing if you 
want to know why POV-Ray does things the way it does them. The source code 
is pretty much the wrong place to start to learn how ray-tracing works. 
There are several books listed in the documentation, several of which will 
be readily available in your local library.

	Thorsten


Post a reply to this message

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