|
|
Hello all,
like to rethrow this theme to hopefully get some comments from you, or from
a developper...
The above behavior source is in "lightning.cpp". The variables meaning are:
- Jitter_Raw_Normal: is the normal vector of the surface.
- Jitter_Normal: is the normal vector of the disturbed surface
(normal{bozo})
- Ray->Direction: is the vector of incomming light
- New_Ray->Direction: is the vector of the reflected light
-----------
01 VDot(n,Ray->Direction, Jitter_Normal);
02 n *= -2.0;
03 VAddScaled(New_Ray.Direction, Ray->Direction, n, Jitter_Normal);
04 /* Nathan Kopp & CEY 1998 - Reflection bugfix
05 if the new ray is going the opposet direction as raw normal, we
06 need to fix it.
07 */
08 VDot(n, New_Ray.Direction, Jitter_Raw_Normal);
09 if (n < 0.0)
10 {
11 /* It needs fixing. Which kind? */
12 VDot(n2,New_Ray.Direction,Jitter_Normal);
13 if (n2 < 0.0)
14 {
15 /* reflected inside rear virtual surface. Reflect Ray using
16 Raw_Normal */
17 VDot(n,Ray->Direction,Jitter_Raw_Normal);
18 n *= -2.0;
19 VAddScaled(New_Ray.Direction, Ray->Direction,
n,Jitter_Raw_Normal);
20 }
21 else
22 {
23 /* Double reflect NRay using Raw_Normal */
24 /*VDot(n,New_Ray.Direction,Jitter_Raw_Normal); - kept the old n
25 around */
26 n *= -2.0;
27 VAddScaledEq(New_Ray.Direction, n, Jitter_Raw_Normal);
28 }
29 }
30 VNormalizeEq(New_Ray.Direction);
-------------
My problem happens when condtion on line 13 gets true, this happens when
incomming ray is behind the disturbed surface Jitter_Normal. The programmer
decided to reflect incomming ray on non-disturbed surface what creates the
fully mirror effect.
The more the normal is disturbed (big bump_size) so bigger is the
probability that incomming ray can be behind disturbed normal.
Why not apply Double reflection in this case too as on line 23-27?
Should I better post this in "bugreports"?
Please help me understand...
zuegs
Post a reply to this message
|
|