![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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] gmx de>
Homepage: http://www.schunter.etc.tu-bs.de/~chris/
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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] iname com
* Settle for a good fantasy. * http://www.enst.fr/~jberger
*********************************
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
In article <3a121dd8@news.povray.org>, Ken Cecka <cec### [at] home com>
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] mac com, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tag povray org, http://tag.povray.org/
<><
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Ken Cecka" <cec### [at] home com> 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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |