POV-Ray : Newsgroups : povray.general : reflection on surfaces with big bump_size Server Time
1 Aug 2024 10:18:39 EDT (-0400)
  reflection on surfaces with big bump_size (Message 1 to 8 of 8)  
From: zuegs
Subject: reflection on surfaces with big bump_size
Date: 15 Jan 2006 06:30:00
Message: <web.43ca31da7b18765d8d381ce00@news.povray.org>
Following plane with bozo normals looks good as long bump_size is low (less
than 5). When I set bozo to high value as 50 then reflection should come
very blurry and should look similar to radiosity-effect. But in POV-Ray,
reflection on high bump_sized normals looks more shinny than blurry...
WHY?

Thanks for reply... best regards, zuegs

my 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 }
}


Post a reply to this message

From: zuegs
Subject: Re: reflection on surfaces with big bump_size
Date: 18 Jan 2006 14:45:00
Message: <web.43ce9a564d3eab571562fc90@news.povray.org>
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

From: zuegs
Subject: Re: reflection on surfaces with big bump_size
Date: 26 Jan 2006 14:15:00
Message: <web.43d91f094d3eab5cd294db10@news.povray.org>
Hi all...

i can't solve this myself...
....anyone a idea on above...

Please, please, please

zuegs


Post a reply to this message

From: Chris B
Subject: Re: reflection on surfaces with big bump_size
Date: 26 Jan 2006 17:58:29
Message: <43d95415$1@news.povray.org>
Hello Zuegs,

I'm not actually answering your question here, but I'm hoping that if I can 
clarify the problem then someone with more knowledge than me may step in and 
comment.

I've had a look at your code and rendered it with various alternative bozo 
settings.
I've looked at your description of the problem and when you say:
>
> When I set bozo to high value as 50 then reflection should come
> very blurry and should look similar to radiosity-effect. But in
> POV-Ray, reflection on high bump_sized normals looks more
> shinny than blurry...
>
I think you mean that as you pass from bozo 0 to bozo 5 the reflected edges 
of your box become progressively more blurred. As you pass from bozo 5 up to 
bozo 50, you get a greater distribution of reflected light across the 
reflecting surface, but the reflected edges of your box start to become well 
defined again, until you get really quite crisp and distinctive reflections 
of the edges of the box.

I've increased the scale of the finish and zoomed in on a portion of the 
reflection to illustrate this effect. I've also added a little blue sphere 
where the edge of the box meets the surface, so everything below the blue 
dot is a reflection of the box above the blue dot.

camera {
  location <0, 2, -10>
  look_at <1,0,-1>
  angle 15
}
plane { y, 0
  finish { reflection 1.0 ambient 0.0 diffuse 0.0 specular 0.0 }
  normal { bozo 15  scale 0.3 }
}

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 }
}
sphere {<1,0,-1>,0.02 pigment {color <0,1,1>} finish {ambient 1.0}}


If you reduce this to bozo 3, you get little or no straight edges to the 
reflected image, whereas above bozo 3 you get progressively more straight 
edge to the reflection. This is what I think you're referring to in your 
second note where you say:
>
> The programmer decided to reflect incomming ray on
> non-disturbed surface what creates the fully mirror effect.
>
I don't fully follow the POV-Ray source code you included in your second 
note, but it seems to me that, if the ray strikes the surface where the bozo 
normal is close to perpendicular to the actual surface, but leaning more 
towards the camera than the box, that the code treats it as if it is exactly 
perpendicular and therefore produces a 'flat' reflection, rather than 
perform the 'real' calculation of the shape of the reflection. Whereas if 
it's close to vertical but leaning more towards the box, it performs a more 
detailed calculation, resulting in no straight edge.

When the bozo setting is relatively low, this approximation is fine and as 
it increases, the approximation becomes more apparent.

Did I correctly describe the effect you're having problems with?

Regards,
Chris B.


Post a reply to this message

From: zuegs
Subject: Re: reflection on surfaces with big bump_size
Date: 27 Jan 2006 08:55:00
Message: <web.43da25b14d3eab5823b7640@news.povray.org>
Hi Chris B

I'am very pleased for your reply, thanks.
Yes I think you fully understood my problem, thanks again.

source-code:
if the bozo-normal is leaning towards the box so that the camera gets behind
the normal/surface, the code treats this by reflecting it as surface is
'flat'.
The more the camera is down (near surface with quite parallel view) the more
often it happens that the camera gets behind the bozo-normal. So surface
looks flat... (the lower the camera less bozo is needed to get this
artefacts)

It would be great if one of the programmers could have a look on this
because i think that the current implementation of reflection leads to
artefacts (wrong reflection) in this case and this seams to be a bug for
me.... am i wrong???

best regards
zuegs


Post a reply to this message

