POV-Ray : Newsgroups : povray.binaries.scene-files : Trunks again Server Time
2 Sep 2024 06:18:39 EDT (-0400)
  Trunks again (Message 1 to 1 of 1)  
From: Gena Obukhov
Subject: Trunks again
Date: 16 Oct 2002 03:20:51
Message: <3DAD122D.AD834E5A@mail.com>
camera {
 location <0, 5, -12>
 look_at <0, 5, 0>
}

light_source {<-6, 5, -7> color rgb 1.1}

background{color rgb<0.6, 0.7, 1>*1.2}

#macro Trunk1(baseRadius, topRadius, heightY, withSpline, S)
 #local Bark = pigment{
  wrinkles
  turbulence 0.1
  color_map {
   [0 rgb <0.9, 0.7, 0.6>*0.6]
   [1 rgb <0.85, 0.8, 0.79>]
  }
  scale 0.2
  scale<0.25, 0.6, 0.25>
 }
 #local P = pigment{
  wrinkles
  turbulence 0.1
  color_map {
   [0 rgb 1]
   [1 rgb 0]
  }
  scale 0.2
  scale<0.25, 0.6, 0.25>
 }

 #local F = function{
  pigment{P}
 }

 #local F1 = function {x*x + z*z - (baseRadius * baseRadius) +
((baseRadius - topRadius) * y * 10/ heightY) + F(x, (heightY/2) * y,
z).grey*0.12}

 isosurface {
  #if(withSpline = 0)
   function{F1(x, y/heightY, z)}
   max_gradient 5
   #if(baseRadius > topRadius)
    contained_by{box{<-baseRadius*1.1, 0, -baseRadius*1.1>,
<baseRadius*1.1, heightY, baseRadius*1.1>}}
   #else
    contained_by{box{<-topRadius*1.1, 0, -topRadius*1.1>,
<topRadius*1.1, heightY, topRadius*1.1>}}
   #end
   pigment{Bark scale<1, 2/heightY, 1>}
   finish {ambient 0.2 phong 0}
  #else
   function {F1(x - S(y).x, y, z - S(y).z)}
   max_gradient 5
   contained_by{box{<-2, 0, -2>, <2, 1, 2>}}
   pigment{Bark scale<1, 2/heightY, 1>}
   finish {ambient 0.2 phong 0}
   scale <1, heightY, 1>
  #end
 }
#end

#macro Trunk2(baseRadius, topRadius, heightY, withSpline, S)
 #local Bark = pigment{
  wrinkles
  turbulence 0.1
  color_map {
   [0 rgb <0.9, 0.7, 0.6>*1.2]
   [1 rgb <0.9, 0.7, 0.6>*0.5]
  }
  scale 0.2
 }
 #local P = pigment{
  wrinkles
  turbulence 0.1
  color_map {
   [0 rgb 1]
   [1 rgb 0]
  }
  scale 0.2
 }
 #local F = function{
  pigment{P}
 }

 #local F1 = function {x*x + z*z - (baseRadius * baseRadius) +
((baseRadius - topRadius) * y * 10 / heightY) + F(x, (heightY/3) * y,
z).grey*0.32}

 isosurface {
  #if(withSpline = 0)
   function{F1(x, y/heightY, z)}
   max_gradient 5
   #if(baseRadius > topRadius)
    contained_by{box{<-baseRadius*1.1, 0, -baseRadius*1.1>,
<baseRadius*1.1, heightY, baseRadius*1.1>}}
   #else
    contained_by{box{<-topRadius*1.1, 0, -topRadius*1.1>,
<topRadius*1.1, heightY, topRadius*1.1>}}
   #end
   pigment{Bark scale<1, 10/3, 1>}
   finish {ambient 0.2 phong 0}
  #else
   function {F1(x - S(y).x, y, z - S(y).z)}
   max_gradient 5
   contained_by{box{<-2, 0, -2>, <2, 1, 2>}}
   pigment{Bark scale<1, 3/heightY, 1>}
   finish {ambient 0.2 phong 0}
   scale <1, heightY, 1>
  #end
 }
