POV-Ray : Newsgroups : povray.general : Isosurfaces Server Time
26 Dec 2024 13:41:56 EST (-0500)
  Isosurfaces (Message 1 to 4 of 4)  
From: Ger
Subject: Isosurfaces
Date: 15 Feb 2006 09:40:58
Message: <43f33d7a@news.povray.org>
After reading the sections about isosurfaces I figured I'd have a go at it.

This is my first try at isosurfaces so most likely I'm doing something
utterly stupid.

I wanted to create a tileroof and came up with this

// creates a wavy shape along the x-axis
#declare X_Wave = function { abs(sin(x*2.5)/4) }
// creates a step shape along the z-axis
#declare Z_Step = function { (z-int(z))*0.3}

isosurface {
        function {y+(X_Wave(x,y,z)+Z_Step(x,y,z))}
        contained_by { box { <-2,-1,0>,< 2,0.55,10> } }
        pigment { red 0.6 }
        scale 5
        translate < 30,5,0>
}

The X_Wave function works as I expected but the Z_Step doesn't. It does not
produce a clean step pattern that I expected.

What am I overlooking/doing wrong ?

PS. The last time I ever looked at anything math-like was 40 years ago :)
-- 
Ger


Post a reply to this message

From: Mike Williams
Subject: Re: Isosurfaces
Date: 15 Feb 2006 10:36:32
Message: <oj9ZHCA5p08DFwwn@econym.demon.co.uk>
Wasn't it Ger who wrote:
>After reading the sections about isosurfaces I figured I'd have a go at it.
>
>This is my first try at isosurfaces so most likely I'm doing something
>utterly stupid.
>
>I wanted to create a tileroof and came up with this
>
>// creates a wavy shape along the x-axis
>#declare X_Wave = function { abs(sin(x*2.5)/4) }
>// creates a step shape along the z-axis
>#declare Z_Step = function { (z-int(z))*0.3}
>
>isosurface {
>        function {y+(X_Wave(x,y,z)+Z_Step(x,y,z))}
>        contained_by { box { <-2,-1,0>,< 2,0.55,10> } }
>        pigment { red 0.6 }
>        scale 5
>        translate < 30,5,0>
>}
>
>The X_Wave function works as I expected but the Z_Step doesn't. It does not
>produce a clean step pattern that I expected.
>
>What am I overlooking/doing wrong ?
>
>PS. The last time I ever looked at anything math-like was 40 years ago :)

The problem with the Z_Step function is that there are points where the
gradient is infinite. Since you're not setting max_gradient, POV is
using the default value of 1, and you get this warning in the message
pane:

Warning: The maximum gradient found was 3000.891, but max_gradient of
the isosurface was set to 1.100. The isosurface may contain holes!
Adjust max_gradient to get a proper rendering of the isosurface.

The "3000.891" value is just what POV happened to find on that run. If
you were to increase the max_gradient to that value, it would take an
awfully long time to render and still suggest a higher value.

Isosurfaces that have discontinuous functions will never render well.

You might try this, which creates each slice of roof as a separate
object and then places several of them side by side:

// creates a wavy shape along the x-axis
#declare X_Wave = function { abs(sin(x*2.5)/4) }
// creates a step shape along the z-axis
#declare Z_Step = function { z*0.3}

#declare Slice =
isosurface {
        function {y+(X_Wave(x,y,z)+Z_Step(x,y,z))}
        max_gradient 1
        contained_by { box { <-2,-1,0>,< 2,0.55,1> } }
        pigment { red 0.6 }
        translate < 30,5,0>
        scale 5
}

#declare n=0;
#while (n<10)
  object {Slice translate z*n*5}
  #declare n=n+1;
#end 


-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Ger
Subject: Re: Isosurfaces
Date: 15 Feb 2006 11:31:19
Message: <43f35757@news.povray.org>
Mike Williams wrote:

> 
> The problem with the Z_Step function is that there are points where the
> gradient is infinite. Since you're not setting max_gradient, POV is
> using the default value of 1, and you get this warning in the message
> pane:
> 
> Warning: The maximum gradient found was 3000.891, but max_gradient of
> the isosurface was set to 1.100. The isosurface may contain holes!
> Adjust max_gradient to get a proper rendering of the isosurface.
> 
> The "3000.891" value is just what POV happened to find on that run. If
> you were to increase the max_gradient to that value, it would take an
> awfully long time to render and still suggest a higher value.
> 
I tried setting it at 1000 but that sorta stopped povray dead in it's tracks

> Isosurfaces that have discontinuous functions will never render well.

I don't see the "discontinous" in the function because for every value of z
there is a determined value of y. But like I said, the last time I saw math
was 40+ years ago.

> 
> You might try this, which creates each slice of roof as a separate
> object and then places several of them side by side:
> 
> // creates a wavy shape along the x-axis
> #declare X_Wave = function { abs(sin(x*2.5)/4) }
> // creates a step shape along the z-axis
> #declare Z_Step = function { z*0.3}
> 
> #declare Slice =
> isosurface {
>         function {y+(X_Wave(x,y,z)+Z_Step(x,y,z))}
>         max_gradient 1
>         contained_by { box { <-2,-1,0>,< 2,0.55,1> } }
>         pigment { red 0.6 }
>         translate < 30,5,0>
>         scale 5
> }
> 
> #declare n=0;
> #while (n<10)
>   object {Slice translate z*n*5}
>   #declare n=n+1;
> #end
> 
> 

Thanks Mike, it works as I hoped it would come out.
Goes to show I should read up on math :)

-- 
Ger


Post a reply to this message

From: Mike Williams
Subject: Re: Isosurfaces
Date: 15 Feb 2006 14:28:58
Message: <B$vTgKAwC48DFwUA@econym.demon.co.uk>
Wasn't it Ger who wrote:
>Mike Williams wrote:
>
>> 
>> The problem with the Z_Step function is that there are points where the
>> gradient is infinite. Since you're not setting max_gradient, POV is
>> using the default value of 1, and you get this warning in the message
>> pane:
>> 
>> Warning: The maximum gradient found was 3000.891, but max_gradient of
>> the isosurface was set to 1.100. The isosurface may contain holes!
>> Adjust max_gradient to get a proper rendering of the isosurface.
>> 
>> The "3000.891" value is just what POV happened to find on that run. If
>> you were to increase the max_gradient to that value, it would take an
>> awfully long time to render and still suggest a higher value.
>> 
>I tried setting it at 1000 but that sorta stopped povray dead in it's tracks
>
>> Isosurfaces that have discontinuous functions will never render well.
>
>I don't see the "discontinous" in the function because for every value of z
>there is a determined value of y. But like I said, the last time I saw math
>was 40+ years ago.

That just makes it "defined" everywhere. It's not "continuous" at
integer values of z because if you approach an integer value from below
you get a different limiting value than if you approach the same point
from above.

As far as POV is concerned it's the infinite value of the gradient at
that point that's the problem. If POV finds a point where the function
value evaluates to "F", then it knows that the function can't be zero
within a distance of F/max_gradient from that point, and can therefore
miss points.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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