POV-Ray : Newsgroups : povray.unofficial.patches : Some more iso/function questions Server Time
1 Sep 2024 18:15:42 EDT (-0400)
  Some more iso/function questions (Message 1 to 6 of 6)  
From: Ken Cecka
Subject: Some more iso/function questions
Date: 15 Nov 2000 00:23:36
Message: <3a121dd8@news.povray.org>
Hi all,

I've been making progress w/ isosurfaces, but am finding myself totally 
befuddled when it comes to combining multiple functions.  Here's a simple 
(albeit useless) example which I would expect to work (but doesn't):

#declare fn_x = function {x}
#declare fn_y = function {y}
#declare fn_z = function {z}
#declare fn_sphere = function {fn_x^2 + fn_y^2 + fn_z^2 - 1}
isosurface {
  function {fn_sphere}
  threshold 0
  contained_by {box {<-5,-5,-5>,<5,5,5>}}
  pigment {Red}
}

This ought to yeild a sphere of radius one, but gives me nothing.  What 
adds to my confusion is that this type of function composition seems to 
work fine for functions used in for pigments rather than iso's.  Am I 
missing something obvious?  I've dones some experimenting, and using the 
fn_* functions do impact the final surface, but in different ways than if I 
used the vanilla x/y/z.  My goal in this is to be able to easily wrap a 
surface around a different (non-cartesian) coordinate system by 
substituting the coordinate translations for x/y/z.  I can do this 
manually, but it is a maintenance headache and makes for really ugly 
functions.

Thanks,
Ken


Post a reply to this message

From: Christoph Hormann
Subject: Re: Some more iso/function questions
Date: 15 Nov 2000 03:28:44
Message: <3A12493C.DAB030C3@schunter.etc.tu-bs.de>
Ken Cecka wrote:
> 
> Hi all,
> 
> I've been making progress w/ isosurfaces, but am finding myself totally
> befuddled when it comes to combining multiple functions.  Here's a simple
> (albeit useless) example which I would expect to work (but doesn't):
> [...]

Although your sample seems not very efficient, it should work quite ok,
just use:

  method 1

or

  eval

or
  max_gradient 20

as additional parameter in the isosurface.

By default megapov uses method 2 for predeclared functions and default
max_gradient is 1 while 'eval' reveals max_gradient above 13 for your
function.  For a simple geometric shape like yours 'method 1' is better
anyway.

Christoph 

-- 
Christoph Hormann <chr### [at] gmxde>
Homepage: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

From: Jérôme M  Berger
Subject: Vanishing iso (was: Some more iso/function questions)
Date: 15 Nov 2000 04:22:04
Message: <3A1255BB.EF50A202@tapasmail.net>
Ken Cecka wrote:
> 
> ...
> This ought to yeild a sphere of radius one, but gives me nothing.
	I just had a similar problem: I was trying to make a rounded box and
used:
isosurface {
  function { "rounded_box", <0.5> }
  contained_by { box { -<1, 1, 1>, <1, 1, 1> } }
}

	Then I rendered it with +D +SP4. During the two preview passes, my
rounded box was visible, but it vanished on the final pass! I then tried
to declare the function:
#declare Func = function { "rounded_box", <0.5, 1, 1, 1> }
isosurface {
  function { F }
  contained_by { box { -<1, 1, 1>, <1, 1, 1> } }
}

	An got the same result. Finally I used:
#declare Func = function { "rounded_box", <0.5, 1, 1, 1> }
isosurface {
  function { F (x, y, z) }
  contained_by { box { -<1, 1, 1>, <1, 1, 1> } }
}

	And it worked. (I had already noticed before that simply adding noise3d
to a function caused problems while adding noise3d(x,y,z) worked as
expected).

	To conclude:
* for your problem, try adding explicit arguments to your functions;
* this looks a lot like a bug. Maybe somebody who understands the code
for isosurfaces and functions (I tried to look at it, but didn't have
the time to understand exactly how it works) should look at it a little
more closely...


-- 

* Abandon the search for truth, * mailto:ber### [at] inamecom
* Settle for a good fantasy.    * http://www.enst.fr/~jberger
*********************************


Post a reply to this message

From: Chris Huff
Subject: Re: Some more iso/function questions
Date: 15 Nov 2000 05:30:33
Message: <chrishuff-B15F25.05304615112000@news.povray.org>
In article <3a121dd8@news.povray.org>, Ken Cecka <cec### [at] homecom> 
wrote:

> #declare fn_x = function {x}
> #declare fn_y = function {y}
> #declare fn_z = function {z}

Maybe a problem with single-token functions...try using "0+x", "1*y", 
etc...seems unlikely, though.


> #declare fn_sphere = function {fn_x^2 + fn_y^2 + fn_z^2 - 1}

And always use the parameter list. Two reasons: when you can't see their 
declarations, fn_x, fn_y, and fn_z look like constants, not functions, 
and function calls don't always work properly without them.
#declare fn_sphere =
function {fn_x(x,y,z)^2 + fn_y(x,y,z)^2 + fn_z(x,y,z)^2 - 1}

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

From: Ken Cecka
Subject: Re: Some more iso/function questions
Date: 15 Nov 2000 10:47:39
Message: <3a12b01b@news.povray.org>
Christoph Hormann wrote:

> Although your sample seems not very efficient, it should work quite ok,
> just use:
> 
>   method 1
> 
> or
> 
>   eval
> 
> or
>   max_gradient 20
> 
> as additional parameter in the isosurface.
> 
> By default megapov uses method 2 for predeclared functions and default
> max_gradient is 1 while 'eval' reveals max_gradient above 13 for your
> function.  For a simple geometric shape like yours 'method 1' is better
> anyway.
> 
> Christoph
> 

Thanks!  I'll have to do some reading up on method, eval, and max_gradient. 
 I tried all three of your suggestions - method and max_gradient 20 fixed 
the problem, but eval did not appear to change anything.  But it looks like 
I'm back in business :)

Ken


Post a reply to this message

From: Tom Melly
Subject: Re: Some more iso/function questions
Date: 23 Nov 2000 12:10:57
Message: <3a1d4fa1$1@news.povray.org>
"Ken Cecka" <cec### [at] homecom> wrote in message
news:3a12b01b@news.povray.org...

>  I tried all three of your suggestions - method and max_gradient 20 fixed
> the problem, but eval did not appear to change anything.  But it looks
like
> I'm back in business :)
>

Well, if nothing else, eval will have returned the actual value for
max_gradient that you need.


Post a reply to this message

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