POV-Ray : Newsgroups : povray.binaries.images : Isosruf Again :o) : Re: Isosruf Again :o) Server Time
19 Nov 2024 18:30:36 EST (-0500)
  Re: Isosruf Again :o)  
From: R  Suzuki
Date: 27 Nov 2001 23:42:45
Message: <3c046b45@news.povray.org>
Try the below code.  The rendering speed is about 5 times 
faster than that of the original on my PC.

The gradient values near the origin is extremely smaller 
than those near the container surface. 
In such cases, it is better to calculate them separately.

The below code is not well optimized.  Combination with other
techniques might increase the speed further.

c.f. http://news.povray.org/3bc417a4@news.povray.org
     http://news.povray.org/3bd7f6e8$1@news.povray.org

R. Suzuki

-------------------------------------------------------------
#include "functions.inc"
background { color rgb <0.5, 0.7, 1> }

camera {
  location  <0.0, 2.0, -20.0>
  look_at   <0.0, 0.0,  1.0>
  right     x*image_width/image_height
}

light_source {
  0*x         
  color rgb <1,1,1> 
  translate <0, 10, -20>
}

// create a isosurface object - the equipotential surface
// of a 3D math function f(x, y, z)
#declare fn_X = function(x,y,z,tau) {
 8*(x^2-tau^4*y^2)*(y^2-tau^4*z^2)*(z^2-tau^4*x^2)
  *(x^4+y^4+z^4-2*(x^2*y^2+y^2*z^2+z^2*x^2))
  +(3+5*tau)*(x^2+y^2+z^2-1)^2*(x^2+y^2+z^2-(2-tau))^2 }

#macro ISO1(R1, R2, max_g, Open_flg)
  isosurface {
    function {fn_X(x,y,z,(1+sqrt(5))/2) & -f_sphere(x,y,z,R1)*max_g}       
    contained_by { sphere { 0, R2 } }  
    accuracy 0.001                      
    max_gradient max_g             
  //evaluate 100, 1.20, 0.99       
  #if (Open_flg)
    open
  #end
  }
#end

object{
  union{
    difference{  
      ISO1(2.49, 3.0, 3445031.481, on)
      sphere{ 0, 2.5 }
    }
    ISO1(1.9, 2.5, 330000., on)
    ISO1(1.4, 1.9, 13000., off)
    ISO1(1.0, 1.4, 1500., off)
    ISO1(0.72, 1.0, 70., off)
    ISO1(0.6, 0.72, 5., off)
  }

 material {
   texture {
     pigment { color rgb <0.2, 0.7, 0.2> }
     finish {
       ambient 0.3          // ambient surface reflection color [0.1]
       diffuse 0.6          // amount [0.6]
       phong 0.5          // amount [0.0]
       phong_size 40      // (1.0..250+) (dull->highly polished) [40]

       reflection {
      //0.0             
      1.0               
        fresnel on      
        falloff 1.0     
        exponent 1.0    
        metallic 1.0    
      }
    }
  }

 }
  rotate y*30
  scale 3
}


Post a reply to this message

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