POV-Ray : Newsgroups : povray.text.scene-files : My favourite isosurface (see p.b.i. for image) Server Time
24 Apr 2024 07:25:22 EDT (-0400)
  My favourite isosurface (see p.b.i. for image) (Message 1 to 10 of 15)  
Goto Latest 10 Messages Next 5 Messages >>>
From: Alex Kluchikov
Subject: My favourite isosurface (see p.b.i. for image)
Date: 19 Nov 2003 16:55:01
Message: <web.3fbbe555cd7b5c811235fd70@news.povray.org>
Here is the source.

//=== Begin

// Alex Kluchikov, 2003
// mailto: klk### [at] ukrnet, akl### [at] mailru
// Feel free to modify/use in any form

sky_sphere{pigment{gradient y color_map{[0,color rgb <0.8,0.83,1>][1,color
rgb <0.4,0.7,1>]}scale 2 translate -y}}
sphere{0,1000 texture{
 pigment{average pigment_map{
 #declare gr=.8;
 #declare ge=3/(1+gr+gr);
 #declare t1=.3;
 #declare t2=.8;
 #declare tr1=.1;
 #declare tr2=.1;
  [1,bozo translate 5*y color_map{
   [t1,color rgbt < 1,gr,gr,tr1>*ge]
   [t2,color rgbt < 0, 0, 0,tr2>*ge]
  }]
  [1,bozo translate 5*z color_map{
   [t1,color rgbt < gr, 1,gr,tr1>*ge]
   [t2,color rgbt <  0, 0, 0,tr2>*ge]
  }]
  [1,bozo translate 5*x color_map{
   [t1,color rgbt < gr,gr, 1,tr1>*ge]
   [t2,color rgbt <  0, 0, 0,tr2>*ge]
  }]

 }}scale 0.25 finish{ambient 1 diffuse 0}scale 3000}no_shadow no_image
 hollow //no_reflection
  double_illuminate scale 100}

#declare st=texture{pigment{color rgb<0.83,0.82,0.84>*1.2}
  finish{diffuse 0.85 ambient 0 specular 0.9 roughness .03 phong 1.0
brilliance 9.3 phong_size 80  metallic .5
   reflection{0.6,1.0 metallic}}
//   normal{bozo .5 scale .002}
  }

#declare area=0;
#declare areacount=2;
#declare areasize=2.5;

light_source{
 -35*z, color rgb <1.0,0.8,0.6>*0.55
#if(area)
 area_light x*areasize,y*areasize,areacount,areacount jitter adaptive 1
circular orient
#else
 parallel
#end
 rotate x*55 rotate -y*45
 }

light_source{
 -35*z, color rgb <0.6,0.8,1>*0.55
#if(area)
 area_light x*areasize,y*areasize,areacount,areacount jitter adaptive 1
circular orient
#else
 parallel
#end
 rotate x*25 rotate y*25
 }

camera{
 location -5*z
 look_at 0
 }

#declare fn_X = function(a,b,c) {
  pow((a*a+(c+0.15)*(c+0.15))*1.5,1/32)
 }

#declare radialf=function{
 pattern{radial}
}

#declare heart=
isosurface{
 function{
 #declare MPI=16*pi/3;
 #macro tx() (sqrt(x*x+z*z)-1.5) #end
 #macro ty() y #end
 #macro ttx() tx()*sin(radialf(x,y,z)*MPI)+ty()*cos(radialf(x,y,z)*MPI) #end
 #macro tty() tx()*cos(radialf(x,y,z)*MPI)-ty()*sin(radialf(x,y,z)*MPI) #end
   pow(pow(ttx()+0.25,2)+pow(tty(),2),1/64)*.33

+pow(pow(ttx()-0.125,2)+pow(tty()+0.21650635094610966169093079268823,2),1/64)*.33

+pow(pow(ttx()-0.125,2)+pow(tty()-0.21650635094610966169093079268823,2),1/64)*.33
   -.945+sin(radialf(x,y,z)*10*pi)*0.01

 }
 threshold 0
 accuracy 0.0002
 max_gradient 0.75
 contained_by{box{-<2.1,0.55,2.1>,<2.1,0.55,2.1>}}
}

object{heart scale 1.2
 rotate -x*60-y*30
 texture{st}
}

//=== End


Post a reply to this message

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


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: My favourite isosurface (see p.b.i. for image)
Date: 19 Nov 2003 20:41:24
Message: <3fbc1bc4@news.povray.org>
"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


Post a reply to this message

From: Dennis Miller
Subject: Re: My favourite isosurface (see p.b.i. for image)
Date: 19 Nov 2003 22:32:18
Message: <3fbc35c2$1@news.povray.org>
Great scene!
Why do you declare fn_X but not use it?

