POV-Ray : Newsgroups : povray.text.scene-files : Isosurface : pattern functions Server Time
23 Dec 2024 03:00:15 EST (-0500)
  Isosurface : pattern functions (Message 1 to 2 of 2)  
From: R  Suzuki
Subject: Isosurface : pattern functions
Date: 23 Dec 2001 09:21:26
Message: <3c25e866@news.povray.org>
// Persistence of Vision Ray Tracer Scene Description File
// File: 011221a.pov
// Vers: 3.5 beta 9
// Desc: Isosurface with pattern functions
//       Time for trace:  88 sec for 640x480 NoAA on 600MHz Celeron
// Date: 12/21/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 G1=function(x){mod(x+100,1)-0.5}
#declare G2=function(x){mod(x+100,2)-1}

#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.5))*0.8+0.01
      }
           color_map{[.0 rgb <0.25,0.35,0.4>] [.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.20 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.1-0.01,0)
     }
   contained_by{box{<-S_W*1.0,-S_H*1.0,-S_R>,
                    <S_W*1.0, S_H*1.0, +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(select(G1(y), G1(x), G1(x+0.5))
                     ,abs(G1(y))-0.25
                     ,z,   S_R,0.5,0.25,S_R)}
object{CYL1(-S_W*2.0, S_H*3, 1.0)}

#declare Func1=function(x,y,z){
        f_rounded_box(select(G2(y), G1(x), G1(x+0.5))
                     ,G1(y),z, S_R,0.5,0.5,S_R)}
object{CYL1(-S_W*2.0, S_H*1, 1.0)}

#declare Func1=function(x,y,z){
        f_rounded_box(G1(x) ,G1(y),z, S_R,0.5,0.5,S_R)}

object{CYL1(-S_W*2.0, -S_H*1, 1.0)}

#declare Func1=function(x,y,z){
        f_rounded_box(min(abs(G2(x)+G2(y))-1,abs(G2(x)-G2(y))-1)
                          ,min(G2(x),G2(y)), z, S_R,1,1,S_R)}
object{CYL1(-S_W*2.0, -S_H*3, 1.0) }


// Center
#declare Func1=function(x,y,z){
        f_rounded_box(min(min(abs(abs(G2(x))+abs(G2(y))-0.6)-1,
             select(abs(G2(x))+abs(G2(y))-0.6,0, abs(G2(x))-1)),
             select(abs(G2(x))+abs(G2(y))-0.6,0,abs(G2(y))-1))
            ,0, z, S_R,1,1,S_R)}
object{CYL1(0, S_H*3, 1.0) }

#declare Func1=function(x,y,z){
        f_rounded_box(min(min(abs(abs(G2(x))+abs(G2(y))-0.75)-1,
             abs(abs(G2(x))-abs(G2(y))+0.25)-1),
             abs(abs(G2(x))-abs(G2(y))-0.25)-1)
            ,0, z, S_R,1,1,S_R)}
object{CYL1(0, S_H*1, 1.0) }

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

#declare Func1=function(x,y,z){
        f_rounded_box(select(G2(x)*G2(y),abs(G1(x))-0.25, abs(G1(y))-0.25)
                     ,select(G2(x)*G2(y),G1(y), G1(x))
                     ,z, S_R,0.25,0.5,S_R)}
object{CYL1(0, -S_H*3, 1.0) }


// Right
#declare Func1=function(x,y,z){
        f_rounded_box(min(min(abs(abs(G2(x))+abs(G2(y))-0.4)-1,
                select(abs(G2(x))+abs(G2(y))-0.4,0, abs(G2(x))-1)),
                select(abs(G2(x))+abs(G2(y))-0.4,0,abs(G2(y))-1))
              , abs(abs(G2(x+1))+abs(G2(y+1))-1)-1
              , z, S_R,1,1,S_R)}

object{CYL1(S_W*2.0, S_H*3, 1.0) }

#declare Func1=function(x,y,z){
     f_rounded_box(min(min(abs(abs(G2(x))+abs(G2(y))-0.85)-1,
          select(abs(G2(x))+abs(G2(y))-0.85,0, abs(G2(x))-1)),
          select(abs(G2(x))+abs(G2(y))-0.85,0,abs(G2(y))-1))
         ,min(max(abs(G2(x)),abs(G2(y))), abs(abs(G2(x))+abs(G2(y))-0.35)-1)
         , z, S_R,1,1,S_R)}

object{CYL1(S_W*2.0, S_H*1, 1.0) }

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

#declare Func1=function(x,y,z){

f_rounded_box(min(select(max(abs(G2(x)),abs(G2(y)))-0.6,0,abs(G2(y))-1),

select(max(abs(G2(y)),abs(G2(x)))-0.6,0,abs(G2(x))-1))
                       ,min(  abs(abs(G2(y))-0.6)-1,
                      abs(abs(G2(x))-0.6)-1)
                    , z, S_R,1,1,S_R)}
object{CYL1(S_W*2.0, -S_H*3, 1.0)}


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

From: R  Suzuki
Subject: Isosurface : pattern functions-2
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.