POV-Ray : Newsgroups : povray.bugreports : "mandel" as function in isosurface has unexpected results Server Time
21 Dec 2024 09:34:04 EST (-0500)
  "mandel" as function in isosurface has unexpected results (Message 1 to 7 of 7)  
From: Lars Rohwedder
Subject: "mandel" as function in isosurface has unexpected results
Date: 15 Dec 2022 07:54:42
Message: <639b1912@news.povray.org>
I'd expected that the areas "far outside" of the Mandelbrot set (outside 
of the red cylinder) would have "low" values, so they are far "outside" 
of the isosurface. But they aren't, so the result is that the whole 
contained_by box is filled.

Is it a bug how mandel pattern & isosurface work together or is the bug 
in my scene file? :-/

Lars R.


Post a reply to this message


Attachments:
Download 'mandel.pov.txt' (2 KB) Download 'mandel.png' (171 KB)

Preview of image 'mandel.png'
mandel.png


 

From: Bald Eagle
Subject: Re: "mandel" as function in isosurface has unexpected results
Date: 15 Dec 2022 13:40:00
Message: <web.639b6923c22c158f1f9dae3025979125@news.povray.org>
Lars Rohwedder <rok### [at] gmxde> wrote:
> I'd expected that the areas "far outside" of the Mandelbrot set (outside
> of the red cylinder) would have "low" values, so they are far "outside"
> of the isosurface. But they aren't, so the result is that the whole
> contained_by box is filled.
>
> Is it a bug how mandel pattern & isosurface work together or is the bug
> in my scene file? :-/
>
> Lars R.

It looks like the pattern drops off to zero.

Maybe try adding "open" to your isosurface statement.


https://wiki.povray.org/content/Reference:Isosurface

"When the isosurface is not fully contained within the contained_by object,
there will be a cross section. When this happens, you will see the surface of
the container. Using the open keyword, these cross section surfaces are removed,
and the inside of the isosurface becomes visible.

Note: Using open slows down the render speed, and it is not recommended for use
with CSG operations."


Might have to add "all_intersections" as well, if things still don't look good.
(just guessing)

Here's the pattern with 1000 iterations on an xy plane.


Post a reply to this message


Attachments:
Download 'mandeltest.png' (29 KB)

Preview of image 'mandeltest.png'
mandeltest.png


 

From: Lars Rohwedder
Subject: Re: "mandel" as function in isosurface has unexpected results
Date: 15 Dec 2022 14:30:33
Message: <639b75d9@news.povray.org>
Am 15.12.22 um 19:36 schrieb Bald Eagle:
> Lars Rohwedder <rok### [at] gmxde> wrote:
>> I'd expected that the areas "far outside" of the Mandelbrot set (outside
>> of the red cylinder) would have "low" values, so they are far "outside"
>> of the isosurface. But they aren't, so the result is that the whole
>> contained_by box is filled.
>>
>> Is it a bug how mandel pattern & isosurface work together or is the bug
>> in my scene file? :-/
>>
>> Lars R.
> 
> It looks like the pattern drops off to zero.

Correct.

According to the documentation of isosurface, all points with function 
value  < threshold are "inside" the isosurface object.

