|
|
Tor Olav Kristensen wrote:
>Alex,
>
>What slows down evaluation of a user defined function is how
>many operators and function calls it contains.
>
>When the parser has expanded your macros, your function will
>look somewhat like I have shown below.
>
>This function now contains calls to 103 internal operators/
>functions; +, -, *, /, cos(), sin(), pow(), sqrt() and 13 calls
>to a user defined function; radialf().
>
>The function is now compiled into code that POV-Ray uses
>while redering your isosurface.
>
>The function(s) I wrote has 35 calls to internal operators/
>functions; +, -, *, /, cos(), sin(), atan2(), internal() and
>7 calls to user defined functions; f_r(), f_sphere(),
>TempFn0(), TempFn1(), TempFn2().
>
>(You can find references to the internal() functions in
>"functions.inc")
>
>
>POV-Ray lacks the possility to use local variables within
>user defined functions.
>
>I have found a way to get aroud this limitation:
>By using nested function calls to pass (by parameters) "pre-
>calculated" values to other user defined functions, so that
>they don't have to repeat the calculations.
>
>If you look into the source code for the images at the
>povray page on my web-site, you can find more examples on how
>to apply this technique. Its' here:
>
>http://home.no/t-o-k/povray
I will visit your web-site.
>
>Another thing that increased the rendering speed was to
>"crimp" the bounding box of your isosurface.
>
>
>I hope this helped you a little.
>
>
>Tor Olav
Thank you very much! This will help me much.
>
>// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
>// You function as it looks when expanded "by hand".
>
> function {
> pow(
> pow(
> (sqrt(x*x + z*z) - 1.5)*sin(radialf(x, y, z)*MPI)
> + y*cos(radialf(x, y, z)*MPI)
> +0.25,
> 2
> )
> +pow(
> (sqrt(x*x + z*z) - 1.5)*cos(radialf(x, y, z)*MPI)
> - y*sin(radialf(x, y, z)*MPI),
> 2
> ),
> 1/64
> )*0.33
> +pow(
> pow(
> (sqrt(x*x + z*z) - 1.5)*sin(radialf(x, y, z)*MPI)
> + y*cos(radialf(x, y, z)*MPI)
> -0.125,
> 2
> )
> +pow(
> (sqrt(x*x + z*z) - 1.5)*cos(radialf(x, y, z)*MPI)
> - y*sin(radialf(x, y, z)*MPI)
> +0.21650635094610966169093079268823,
> 2
> ),
> 1/64
> )*0.33
>
> +pow(
> pow(
> (sqrt(x*x + z*z) - 1.5)*sin(radialf(x, y, z)*MPI)
> + y*cos(radialf(x, y, z)*MPI)
> -0.125,
> 2
> )
> +pow(
> (sqrt(x*x + z*z) - 1.5)*cos(radialf(x, y, z)*MPI)
> - y*sin(radialf(x, y, z)*MPI)
> -0.21650635094610966169093079268823,
> 2
> ),
> 1/64
> )*0.33
> -0.945
> +sin(radialf(x, y, z)*10*pi)*0.01
> }
>
>// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
>
Yes, this looks not quick to calculate.
Sincerely Yours, Alex Kluchikov.
Post a reply to this message
|
|