POV-Ray : Newsgroups : povray.unofficial.patches : reflection bug on big bump_size ? Server Time
4 Dec 2024 21:31:20 EST (-0500)
  reflection bug on big bump_size ? (Message 1 to 6 of 6)  
From: zuegs
Subject: reflection bug on big bump_size ?
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

From: Thorsten Froehlich
Subject: Re: reflection bug on big bump_size ?
Date: 2 Feb 2006 14:16:30
Message: <43e25a8e@news.povray.org>
zuegs wrote:
> Dear all,
> 
> As posting in "bugreports" seems not do work, I like the ask if following

Please read:

From: Alan Kong <ako### [at] povrayWWWSPAMCOMorg>
Newsgroups: povray.announce.frequently-asked-questions
Subject: bug reporting
Message-ID: <fpupiu02i1198jbb38i3o06hv6is1a3uar@4ax.com>
Xref: news.povray.org povray.announce.frequently-asked-questions:50

	Thorsten


Post a reply to this message

From: zuegs
Subject: Re: reflection bug on big bump_size ?
Date: 2 Feb 2006 15:25:00
Message: <web.43e269c9cf5dadab7e58daeb0@news.povray.org>
Hi Thorsten

I feel having followed instructions as discribted in:

Thorsten Froehlich <tho### [at] trfde> wrote:
> From: Alan Kong <ako### [at] povrayWWWSPAMCOMorg>
> Newsgroups: povray.announce.frequently-asked-questions
> Subject: bug reporting
> Message-ID: <fpupiu02i1198jbb38i3o06hv6is1a3uar@4ax.com>
> Xref: news.povray.org povray.announce.frequently-asked-questions:50

Having discussed in "povray.general" and having presented a "simple scene" I
think It's time to go further...

As my post in "bugreports" haven't appeared yet, and last post is dated from
march 20th 2005 I think that this newsgroup is out of service ?!?

Is there a programmer from PovRay or MegaPov that could have a look on this,
as it's just a very small change in source and gives a much better result
und bumpy reflections! Please see following image (left old, right new):

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

best regards

zuegs


Post a reply to this message

From: Christoph Hormann
Subject: Re: reflection bug on big bump_size ?
Date: 2 Feb 2006 16:40:03
Message: <drtu3h$vn7$1@chho.imagico.de>
zuegs wrote:
> [...]
> 
> 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 think you analyzed the situation correctly but could you explain why 
you think with this change it is more 'correct' than before?  The fact 
that your sample scene looks better with it is an indication that it 
leads to more plausible results in some circumstances but i actually 
don't see a reason yet that it is in any way accurate.

What the third case does is in fact a strongly simplified simulation of 
a double reflection - something that indeed will occur quite frequently 
on a strongly bumped surface.  A true double (or more times) reflection 
would however require a complete additional surface handling (including 
possible refraction, attenuation etc.).

Christoph

-- 
POV-Ray tutorials, include files, Landscape of the week:
http://www.imagico.de/ (Last updated 31 Oct. 2005)
MegaPOV with mechanics simulation: http://megapov.inetart.net/


Post a reply to this message

From: zuegs
Subject: Re: reflection bug on big bump_size ?
Date: 2 Feb 2006 17:25:00
Message: <web.43e2862dcf5dadab7e58daeb0@news.povray.org>
Hi Christoph,

Many thanks for reply.

Christoph Hormann <chr### [at] gmxde> wrote:
> I think you analyzed the situation correctly but could you explain why
> you think with this change it is more 'correct' than before?  The fact
> that your sample scene looks better with it is an indication that it
> leads to more plausible results in some circumstances but i actually
> don't see a reason yet that it is in any way accurate.
>
> What the third case does is in fact a strongly simplified simulation of
> a double reflection - something that indeed will occur quite frequently
> on a strongly bumped surface.  A true double (or more times) reflection
> would however require a complete additional surface handling (including
> possible refraction, attenuation etc.).

You're completely right! Doing a physicaly correct reflection on strongly
bumped surface would be very complicated (multi reflections) and I agree
that this could not be the target. So we need to handle this unrealistic
case (incomming ray behind virtual surface) in a manner that it looks as
realistic as possible.
The proposed modification doesn't give a physical correct/accurate
reflection, but one that is more "realistic" and physicaly more probable
than the flat reflection (second case) on a bumpy surface.
I agree that there should be a bit of attenuation tue to multi-reflection
and some other refinements... but this would only give small advantages in
relation to calculation time compared to proposed simple change.
I found this when I looked for blurred reflections that are not directly
support by PovRay and found workarounds by AA or "micro-normals" that
finally given in some cases unrealistic sharp refections tue to this
problem. This change would be the only chance for me to realy realize
strongly blurred reflections in povray.

Is there any chance that this could flow once in povray, megapov or an other
patch?

Thanks and best regards

zuegs


Post a reply to this message

From: Christoph Hormann
Subject: Re: reflection bug on big bump_size ?
Date: 18 Feb 2006 11:25:03
Message: <dt7hjn$mj6$1@chho.imagico.de>
zuegs wrote:
> 
> Is there any chance that this could flow once in povray, megapov or an other
> patch?

Since this would be a change breaking old scenes chances for being 
integrated into POV-Ray right away are low.  The problem itself has 
however been noted and will be considered.

And it is of course possible that this will be added as an optional 
feature to MegaPOV (to be turned on via SDL switch or #version).

Christoph

-- 
POV-Ray tutorials, include files, Landscape of the week:
http://www.imagico.de/ (Last updated 31 Oct. 2005)
MegaPOV with mechanics simulation: http://megapov.inetart.net/


Post a reply to this message

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