POV-Ray : Newsgroups : povray.text.scene-files : Isosurface : pattern functions : Isosurface : pattern functions-2 Server Time
3 Jul 2024 02:34:11 EDT (-0400)
  Isosurface : pattern functions-2  
From: R  Suzuki
Date: 23 Dec 2001 09:34:50
Message: <3c25eb8a$1@news.povray.org>
// Persistence of Vision Ray Tracer Scene Description File
// File: 011214c.pov
// Vers: 3.5 beta 9
// Desc: Isosurface with pattern functions
//       Time for trace:  117 sec for 640x480 NoAA on 600MHz Celeron
// Date: 12/17/2001
// Auth: Ryoichi Suzuki  < r-s### [at] aistgojp >
//
#version 3.5;
#include "functions.inc"

camera { location  <0, 0., -20.> direction 5.2*z
  right  x*image_width/image_height
  look_at <0.0, 0.0, 0.0>
}

light_source {< 40, 50,-50>*2  color rgb 1*2}

#declare S_W=8.0;
#declare S_H=4.0;
#declare S_R=0.2;
#declare C_IR2=1/sqrt(2) ;

#declare G2=function(x){mod(x+100,2)-1}
#declare GR=function{sqrt(G2(x)^2+G2(y)^2)}
#declare GL=function{abs(G2(x)*C_IR2-G2(y))*C_IR2}

#macro  CYL1(X,Y,MAXG)
#declare T_Stone8aa=texture{
   pigment{
    function{(S_R-z)/(S_R*2)

*0.58+(0.5-abs(f_noise3d(x*15,y*15,0)-0.5)*(f_noise3d(x,y,0)+0.4))*0.8+0.01
     }
     color_map{[.0 rgb <0.15,0.25,0.4>] [.4 rgb <0.25,0.35,0.3>]
     [.75 rgb <0.6,0.34,0.2>][.9 rgb <0.8,0.75,0.75>][1. rgb
<1.0,0.95,0.9>]}
   }
   finish{ambient 0.3 phong 0.60 phong_size 90}
   }

isosurface{
   function{ Func1(x,y,z)
//
+max(abs(f_noise3d(x*15,y*15,0)-0.5)*(f_noise3d(x,y,0)+0.5)*0.05-0.005,0)
      }
   contained_by{box{<-S_W*1.5,-S_H*1.5,-S_R>,
                    <S_W*1.5, S_H*1.5, +S_R>}}
   max_gradient MAXG
   accuracy 0.005
//   evaluate 0.9,1.05,0.95
   translate<X,Y,0>
   texture{T_Stone8aa}
   scale 0.125
//   no_shadow
}
#end


// Left
#declare Func1=function(x,y,z){
       f_rounded_box(1-max(abs(G2(x)),abs(G2(y))), 0, z, S_R,0.25,0.25,S_R)}
object{CYL1(-S_W*2.0, S_H*3, 1.2)}

#declare Func1=function(x,y,z){
       f_rounded_box(G2(x),G2(y),z, S_R,0.8,0.8,S_R)}
object{CYL1(-S_W*2.0, S_H*1, 1.2)}

#declare Func1=function(x,y,z){
       f_rounded_box(0.5-min(abs(G2(x)),abs(G2(y))), 0, z,
S_R,0.25,0.25,S_R)}
object{CYL1(-S_W*2.0, -S_H*1, 1.2)}

#declare Func1=function(x,y,z){min(
       f_rounded_box(-0.5+min(abs(G2(x)),abs(G2(y))), 0, z, S_R,0.2,0.2,S_R)
     , f_rounded_box(0.3-max(abs(G2(x)),abs(G2(y))), 0, z,
S_R,0.2,0.2,S_R))}
object{CYL1(-S_W*2.0, -S_H*3, 1.2) }


// Center
#declare Func1=function(x,y,z){
       f_rounded_box(GR(x,y,z),0,z,  S_R,0.67,1,S_R)}
object{CYL1(0, S_H*3, 1.2) }

#declare Func1=function(x,y,z){
       f_rounded_box(GR(x,y,z)-0.75, 0,z,    S_R,0.3,1,S_R) }
object{CYL1(0, S_H*1, 1.2) }

#declare Func1=function(x,y,z){
       f_rounded_box(0.55-abs(GR(x,y,z)-0.75), 0,z, S_R,0.3,1,S_R) }
object{CYL1(0, -S_H*1, 1.2) }

#declare Func1=function(x,y,z){min(
      f_rounded_box(GR(x,y,z),0,z,  S_R,0.65,1,S_R)
    , f_rounded_box(-0.35+min(abs(G2(x)),abs(G2(y))), 0, z, S_R,0.2,0.2,S_R)
     )}
object{CYL1(0, -S_H*3, 1.2) }


// Right
#declare Func1=function(x,y,z){
      f_rounded_box(min(GL(x,y,z),GL(x,-y,z)), 0, z,  S_R,0.2, 1 ,S_R)}
object{CYL1(S_W*2.0, S_H*3, 1.2) }

#declare Func1=function(x,y,z){min(
      f_rounded_box(min(abs(G2(x))-abs(G2(y)),abs(G2(x))+abs(G2(y))), 0, z,
                                  S_R,0.3,1,S_R)
    , f_rounded_box(GR(x,y,z), 0,z, S_R,0.6,1,S_R) )}
object{CYL1(S_W*2.0, S_H*1, 1.2) }

#declare Func1=function(x,y,z){min(
      f_rounded_box(-0.2+min(abs(G2(x))-abs(G2(y)),abs(G2(x))+abs(G2(y))),
                     0, z,    S_R,0.3,1,S_R)
    , f_rounded_box(0.4-max(abs(G2(x)),abs(G2(y))), 0, z, S_R,0.2,1,S_R) )}
object{CYL1(S_W*2.0, -S_H*1, 2) }

#declare Func1=function(x,y,z){min(
     f_rounded_box(min(GL(x,y,z),GL(x,-y,z)), 0, z,  S_R,0.2, 1 ,S_R)
   , f_rounded_box(min(GL(y,x,z),GL(y,-x,z)), 0, z,  S_R,0.2, 1 ,S_R)
   )}
object{CYL1(S_W*2.0, -S_H*3, 1.2)}


box{<-S_W*5,-S_H*5,S_R><S_W*5,S_H*5,1> texture{T_Stone8aa} scale 0.125}


Post a reply to this message

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