POV-Ray : Newsgroups : povray.programming : Determine reflectivity : Determine reflectivity Server Time: 6 Jul 2008 10:15:10 GMT
  Determine reflectivity  
From: Pfingstei
Date: 8 Feb 2008 16:00:01
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

Copyright 1991-2004 POV-Team™