The "mandel" pattern is "low" (near zero) far away from the Mandelbrot 
set, increases slowly near the border of the set and is 1 inside the 
"apple shape" set itself (with default values for "interior" and "exterior".

So I had expected that a formula like 0.9 - mandel would give the 
desired result:

   * the points inside the Mandelbrot set will be <0, so are consideded 
as "inside" the rendered shape.
   * the points far away of the Mandelbrot set will be >0, so are 
"outside" of the rendered shape.

But the rendering looks completely different than expected, see attached 
mandel-0.9.png

Changing the formula to 0.5-mandel2(x,y,z) it looks much more than a 
Mandelbrot set, but it is "inverse": the Mandelbrot set is "outside", 
the surrounding areay is inside. Hence I switched the sign, so the 
forumla becomes mandel(x,y,z)-0.5.

So the inside of the Mandelbrot set becomes the inside of the 
isosurface, as expected, but also the far away areas are "inside", which 
is _not_ what I expected.

What went wrong here?

Lars R.

pS: The "open" keyword just removes the visibility of the contained_by 
object, but I consider it helpful to see what is insided and what it is 
outside of the isosurface object.


Post a reply to this message


Attachments:
Download 'mandel-0.5.png' (25 KB) Download 'mandel-0.9.png' (20 KB)

Preview of image 'mandel-0.5.png'
mandel-0.5.png

Preview of image 'mandel-0.9.png'
mandel-0.9.png


 

From: Bald Eagle
Subject: Re: "mandel" as function in isosurface has unexpected results
Date: 15 Dec 2022 20:35:00
Message: <web.639bca58c22c158f1f9dae3025979125@news.povray.org>
Lars Rohwedder <rok### [at] gmxde> wrote:

> According to the documentation of isosurface, all points with function
> value  < threshold are "inside" the isosurface object.

Wellll...... it's an isoSURFACE, so there really is no inside, unless (IIRC) for
csg you use all_intesections

> The "mandel" pattern is "low" (near zero) far away from the Mandelbrot
> set, increases slowly near the border of the set and is 1 inside the
> "apple shape" set itself (with default values for "interior" and "exterior".

Can you cite that with a link, or is that your working hypothesis?


> So I had expected that a formula like 0.9 - mandel would give the

> What went wrong here?

Part of what's going wrong is that mandel is a POV-Ray pattern that has a built
in color map.   And that wreaks hell with everything right from the beginning.

I'd say try using:

#declare Mandel = function { pigment {mandel 1000 exterior 1, 1 color_map {[0
rgb 0] [1 rgb 1]}}}

But you're having more success than I am.

Maybe you post your full scene as an attachment, and someone can figure this
out.   All I'm getting right now is a hard-to-visualize infinitely thin layer.

You can try z-mandel.red or mandel (x, y, 0), or any of the other usual tricks.

- BW


Post a reply to this message

From: Lars Rohwedder
Subject: [solved] "mandel" as function in isosurface has unexpected results
Date: 16 Dec 2022 02:27:29
Message: <639c1de1@news.povray.org>
>> According to the documentation of isosurface, all points with
>> function value  < threshold are "inside" the isosurface object.
> 
> Wellll...... it's an isoSURFACE, so there really is no inside, unless
> (IIRC) for csg you use all_intesections
> 
>> The "mandel" pattern is "low" (near zero) far away from the
>> Mandelbrot set, increases slowly near the border of the set and is
>> 1 inside the "apple shape" set itself (with default values for
>> "interior" and "exterior".
> 
> Can you cite that with a link, or is that your working hypothesis?

https://www.povray.org/documentation/view/3.6.1/377/

See the explanations for "interior" and "exterior" types 0 and 1.
A default color map is not mentioned there at all, hence I did not know
about that. :-/


>> So I had expected that a formula like 0.9 - mandel would give the
> 
>> What went wrong here?
> 
> Part of what's going wrong is that mandel is a POV-Ray pattern that
> has a built in color map.   And that wreaks hell with everything
> right from the beginning.

I see. It should be mentioned in the documentation of the mandel
pattern. :-/

> I'd say try using:
> 
> #declare Mandel = function { pigment {mandel 1000 exterior 1, 1
> color_map {[0 rgb 0] [1 rgb 1]}}}
> 
> But you're having more success than I am.

Thank you a lot! Changing the color map into a stupid black-to-white
ramp solves the problem.

See attached .pov files and renderings.

> Maybe you post your full scene as an attachment, and someone can
> figure this out.

I did it in my original posting.

Thanks again and enjoy the renderings (or use them as inspirations for
own "weird christmas tree" ideas. ;-)

Lars R.


Post a reply to this message


