POV-Ray : Newsgroups : povray.advanced-users : Strange media artefact : Re: Strange media artefact Server Time
23 Apr 2024 18:24:16 EDT (-0400)
  Re: Strange media artefact  
From: William F Pokorny
Date: 9 Feb 2021 07:56:31
Message: <6022867f$1@news.povray.org>
On 2/8/21 2:38 PM, Bald Eagle wrote:
> 
> While working out some media stuff for Mike, I ran a a quick media test to just
> make sure I had the standard part working, and I got some odd results.
> 
> Perhaps someone could render this and tell me why the center gives me a nice x
> gradient, but off to the sides I get those weird fans / lines.
> 

Been now some years since I was digging around in that code, but if I'm 
remembering my "things-look-fishy-there" list correctly, the short 
answer is you need to increase the sampling. Try:

  samples 33

or perhaps more (with stronger AA tend to need less). The second value 
is not used with method 3. The aa_level (recursion limit) and 
aa_threshold stop method 3.


---- Details... Suspicions... on my look at it more later list.

- Why did I jump to the odd number of samples? With method three you get 
+2 samples per sampling segment for odd sample specification and +1 for 
even. Where the decent and the adaptive mode is working, I think the 
code is slightly more symmetric with odd values - and 'probably' creates 
better results.

- I think the adptive sampling mechanism of method 3 is not working for 
absorbtion/emissive only media!! At least not working in the same way as 
scattering. Blah, blah,.... lots more details. Comes to needing to force 
a higher level of sampling - which, you're right, won't always be adaptive.

Aside: You can sort of see this by looking at the number in parens after 
the number of media samples. You can twiddle all you want with the 
samples values and that number will always be +1 or +2 of the initial 
samples setting because it is the number or samples per segment. If you 
have scattering media it comes to be +1 or +2 the initial samples, plus 
some 0-1 float adder. Further, the aa_level and aa_threshold values do 
something if you have scattering media.

- The aa_threshold value I suspect, should have been adjusted on the 
changes to assumed_gamma 1.0 as was done eventually in v3.8 for the 
ambient default (there zero makes more sense, but to match ambient of 
earlier scenes it should not be the previous 0.1, but something much 
smaller like 0.004).

- Though absorption works alone I wonder if it wasn't originally 
supposed to always be paired with scattering.

- When emission was added, a second absorption value spec should have 
been added specifically for it's contribution. Having one value for both 
scattering and emission sometimes just won't work out - and it's harder 
to use even when you can make it work.

Aside: You can get interesting patterns with densities and medias like 
yours by setting the samples low. As low as 2 even.

- Even where the adaptive is working you sometimes need to increase the 
initial samples count quite a bit. As with other gradient sensitive 
adaptive algorithms (isosurfaces, AA method 3(a)) you sometimes have to 
set the initial sample higher to pick up enough change to 'trip' the 
adaptive algorithm. You have to sample rapidly enough to see 
smaller/rapid changes.

(a) - AA method 3, is currently missing this capability except by 
increasing the size of your initial render - which is sort of a back 
door method of increasing the initial number of samples. This something 
Christoph recognized. There are comments in the code.

- Something I do not think made clear in the documentation is that when 
the density is constant method 3 is not used but rather a part of method 
1 or 2 (I don't recall) which is very fast. What this means in practice: 
For constant medias you can get away with settings that are quite 
aggressive. The instant that media is not constant things will either 
not render correctly with the aggressive (cheap) settings or suddenly 
slow significantly if the settings are correct for non-constant media. 
The big slow down happens where the adaptive algorithm gets tripped. In 
other words, the fast path is no longer used - and the method 3 settings 
actually matter.

- It's true with method 3, intervals should be kept at 1. :-) Here it 
happens you can actually set it to 3, 4 or more maybe and get much 
better results. The issue with it, that I saw, is when intervals are >1 
the math gluing together all the intervals is buggy. You get media 
results which are less accurate - sometimes to the point of obvious 
artifacts. Aside. That old Persistence, submarine scene actually used 
the artifacts for effect - but if you look carefully, you can see them.

...There is more, and somewhere I have notes. But! I'm going to worry 
about it all some other day and go grab more coffee. :-)

Disclaimer. I've listed some of my initial media 'suspects'. If I get 
back to working on the media code, I'm sure I'll find myself to be 
right, wrong and partly right/wrong about the different details.

Bill P.


Post a reply to this message

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