POV-Ray : Newsgroups : povray.advanced-users : Strange media artefact Server Time
21 Dec 2024 12:18:47 EST (-0500)
  Strange media artefact (Message 1 to 7 of 7)  
From: Bald Eagle
Subject: Strange media artefact
Date: 8 Feb 2021 14:40:08
Message: <web.6021933a6b2775471f9dae300@news.povray.org>
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.

(Alain, fyi:  the syntax is simply "method 3", not "sampling_method 3")


#version 3.8;
global_settings {assumed_gamma 1.0 }

camera {
 location <0, 8, -10>
 //location <0, 10, 3>
 right x*image_width/image_height
 up y
 look_at <0, 0, 0>
}

light_source {<0, 50, -1> rgb 1}

sky_sphere {pigment {rgb <1, 1, 1>}}


box {<-10, -1, -5>, <10, 1, 5>
 pigment {rgbt 1}
 hollow
 interior {
  media {
   absorption <1, 1, 1>
   //emission <1, 0.2, -0.6>*0.9
   //scattering{ 1, <1,1,1>
   //extinction  2.0
   method 3
   intervals 1 //DO NOT increase !
   samples 10, 50
   density {
    gradient x
    color_map {
     [0.0 rgb 0.0]//border
     //[0.5 rgb 0.1]
     [1.0 rgb 1.0]//center
    } // end color_map
   } // end density
  } // end media
 } // end interior

} // end box


Post a reply to this message

From: William F Pokorny
Subject: Re: Strange media artefact
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

From: Bald Eagle
Subject: Re: Strange media artefact
Date: 9 Feb 2021 13:40:01
Message: <web.6022d691ca7b7f1f1f9dae300@news.povray.org>
William F Pokorny <ano### [at] anonymousorg> wrote:
> Try:
>
>   samples 33

That seemed to be sufficient to rectify the issue.  Can't say that sample 65
looks significantly better...

> 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.

Even at this "late" stage, I do not have an adequate grasp of antialiasing
settings, so maybe that will be a future area of concentration for me to
investigate, or someone else to post some explanation with illustrative code.



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

Well Gooooooollllllly!
Look at all that there stuff under the hood of POV-Ray that you just emptied out
of your head...   :O

> - 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.

Good catch, and that is probably something that needs to be ironed out, or at
least in the short term provided with a little formulaic workaround to tweak the
values accordingly.  Something like the gradient formula for isosurfaces or some
of the lighting formulas in the docs, if that's at all possible.

> ...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. :-)

aye,  I should probably take more notes.  Though I already get razzed about the
number of piles of paper with cryptic scribblings...   ;)


Thanks for the info as always   :)


Post a reply to this message

From: Thomas de Groot
Subject: Re: Strange media artefact
Date: 10 Feb 2021 02:39:39
Message: <60238dbb@news.povray.org>
Op 09/02/2021 om 13:56 schreef William F Pokorny:
> 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
> 
[snip]

Wow! Some nice piece of info there!

I was late testing this media and found also that samples were the 
culprits.

I have one question about them: can samples still be used with two 
parameters with method 3? The Wiki is confusing about this, and I 
wondered if it was a legacy from method 1 or 2, but not necessary anymore.

-- 
Thomas


Post a reply to this message

From: William F Pokorny
Subject: Re: Strange media artefact
Date: 10 Feb 2021 05:58:11
Message: <6023bc43$1@news.povray.org>
On 2/10/21 2:39 AM, Thomas de Groot wrote:
> Op 09/02/2021 om 13:56 schreef William F Pokorny:
>> On 2/8/21 2:38 PM, Bald Eagle wrote:
...
> [snip]
> 
> Wow! Some nice piece of info there!
> 

Keep the disclaimer(a) in my post in mind. I believe most of the 
information is good, but should I get back to digging around again in 
that code, some of it will need revision.

(a) - I'm talking too about the current v3.8. Christoph made changes 
relative to v3.7.

> I was late testing this media and found also that samples were the 
> culprits.
> 
> I have one question about them: can samples still be used with two 
> parameters with method 3? The Wiki is confusing about this, and I 
> wondered if it was a legacy from method 1 or 2, but not necessary anymore.
> 

Yes. You can have the max value, it doesn't hurt anything(b). It looks 
to be used in the statistical sampling methods.

---
(b) Your question reminded me of another media issue. We can have 
multiple medias. When we do there were situations I cannot quite recall 
- with ordering... Mixing media 1&2 with 3 - 'maybe.'

In some of those cases, depending on ordering, certain settings matter 
which would not if a particular media in the collection were run alone. 
It's been too long - I'm not remembering the details, but there were 
issues with multiple medias and option settings.

Hmm, another ringing bell; Was there also something with one media in 
multiples being constant and others not...?

I might have created test cases for some of the issue/questions. I have 
many media test cases, though, most were for work on the solvers. Media 
in containers make good solver test cases because you have to get all 
the roots right...

Anyway, I'm focused elsewhere at the moment.

Bill P.


Post a reply to this message

From: Alain Martel
Subject: Re: Strange media artefact
Date: 11 Feb 2021 10:59:04
Message: <60255448$1@news.povray.org>
Le 2021-02-08 à 14:38, Bald Eagle a écrit :
> 
> 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.
> 
> (Alain, fyi:  the syntax is simply "method 3", not "sampling_method 3")
> 
> 
> #version 3.8;
> global_settings {assumed_gamma 1.0 }
> 
> camera {
>   location <0, 8, -10>
>   //location <0, 10, 3>
>   right x*image_width/image_height
>   up y
>   look_at <0, 0, 0>
> }
> 
> light_source {<0, 50, -1> rgb 1}
> 
> sky_sphere {pigment {rgb <1, 1, 1>}}
> 
> 
> box {<-10, -1, -5>, <10, 1, 5>
>   pigment {rgbt 1}
>   hollow
>   interior {
>    media {
>     absorption <1, 1, 1>
>     //emission <1, 0.2, -0.6>*0.9
>     //scattering{ 1, <1,1,1>
>     //extinction  2.0
>     method 3
>     intervals 1 //DO NOT increase !
>     samples 10, 50
>     density {
>      gradient x
>      color_map {
>       [0.0 rgb 0.0]//border
>       //[0.5 rgb 0.1]
>       [1.0 rgb 1.0]//center
>      } // end color_map
>     } // end density
>    } // end media
>   } // end interior
> 
> } // end box
> 
> 

It's a case of not enough samples. In my test, I needed to increase all 
the way to samples 50 to completely get rid of those lines.

In this case, you don't need the color_map as it exactly match what the 
gradient pattern already give you.

Instead of using a sky_sphere with a solid pigment, you should use 
background{ rgb 1}. A sky_sphere is for when you want a pattern as your 
background.

With the current background and media type, you don't need any light.


Post a reply to this message

From: Alain Martel
Subject: Re: Strange media artefact
Date: 11 Feb 2021 11:03:35
Message: <60255557$1@news.povray.org>
Le 2021-02-10 à 02:39, Thomas de Groot a écrit :

> I have one question about them: can samples still be used with two 
> parameters with method 3? The Wiki is confusing about this, and I 
> wondered if it was a legacy from method 1 or 2, but not necessary anymore.
> 

You can use two parameters for samples with method 3, but the second 
will just get silently ignored.
Yes, it's a legacy from method 1 and 2.


Post a reply to this message

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