D.

"Alex Kluchikov" <klk### [at] ukrnet> wrote in message
news:web.3fbbe555cd7b5c811235fd70@news.povray.org...
>
>  Here is the source.
>
> //=== Begin
>
> // Alex Kluchikov, 2003
> // mailto: klk### [at] ukrnet, akl### [at] mailru
> // Feel free to modify/use in any form
>
> sky_sphere{pigment{gradient y color_map{[0,color rgb <0.8,0.83,1>][1,color
> rgb <0.4,0.7,1>]}scale 2 translate -y}}
> sphere{0,1000 texture{
>  pigment{average pigment_map{
>  #declare gr=.8;
>  #declare ge=3/(1+gr+gr);
>  #declare t1=.3;
>  #declare t2=.8;
>  #declare tr1=.1;
>  #declare tr2=.1;
>   [1,bozo translate 5*y color_map{
>    [t1,color rgbt < 1,gr,gr,tr1>*ge]
>    [t2,color rgbt < 0, 0, 0,tr2>*ge]
>   }]
>   [1,bozo translate 5*z color_map{
>    [t1,color rgbt < gr, 1,gr,tr1>*ge]
>    [t2,color rgbt <  0, 0, 0,tr2>*ge]
>   }]
>   [1,bozo translate 5*x color_map{
>    [t1,color rgbt < gr,gr, 1,tr1>*ge]
>    [t2,color rgbt <  0, 0, 0,tr2>*ge]
>   }]
>
>  }}scale 0.25 finish{ambient 1 diffuse 0}scale 3000}no_shadow no_image
>  hollow //no_reflection
>   double_illuminate scale 100}
>
> #declare st=texture{pigment{color rgb<0.83,0.82,0.84>*1.2}
>   finish{diffuse 0.85 ambient 0 specular 0.9 roughness .03 phong 1.0
> brilliance 9.3 phong_size 80  metallic .5
>    reflection{0.6,1.0 metallic}}
> //   normal{bozo .5 scale .002}
>   }
>
> #declare area=0;
> #declare areacount=2;
> #declare areasize=2.5;
>
> light_source{
>  -35*z, color rgb <1.0,0.8,0.6>*0.55
> #if(area)
>  area_light x*areasize,y*areasize,areacount,areacount jitter adaptive 1
> circular orient
> #else
>  parallel
> #end
>  rotate x*55 rotate -y*45
>  }
>
> light_source{
>  -35*z, color rgb <0.6,0.8,1>*0.55
> #if(area)
>  area_light x*areasize,y*areasize,areacount,areacount jitter adaptive 1
> circular orient
> #else
>  parallel
> #end
>  rotate x*25 rotate y*25
>  }
>
> camera{
>  location -5*z
>  look_at 0
>  }
>
> #declare fn_X = function(a,b,c) {
>   pow((a*a+(c+0.15)*(c+0.15))*1.5,1/32)
>  }
>
> #declare radialf=function{
>  pattern{radial}
> }
>
> #declare heart=
> isosurface{
>  function{
>  #declare MPI=16*pi/3;
>  #macro tx() (sqrt(x*x+z*z)-1.5) #end
>  #macro ty() y #end
>  #macro ttx() tx()*sin(radialf(x,y,z)*MPI)+ty()*cos(radialf(x,y,z)*MPI)
#end
>  #macro tty() tx()*cos(radialf(x,y,z)*MPI)-ty()*sin(radialf(x,y,z)*MPI)
#end
>    pow(pow(ttx()+0.25,2)+pow(tty(),2),1/64)*.33
>
>
+pow(pow(ttx()-0.125,2)+pow(tty()+0.21650635094610966169093079268823,2),1/64
)*.33
>
>
+pow(pow(ttx()-0.125,2)+pow(tty()-0.21650635094610966169093079268823,2),1/64
)*.33
>    -.945+sin(radialf(x,y,z)*10*pi)*0.01
>
>  }
>  threshold 0
>  accuracy 0.0002
>  max_gradient 0.75
>  contained_by{box{-<2.1,0.55,2.1>,<2.1,0.55,2.1>}}
> }
>
> object{heart scale 1.2
>  rotate -x*60-y*30
>  texture{st}
> }
>
> //=== End
>
>
>


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: My favourite isosurface (see p.b.i. for image)
Date: 19 Nov 2003 22:48:00
Message: <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 2E-4
    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: Alex Kluchikov
Subject: Re: My favourite isosurface (see p.b.i. for image)
Date: 20 Nov 2003 01:00:02
Message: <web.3fbc5805d6b87b52d68d943d0@news.povray.org>
>
>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*z-1} 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 2E-4
>     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

Goto Latest 10 Messages Next 5 Messages >>>

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