Attachments:
Download 'mandel.pov.txt' (2 KB) Download 'mandel.png' (145 KB) Download 'mandel2.pov.txt' (2 KB) Download 'mandel2.png' (201 KB)

Preview of image 'mandel.png'
mandel.png

Preview of image 'mandel2.png'
mandel2.png


 

From: Bald Eagle
Subject: Re: [solved] "mandel" as function in isosurface has unexpected results
Date: 16 Dec 2022 06:30:00
Message: <web.639c55c566261a191f9dae3025979125@news.povray.org>
Lars Rohwedder <rok### [at] gmxde> wrote:

> > Can you cite that with a link, or is that your working hypothesis?
>
> https://www.povray.org/documentation/view/3.6.1/377/
>
> See the explanations for "interior" and "exterior" types 0 and 1.

Yeah, I did.  Just did again.
The way it's written still doesn't make it any clearer to me.  ;)  :/

> A default color map is not mentioned there at all, hence I did not know
> about that. :-/

Right, we've come across that here and there, and I only really caught on when I
was plotting the function values and using the result as a pigment as well.   My
first post should have been enough to make that clear to me, but ....  density.

Wholeheartedly agree that the default internal color map ought to be explicitly
mentioned if not listed and explained in detail.



> Thank you a lot! Changing the color map into a stupid black-to-white
> ramp solves the problem.
>
> See attached .pov files and renderings.
>
> > Maybe you post your full scene as an attachment, and someone can
> > figure this out.
>
> I did it in my original posting.

Right-o.   It was a night-time last ditch effort, and I was just going off the
last post.  The first post rolled off my stack.

I'm glad it has worked out for you   :)


Just a thought - given the fractal nature, and the high function gradient -
maybe this approach will give you a smoother result?

https://www.mitchr.me/SS/mandelbrot/index.html


All the best,

BW


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: "mandel" as function in isosurface has unexpected results
Date: 20 Dec 2022 09:35:00
Message: <web.63a1c7d9c22c158f80a206e289db30a9@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> Lars Rohwedder <rok### [at] gmxde> wrote:
>...

> > So I had expected that a formula like 0.9 - mandel would give the
>
> > What went wrong here?
>
> Part of what's going wrong is that mandel is a POV-Ray pattern that has a built
> in color map.   And that wreaks hell with everything right from the beginning.
>
> I'd say try using:
>
> #declare Mandel = function { pigment {mandel 1000 exterior 1, 1 color_map {[0
> rgb 0] [1 rgb 1]}}}
>...

Hi Bill and Lars

AFAIK, patterns can not have built in color maps, while pigments can.
So here I would rater suggest a pattern function instead of a pigment function:

#declare MandelbrotFn =
    function {
        pattern {
            mandel 1000
            exterior 1, 1
        }
    }
;

Pattern functions do not return colors as pigment functions do, but float values
between 0 and 1.

Patterns and pattern functions (and other functions returning floats) can be
used to select colors from color maps in pigments, e.g. like this:

    plane {
        +z, 0
        pigment {
            mandel 1000
            color_map {
                [ 0.0 color rgb <0, 0, 0> ]
                [ 0.2 color rgb <1, 0, 0> ]
                [ 0.4 color rgb <1, 1, 0> ]
                [ 1.0 color rgb <1, 1, 1> ]
                [ 1.0 color rgb <0, 0, 0> ]
            }
        }
    }

- or like this:

    #declare MandelFn = function { pattern { mandel 1000 } };

    plane {
        +z, 0
        pigment {
            function { MandelFn(x, y, z) }
            color_map {
                [ 0.0 color rgb <0, 0, 0> ]
                [ 0.2 color rgb <1, 0, 0> ]
                [ 0.4 color rgb <1, 1, 0> ]
                [ 1.0 color rgb <1, 1, 1> ]
                [ 1.0 color rgb <0, 0, 0> ]
            }
        }
    }

--
Tor Olav
http://subcube.com
https://github.com/t-o-k


Post a reply to this message

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