POV-Ray : Newsgroups : povray.unofficial.patches : reflection bug on big bump_size ? : reflection bug on big bump_size ? Server Time
14 May 2024 20:20:24 EDT (-0400)
  reflection bug on big bump_size ?  
From: zuegs
Date: 2 Feb 2006 13:15:00
Message: <web.43e24b4ae88354737e58daeb0@news.povray.org>
Dear all,

As posting in "bugreports" seems not do work, I like the ask if following
suggestion (source-code change below) could be a patch feature for MegaPov
or other... This theme was already discussed in:
http://news.povray.org/povray.general/thread/%3Cweb.43ca31da7b18765d8d381ce00%40news.povray.org%3E/

I'am using Pov-Ray 3.6 on Windows XP and encountered a problem with
reflections on very bumpy surfaces when camera is placed near and parallel
to it. The problem is, that in this case the reflection on surface looks
more and more flat what's not right to me.

Scene:
camera {
  location <0, 2, -10>
  look_at 0
}
plane { y, 0
  finish { reflection 1.0 ambient 0.0 diffuse 0.0 specular 0.0 }
  normal { bozo 50 scale 0.001 }
}
box { <-1, 0, -1>, <1, 5, 1>
  pigment { color rgb <1, 1, 0> }
  finish { ambient 1.0 diffuse 0.0 specular 0.0 reflection 0.0 }
}

By changing bozo value of plane from 0 through 1, the reflection on surface
gets more and more blurred what is correct, when raising the bozo over 5 or
more, the reflection looks more and more flat again and that's wrong I
think.
The nearer the camera is to the surface, the less bozo is needed to see this
artefact.

I located this effect in source-code "lightning.cpp" in function "Reflect".
Following an extraction of the source-code:
01:    /* Nathan Kopp & CEY 1998 - Reflection bugfix
02:      if the new ray is going the opposet direction as raw normal, we
03:      need to fix it.
04:      */
05:
06:    VDot(n, New_Ray.Direction, Jitter_Raw_Normal);
07:
08:    if (n < 0.0)
09:    {
10:      /* It needs fixing.  Which kind? */
11:
12:      VDot(n2,New_Ray.Direction,Jitter_Normal);
13:
14:      if (n2 < 0.0)
15:      {
16:        /* reflected inside rear virtual surface. Reflect Ray using
17: Raw_Normal */
18:        VDot(n,Ray->Direction,Jitter_Raw_Normal);
19:        n *= -2.0;
20:        VAddScaled(New_Ray.Direction, Ray->Direction,
n,Jitter_Raw_Normal);
21:      }
22:      else
24:      {
24:        /* Double reflect NRay using Raw_Normal */
25:        /*VDot(n,New_Ray.Direction,Jitter_Raw_Normal); - kept the old
26: n around */
27:        n *= -2.0;
28:        VAddScaledEq(New_Ray.Direction, n, Jitter_Raw_Normal);
29:      }
30:    }
31:    VNormalizeEq(New_Ray.Direction);
32:    /* NK & CEY ---- */

The problem is the descision about the reflection handling when "reflected
inside rear virtual surface" on line 18-20. Here the incoming Ray gets
reflected against the unbumped normal of the surface what leads to a flat
reflection.

I suggest to better use the same threadment for reflection as on line 24-28
in this case, a double reflection what keeps the bumpy argument. That means
the "if" condition on line 14 is not nescessairy and the "else-part" (line
24-28) should be used in place.

I posted a render image with original handling on left images and sugested
handling on right images. The images in first row are without AA, those in
second row with AA. Please have a look here:

http://www.rowen.ch/pov/povref1.jpg

This change in source-code doesn't effect any reflection with small
bump_size, because the propability that condition on line 08 gets true is
very low! In most scenes this change wouldn't produce any difference.

But in some conditions as describted at beginning of this post the suggested
change would produce a much more realistic reflection, I think.

I would be very happy for comments on this, thanks a lot.

Best regards

zuegs


Post a reply to this message

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