POV-Ray : Newsgroups : povray.beta-test : Function context issue. : Re: Function context issue. Server Time
4 Nov 2024 21:20:29 EST (-0500)
  Re: Function context issue.  
From: Batronyx
Date: 21 Sep 2001 09:45:33
Message: <3bab447d$1@news.povray.org>
"Mike Williams" <mik### [at] nospamplease> wrote in message
news:tPq### [at] econymdemoncouk...
> Wasn't it Batronyx who wrote:
> >Please see my previous post "Problem in pigment_pattern
> >with bozo/f_noise3d:" for a set of code illustrating
> >this issue.
> >
> I think that there may well be a syntax that does this explicitly, but
> you can only use it where it is allowed, and it doesn't happen to be
> currently allowed after "diffuse". If it were allowed it would look like
> this
>   finish {diffuse function{F(x,y,z)}}
> rather than
>   finish {diffuse F(x,y,z)}
>
> It looks to me that if you use a function without outside a "function{}"
> envelope, then it gets evaluated at parse time. e.g.
>      pigment {rgb Fn_AmbMap(1,1,1)}

I hadn't considered this possibility.

>
> >Without this explicit mechanism, the function is fully evaluated at
> >parse time and if called during render time by the pseudo-code engine
> >redundantly returns the same value at each call. It is unnecessary
> >overhead then, since, ( as I understand it ) with respect to functions the
only
> >thing to change during the render are the vector coordinates of the current
> >point under evaluation. A macro or something would be more
> >appropriate here if only to save render overhead.
>
> I understood that functions were faster than macros.

If the absence of the "function{}" envelope precludes a call to the function
at render time, then you are very likely correct about the speed.

Drat! Well, the clarity is worth something at least :)


--
Batronyx ^"^
bat### [at] cadronhsacom
http://www.batronyx.com


Post a reply to this message

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