POV-Ray : Newsgroups : povray.general : Isosurfaces : Re: Isosurfaces Server Time
1 Aug 2024 06:20:39 EDT (-0400)
  Re: Isosurfaces  
From: Mike Williams
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

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