POV-Ray : Newsgroups : povray.pov4.discussion.general : Suggested v4.0 changes to reflection where perturbed normals. Server Time
25 May 2022 06:15:07 EDT (-0400)
  Suggested v4.0 changes to reflection where perturbed normals. (Message 1 to 1 of 1)  
From: William F Pokorny
Subject: Suggested v4.0 changes to reflection where perturbed normals.
Date: 3 Feb 2022 08:44:34
Message: <61fbdc42$1@news.povray.org>
New keyword as in: reflection { ... inv_pnormal_cure 4 }

Regarding the reflected ray adjustments with any normal{} block 
resulting in inverted reflected rays as compared to the raw surface 
normals. These should be extended and brought out as a set of options. 
It is confusing when such actions are done in silence. The associated 
code can currently be found in Trace::ComputeReflection().

The povr branch is using a new keyword called inv_pnormal_cure which 
takes a float argument. The integer portion chooses one of seven 'cures' 
currently.  The fractional digits following the decimal point are used 
only with cure 5 as the probability of the reflected ray being generated 
in a direction opposed to the incoming perturbed normal direction.

If you have no normal{} block in the texture, only Fix0 runs and in 
result it does nothing. In other words, there will be no modifications 
to reflected rays by ComputeReflection unless a normal{} block is used. 
Where normal{} and there are already near tangent ray surface 
interactions (a sphere at the edges) the fixes start fixing on any 
non-zero bump size.

------- povr's current cures

Fix0 - This is itself a fix of sorts and it predates the 1998 v3.1 Fix1. 
All generated reflected rays are calculated as if no perturbed normals 
invert with respect to the raw surface normal. We can still see through 
the shape at large bump sizes and this what Fix1 and Fix3 were created 
to address. However, these surface piercing rays are always inside the 
negative half plane of the raw normal.

Fix1 - Since 1998 (added to v3.1). In total it is Fix0 above followed, 
potentially, by Fix2 or Fix3. The break out between whether to apply 
Fix2 or Fix3 is made by testing the Fix0 generated ray against the 
perturbed normal direction.

Fix2 - New to povr. Runs Fix0 and then on seeing the reflected ray still 
in an inverted relation to the raw surface normal it applies another 
calculation which moves the generated reflected ray another step toward 
the raw normal direction. The comments call this a double reflection, 
and it might be for specific surface structure assumptions, but in 
general, it's more of a heuristic fix.

Fix3 - New to povr. Runs Fix0 and then on seeing the reflected ray still 
in an inverted relation to the raw surface, it dumps the current 
reflected ray for a new one calculated with the raw surface normal. 
These reflected rays, to the degree they appear in the total ray color 
result, will appear as if no normal{} block was used. In other words, on 
increasing bump sizes it can be this fix partly ignores the expected 
normal{} effect.

Fix4 - New to povr. This result likely the one intuitively expected with 
larger normal bump sizes. This fix, partly, modifies the Fix0 changes 
such that where the perturbed normal is inverted with respect to the raw 
surface normal the generated reflected ray respects the perturbed normal 
direction. We start to see through the surface as might happen with a 
mesh of wires or a cloth weave. The results here sometimes look quite 
like Fix0 alone at a macro level, but the rays going into the shape here 
are those with perturbed normals inverted with respect to the raw. The 
reflection effect is at a macro level somewhat darker. How much Fix0 
differs from this Fix4, depends on the scene set up.

Fix5 - New to povr. Applies Fix0 and then inverts a portion of the 
reflected rays through the surface using a [0..1) probability specified 
in the fractional part of the passed float value. Think of more porous 
surfaces (being faked by solid ones) where rays can reflect past the 
surface intersection.

Fix11 - This Fix1, but where the internal Fix2 and Fix3 are applied in 
reverse of the long standing test. The result I think less physically 
accurate, but it does tend to better delineate the edges / near tangent 
regions. It's here for effects.


While working on a micro normal pattern for the povr branch, larger bump 
sizes were found to unexpected return non-blurred reflections mixed in 
with extremely blurred ones. Detailed above, found that reflection 
adjustments have been in play a long time.

One sphere with reflection within sky_sphere. Fix1 = Fix0->(Fix2 | Fix3)

Fix0 - Never treat the perturbed normal as inverted with respect to raw.

Fix2 - The double correction / reflection.

Fix3 - Glass marble look due dropping back to raw normal use.

Looking at what povr leaves available as Fix1 using the micro pattern 
and differing bump sizes we see while Fix2 and Fix3 come into play at 
even small bump sizes, but the effect is small until the bump sizes get 
up around 0.5.  What happens will of course vary greatly with the 
normal{} pattern and surface particulars.

Reflected rays
---------------------    Orig   Fix0   Fix2   Fix3
normal { micro 0.00 }  655360 655360      0      0 100%  0%  0%
normal { micro 0.01 }  655360 655317     10     33 100%  0%  0%
normal { micro 0.10 }  655360 651450    976   2934  99%  0%  0%
normal { micro 0.25 }  655360 631096   6162  18102  96%  1%  3%
normal { micro 0.50 }  655360 557621  24868  72871  85%  4% 11%
normal { micro 0.75 }  655360 444730  57817 152813  68%  9% 23%
normal { micro 1.00 }  655360 327379 106134 221847  50% 16% 34%
normal { micro 1.25 }  655360 275507 138012 241841  42% 21% 37%
normal { micro 1.50 }  655360 252949 153439 248972  39% 23% 38%
normal { micro 1.75 }  655360 241388 163163 250809  37% 25% 38%
normal { micro 2.00 }  655360 234691 170364 250305  36% 26% 38%
normal { micro 3.00 }  655360 224005 187031 244324  34% 29% 37%
normal { micro 4.00 }  655360 221058 195115 239187  34% 30% 36%
normal { micro 5.00 }  655360 219605 200161 235594  34% 31% 36%
normal { micro 9.00 }  655360 218117 208661 228582  33% 32% 35%

Attached is an image with povr's cure set 0-5,11 top to bottom.  The 
bump size columns run 0, 0.05, 0.5 and 2.0 left to right. The entire 
grid is repeated on the right with heavy AA showing more of the expected 
normal micro pattern result.

Using two spheres, not hollow, with an orange-red emitting sphere just 
inside each. The more yellow is the exterior texture and the blur the 
interior_texture. The top row is the pre 1998 fix result and the red 
shows what I take to have been "fixed." Namely, without that fix, and 
with large bump sizes, you do see through the surface to the inner 
sphere despite 'effectively' correcting the perturbed normals with 
respect to the raw normals. Fix4 / Cure 4, looks similar with this set 
up, but it uses the flipped to raw normal perturbed normals straight up 
to create the reflected rays.

Bill P.

Post a reply to this message

Download 'curestory.jpg' (686 KB)

Preview of image 'curestory.jpg'


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