





 
 




 
 


>
>Alex, if you write the code for your isosurface
>like I have done below, then the image will
>render much faster.
>
>(On my Athlon XP2400+ PC a 512x384 AA0.3 render
>now takes 3m08s, while it earlier took 16m20s.)
>
>Btw.:
>Thank you for showing how you created the texture
>and "environment sphere" for your "cuboids" image
>in p.b.i.
>
You are welcome :)
>
>Tor Olav
>
>
>// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
>
>#include "functions.inc" // For f_r() and f_sphere()
> ................
>
>// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
>
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...
Sincerely Yours, Alex Kluchikov.
Post a reply to this message


 
 


From: Dave Matthews
Subject: Re: My favourite isosurface (see p.b.i. for image)
Date: 20 Nov 2003 09:01:37
Message: <3fbcc941@news.povray.org>



 
 


Tor Olav Kristensen wrote:
> "Dave Matthews" <dma### [at] wrmnwestmnscuedu> wrote in
> news:web.3fbbf51fd6b87b528062416c0@news.povray.org:
>
>
>>Alex Kluchikov wrote:
>>
>>>0.21650635094610966169093079268823
>>
>>Now you've got me curious. What's the significance of
>>"0.21650635094610966169093079268823" ?
>>
>>Dave Matthews
>>
>>
>
>
> 0.25*sin(radians(120)) = 0.21650635094610966169093079268823...
> 0.25*cos(radians(120)) = 0.125
>
>
> Tor Olav
Thank you. That makes sense.
Post a reply to this message


 
 


From: Anonymous
Subject: Re: My favourite isosurface (see p.b.i. for image)
Date: 20 Nov 2003 15:52:13
Message: <3fbd297d$1@news.povray.org>



 
 


"Tor Olav Kristensen" <tor_olav_kCURLYAhotmail.com> wrote
How about modulating the isovalue so the arms are thicker and the blobs
thinner?
[...]
#declare TempFn1 =
function(XZ, YY, Cos, Sin, RF) {
0.330*TempFn0(+XZ*Cos +YY*Sin, XZ*Sin +YY*Cos)
+0.010*sin(RF)
}
#declare TempFn2 =
function(XZ, YY, Phi) {
TempFn1(XZ, YY, cos(Phi*M1), sin(Phi*M1),
Phi*M2)0.945*(1+sin(Phi*M2)/150)
}
[...]
Post a reply to this message


 
 


From: Dennis Miller
Subject: Re: My favourite isosurface (see p.b.i. for image)
Date: 20 Nov 2003 17:51:49
Message: <3fbd4585$1@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.
"Tor Olav Kristensen" <tor_olav_kCURLYAhotmail.com> wrote in message
news:3fbc3970@news.povray.org...
> "Alex Kluchikov" <klk### [at] ukrnet> wrote in
> news:web.3fbbe555cd7b5c811235fd70@news.povray.org:
>
> >
> > Here is the source.
> ...
>
> Alex, if you write the code for your isosurface
> like I have done below, then the image will
> render much faster.
>
> (On my Athlon XP2400+ PC a 512x384 AA0.3 render
> now takes 3m08s, while it earlier took 16m20s.)
>
> Btw.:
> Thank you for showing how you created the texture
> and "environment sphere" for your "cuboids" image
> in p.b.i.
>
>
> Tor Olav
>
>
> // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
>
> #include "functions.inc" // For f_r() and f_sphere()
>
> #declare TwoPi = 2*pi;
> #declare TT = 8; // Number of "Turns"
> #declare M1 = TT/3;
> #declare M2 = 5; // Number of "Blobs"
>
> #declare Rmaj = 1.50;
> #declare Rmin = 0.25;
>
> #declare dAngle = TwoPi/3;
>
> #declare a0 = Rmin*cos(0*dAngle);
> #declare b0 = Rmin*sin(0*dAngle);
>
> #declare a1 = Rmin*cos(1*dAngle);
> #declare b1 = Rmin*sin(1*dAngle);
>
> #declare a2 = Rmin*cos(2*dAngle);
> #declare b2 = Rmin*sin(2*dAngle);
>
> #declare TempFn0 =
> function(A, B) {
> pow(f_r(A + a0, 0, B + b0), 1/32)
> +pow(f_r(A + a1, 0, B + b1), 1/32)
> +pow(f_r(A + a2, 0, B + b2), 1/32)
> }
>
> #declare TempFn1 =
> function(XZ, YY, Cos, Sin, RF) {
> 0.330*TempFn0(+XZ*Cos +YY*Sin, XZ*Sin +YY*Cos)
> +0.010*sin(RF)
> 0.945
> }
>
> #declare TempFn2 =
> function(XZ, YY, Phi) {
> TempFn1(XZ, YY, cos(Phi*M1), sin(Phi*M1), Phi*M2)
> }
>
> #declare Heart =
> isosurface {
> function { TempFn2(f_sphere(x, 0, z, Rmaj), y, 90  atan2(x, z)) }
> accuracy 2E4
> max_gradient 0.75
> contained_by {
> box {
> <Rmaj + Rmin, Rmin, Rmaj + Rmin>  <1, 1, 1>*0.12,
> <Rmaj + Rmin, Rmin, Rmaj + Rmin> + <1, 1, 1>*0.12
> }
> }
> }
>
> // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
Post a reply to this message


 
 


From: Andrew
Subject: Re: My favourite isosurface (see p.b.i. for image)
Date: 20 Nov 2003 19:04:00
Message: <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: 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


 
 




 

