POV-Ray : Newsgroups : povray.text.scene-files : My favourite isosurface (see p.b.i. for image) : Re: My favourite isosurface (see p.b.i. for image) Server Time
24 Apr 2024 17:20:18 EDT (-0400)
  Re: My favourite isosurface (see p.b.i. for image)  
From: Tor Olav Kristensen
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

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