





 
 


From: Dennis Miller
Subject: Re: My favourite isosurface (see p.b.i. for image)
Date: 20 Nov 2003 20:31:25
Message: <3fbd6aed$1@news.povray.org>



 
 


oops. that would explain it.
sorry.
d.
"Andrew" <ast### [at] hotmailcom> wrote in message
news:3fbd5670@news.povray.org...
> > Tor, I get a completely blank (blue) screen with this (though it
> renders
> > really fast! :). I did copy all the other settings and code from the
> > previous version (camera, sky, etc)...
> >
> > Does it look right to you?
> > D.
>
>
> You have actually placed the object, right? As in:
>
> object {Heart texture {... etc ...}}
>
>
Post a reply to this message


 
 


From: Tor Olav Kristensen
Subject: Re: My favourite isosurface (see p.b.i. for image)
Date: 21 Nov 2003 14:57:40
Message: <3fbe6e34@news.povray.org>



 
 


"Alex Kluchikov" <klk### [at] ukrnet> wrote in
news:web.3fbc5805d6b87b52d68d943d0@news.povray.org:
...
> Thank you. I'll try to write more quick code. But what is the
> difference
> between my and your variants? Why the render time differs so much?
> May be, standard functions (declared in functions.inc) are faster?
>
> I tried to create functions with as little gradient value as
> possible. For
> example, let's take sphere:
>
> function{x*x+y*y+z*z1} has max gradient about 2
> function{pow(x*x+y*y+z*z,1/256)1} has max gradient about .05 or even
> less,
> while looking the same.
>
> And sometimes it helps to speed up rendering. But I can not
> understand, why the code you've post is so much more faster? It seems
> to me, I need some time to think...
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 POVRay 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")
POVRay 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 website, you can find more examples on how
to apply this technique. Its' here:
http://home.no/tok/povray
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
// ===== 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
Post a reply to this message


 
 




 
 


Dennis Miller wrote:
>Great scene!
Thank you.
>Why do you declare fn_X but not use it?
Sorry. This code was born in a long digging and debugging, it was a number
of intermediate variants. I tried to clean it before posting and seem to
miss some unused lines.
Sincerely Yours, Alex Kluchikov.
Post a reply to this message


 
 




 
 


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 POVRay 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")
>
>
>POVRay 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 website, you can find more examples on how
>to apply this technique. Its' here:
>
>http://home.no/tok/povray
I will visit your website.
>
>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


 
 


From: Nicolas Alvarez
Subject: Re: My favourite isosurface (see p.b.i. for image)
Date: 29 May 2004 17:11:07
Message: <40b8fc6b$1@news.povray.org>



 
 


news:web.3fbea207d6b87b522549cb860@news.povray.org...
> Dennis Miller wrote:
> >Great scene!
> Thank you.
> >Why do you declare fn_X but not use it?
> Sorry. This code was born in a long digging and debugging, it was a number
> of intermediate variants. I tried to clean it before posting and seem to
> miss some unused lines.
>
> Sincerely Yours, Alex Kluchikov.
>
>
Yeah, it's difficult to clean a code when you tried 43046721 things to get it
working :)
Post a reply to this message


 
 




 