#end

#macro Trunk3(baseRadius, topRadius, heightY, withSpline, S)
 #local Bark = pigment{
  wrinkles
  turbulence 0.1
  color_map {
   [0 rgb <0.9, 0.7, 0.6>*0.5]
   [0.6 rgb <0.9, 0.7, 0.6>*1.2]
  }
  scale 0.2
 }
 #local P = pigment{
  wrinkles
  turbulence 0.1
  color_map {
   [0 rgb 1]
   [0.55 rgb 0]
  }
  scale 0.2
 }
 #local F = function{
  pigment{P}
 }

 #local F1 = function {x*x + z*z - (baseRadius * baseRadius) +
((baseRadius - topRadius) * y) + F(x, heightY * 0.3 * y, z).grey*0.04}

 isosurface {
  #if(withSpline = 0)
   function{F1(x, y/heightY, z)}
   max_gradient 5
   #if(baseRadius > topRadius)
    contained_by{box{<-baseRadius*1.1, 0, -baseRadius*1.1>,
<baseRadius*1.1, heightY, baseRadius*1.1>}}
   #else
    contained_by{box{<-topRadius*1.1, 0, -topRadius*1.1>,
<topRadius*1.1, heightY, topRadius*1.1>}}
   #end
   pigment{Bark scale <1, 10/3, 1>}
   finish {ambient 0.2 phong 0}
  #else
   function {F1(x - S(y).x, y, z - S(y).z)}
   max_gradient 5
   contained_by{box{<-2, 0, -2>, <2, 1, 2>}}
   pigment{Bark scale<1, 2/heightY, 1>}
   finish {ambient 0.2 phong 0}
   scale <1, heightY, 1>
  #end
 }
#end

#macro Trunk4(baseRadius, topRadius, heightY)
 #local Bark = pigment{
  wrinkles
  turbulence 0.1
  color_map {
   [0 rgb 0.1]
   [0.5 rgb 1.2]
  }
  scale<1, 0.25, 1>
 }
 #local P = pigment{
  wrinkles
  turbulence 0.1
  color_map {
   [0 rgb 0]
   [0.5 rgb 1]
  }
  scale<1, 0.25, 1>
 }
 #local F = function{
  pigment{P}
 }
 isosurface {
  function {x*x + z*z - (baseRadius * baseRadius) + ((baseRadius -
topRadius) * y / heightY) + F(x, y, z).grey*0.08}
  max_gradient 5
  #if(baseRadius > topRadius)
   contained_by{box{<-baseRadius*1.1, 0, -baseRadius*1.1>,
<baseRadius*1.1, heightY, baseRadius*1.1>}}
  #else
   contained_by{box{<-topRadius*1.1, 0, -topRadius*1.1>, <topRadius*1.1,
heightY, topRadius*1.1>}}
  #end
  pigment{Bark}
  finish {ambient 0.2 phong 0.05}
 }
#end

#macro Trunk5(baseRadius, topRadius, heightY, withSpline, S)
 union {
  object{Trunk2(baseRadius, topRadius, heightY, withSpline, S)}
  object{Trunk3(baseRadius * 0.92, topRadius * 0.92, heightY,
withSpline, S)}
 }
#end

#declare S = function {
 spline {
     natural_spline
     -0.25, <-0.5, -2, 0>
     0.00, <0, 0, 0>
     0.25, <0.3, 2, 0>
     0.50, <0, 4, 0>
     0.75, <-0.4, 6, 0>
     1.00, <0, 8, 0>
     1.25, <0.5, 10, 0>
    }
}

//object{Trunk1(1, 0.5, 10, 1, S) translate -x*5}
//object{Trunk2(1, 0.5, 10, 1, S) translate -x*2.5}
//object{Trunk3(1, 0.5, 10, 1, S) translate x*0}
//object{Trunk4(1, 0.5, 10) translate x*2.5}
object{Trunk5(1, 0.5, 10, 1, S) translate x*5}


Post a reply to this message

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