POV-Ray : Newsgroups : povray.binaries.images : A doodle and ramblings on pattern{} and iso perturbation : Re: A doodle and ramblings on pattern{} and iso perturbation Server Time
7 Jun 2025 21:02:49 EDT (-0400)
  Re: A doodle and ramblings on pattern{} and iso perturbation  
From: Kenneth
Date: 4 Jun 2025 07:25:00
Message: <web.684029a98b738c14e83955656e066e29@news.povray.org>
[Running v3.8 beta 1 in Windows]

I simplified your 'FnTorusWarp' function to be just a basic torus, so that I
could run it for experimenting.

I am seeing some odd isosurface behavior when the torus function is turned into
a pattern (regardless of the additional warp.)  It seems that the contained_by
object-- a sphere for example-- cannot be larger than a radius of 1.0.
Otherwise, an inverted(?) version  of the torus begins to appear, outside of the
initial object. And POV-ray actually crashed several times which is difficult to
reproduce, depending on... ?

An isosurface made from  POV-ray's basic torus function itself does not produce
these anomalies.

(As an experiment, I substituted a different basic function shape for the torus,
using f_comma instead, just to see if this behavior still occurs. It does.)

With the torus pattern, an interplay of various values causes the 'outside
parts' to appear: It depends on the major and minor radii values (and the ratio
between the two), and *especially* the isosurface contained_by size. And when
the odd parts begin to come in, the isosurface's required max_gradient wildly
increases. (Although, adding triangle_wave to the function pattern *greatly*
reduces this-- from 2000 down to 2!-- which seems to produce a similar effect to
your 'raw' wave type. A nice discovery!)

I tried various ways of re-writing my isosurface code block to eliminate the
'extra parts', but without success: negating the function; subtracting the
function from 1.0; negating the threshold value; using 'open';  using v3.8's
'polarity' keyword.

Do you have an idea as to what causes this function-to-pattern behavior?
-----------------
BTW: For the pattern use, the iso threshold value is a tricky one. It cannot be
zero (as far as I can tell), but increasing it increases the torus's minor
radius without affecting the major radius. So it does not seem possible to get
an exact-size torus that matches the given minor radius.

-----------------
My simplified test code. The two examples use the same torus size and
contained_by size (the latter of which is purposely bad for the
torus-as-pattern).

#include "functions.inc";

// 1)  torus function as pattern function:
#declare FnTorusWarp = function {
     pattern {
         function {f_torus(x,y,z,0.5,0.1)}
                    }
             // triangle_wave
}

isosurface{
     function{FnTorusWarp(x,y,z)}
     threshold .01 // This is a tricky value:
     accuracy .001
     max_gradient 2000
     //polarity on

     // The contained_by shape cannot go beyond a critical size, otherwise extra
     // parts appear. Reduce to 0.9 to get a clean torus-- which also results in
     // a *much*-reduced max_gradient.
     contained_by{sphere{0,1.4}}
     // OR...
     //contained_by{box{-1.4,1.4}}

     //open
 }

// 2)  a basic torus, no pattern use:

isosurface{
 function{f_torus(x,y,z,0.5,0.1)}
 threshold 0
 accuracy .001
 max_gradient 2
 contained_by{sphere{0,1.4}}
 }


Post a reply to this message


Attachments:
Download 'function_vs_pattern_function_1_kw.jpg' (42 KB)

Preview of image 'function_vs_pattern_function_1_kw.jpg'
function_vs_pattern_function_1_kw.jpg


 

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