From: Chris B
Subject: Re: reflection on surfaces with big bump_size
Date: 27 Jan 2006 18:06:48
Message: <43daa788$1@news.povray.org>
"zuegs" <zue### [at] bluewinch> wrote in message 
news:web.43da25b14d3eab5823b7640@news.povray.org...
> Hi Chris B
>
> I'am very pleased for your reply, thanks.
> Yes I think you fully understood my problem, thanks again.
>
> source-code:
> if the bozo-normal is leaning towards the box so that the camera gets 
> behind
> the normal/surface, the code treats this by reflecting it as surface is
> 'flat'.
> The more the camera is down (near surface with quite parallel view) the 
> more
> often it happens that the camera gets behind the bozo-normal. So surface
> looks flat... (the lower the camera less bozo is needed to get this
> artefacts)
>
> It would be great if one of the programmers could have a look on this
> because i think that the current implementation of reflection leads to
> artefacts (wrong reflection) in this case and this seams to be a bug for
> me.... am i wrong???
>
> best regards
> zuegs
>
>

I'm not sure I'd call it a bug, because it seems to me to be related to the 
behaviour of a part of the surface that, if the surface was bumpy for real 
rather than a flat surface with distortion of the normals, would be out of 
sight of the camera. Because it is really just a flat surface, the point is 
visible and the programmer had to define a reflective behaviour which, in a 
real environment, would be undefined.

There are probably lots of scenes that would be significanlty altered if the 
default behaviour were to be changed, but you could suggest an optional 
setting to handle this condition in the way you described.

Also you might try fiddling with the reflection setting which you can use to 
reduce the reflection for low angles by using it in the reverse fashion to 
that described in the documentation. ie. by telling it to reflect highly at 
high angles and less at low angles.

The following example takes the bozo to 50 using the second reflection 
parameter to compensate for the effect you're having a problem with.
It's a bit of a cheat, but it may serve as a workaround pending a better 
solution.

camera {
  location <0, 2, -10>
  look_at 0
}
plane { y, 0
  finish { reflection {3.0 0.5} 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 }
}

Regards,
Chris B.


Post a reply to this message

From: zuegs
Subject: Re: reflection on surfaces with big bump_size
Date: 29 Jan 2006 17:50:01
Message: <web.43dd45544d3eab55f1e9ae40@news.povray.org>
Hi Chris B

Thanks for your reply!

I see that it is difficult to define a reflection behavior that doesn't
exist in real environment. Having read some publications on this topic over
weekend I found that suggesting a perfect handling for describted condition
wouldn't be possible.
But while reviewing source-code I feeled that the "else handling" on second
condition (line 23-27 in code above) would give a better result as current
handling (line 15-19).

So i suggest to just to remove second "if" and let the "else"-code in place:
11      /* It needs fixing.  Which kind? */
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);

I meen to double reflect in every case when "New_Ray.Direction" is behind
"Jitter_Raw_Normal". So the resulting normal stays bumpy but just flips on
good side of surface. Ok, this is not the most accurate and physical
solution but it gives a much better result than just a flat reflection.

> There are probably lots of scenes that would be significanlty altered if the
> default behaviour were to be changed, but you could suggest an optional
> setting to handle this condition in the way you described.

I think, for most scenes with small bumpy there will be no significantly
change because they will rarely match condition that "New_Ray.Direction" is
behind "Jitter_Raw_Normal". One of the reason, that noone noticed this
"reflection-problem" yet.

As I was not yet able to compile pov-ray myself, i coded a simple raytracer
with current and new reflection handling. I posted a picture here:

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

On left-side is the default povray handling and at the right-side is the new
handling. Up-side without aliasing, down-side with aliasing.

As you can see, with new handling the reflection stays bumpy/blurry and
gives a more realistic result for me.

I would feel very happy if you could tell me what you think about...
.... with best regards

zuegs


Post a reply to this message

From: Chris B
Subject: Re: reflection on surfaces with big bump_size
Date: 30 Jan 2006 08:26:49
Message: <43de1419$1@news.povray.org>
"zuegs" <zue### [at] bluewinch> wrote in message 
news:web.43dd45544d3eab55f1e9ae40@news.povray.org...
> Hi Chris B
>
> ... snip ...
>
> http://www.rowen.ch/pov/povref1.jpg
>
> On left-side is the default povray handling and at the right-side is the 
> new
> handling. Up-side without aliasing, down-side with aliasing.
>
> As you can see, with new handling the reflection stays bumpy/blurry and
> gives a more realistic result for me.
>
> I would feel very happy if you could tell me what you think about...
> .... with best regards
>
> zuegs
>

Hi Zuegs,

I'm with you. I think your version looks better.
I'm not sure what the correct route would be to propose this as a change to 
the POV-ray source code.

I see that there are newsgroups on povray.programming and on 
povray.unofficial.patches.
Also I think Mega-POV includes unofficial patches, so it may be worth 
contributing to that.

Because it potentially affects any surface with a pronounced normal and 
where the line of sight of the camera is close to parallel to the surface, I 
suspect there'll be more chance of adoption if it's a parameter controlled 
change, as this would reduce the risk of interfering with existing scenes.

Good luck,
Chris B.


Post a reply to this message

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