File:Fractal tree pov-ray 1 r 1.png

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Original file(1,600 × 1,200 pixels, file size: 1.38 MB, MIME type: image/png)

Captions

Captions

Fractal tree

Summary[edit]

Description
English: Fractal tree
Date
Source Own work
Author Merikanto

POV-Ray 3.7 source code. Needs some time to render.

//
// fractal tree example
// POV-Ray 3.7 source code
//
// 20.7.2023 0000.0005
//



#include "colors.inc"
   


#include "textures.inc"
#include "stones.inc"
#include "woods.inc" 
 
#include "rand.inc"
#include "functions.inc"


#declare mquu=44;  


#declare name1 = "stouns.inc";

#if(!file_exists(name1))
  #debug concat("\n\nCreting stonefile, ", name1, "...\n")

  #fopen file1 name1 write
  #write (file1, "#declare stouns = array[", str(mquu,0,0), "]{\n  ")

  #declare sep1 = array[2]{",\n  ", ", "}  

  #declare quu1=1;
  #while (quu1<=mquu)
    #write (file1, concat("T_Stone", str(quu1,0,0), sep1[!!mod(quu1,5)]))
    #declare quu1=quu1+1;
  #end

  #write (file1, "\n}\n")
  #fclose file1
#else
  #debug concat("\n\nStounfile, ", name1, " already exists.\n")
#end

//Load our stone names array
#include name1












camera {
//  location <0, 10, -10> 
 location <0, 0.3, -7>*1
 
// location <0, 3, -10> 
 
// location <0, 50, 0> 

// look_at <0,0,0>
 look_at <0, 1, -1>
  angle 27
//  angle 45
}

sky_sphere {
  pigment {
    gradient y
    color_map { [0.0 color rgb <1,1,1.2>*0.8] [1.0 color rgb <0,0,1>] }
  }
}

light_source { <-30, 30, -30>*1000*1000*1000  White }
//light_source { <-20, 50, -40> White }
 



#declare groundtex2=texture {

//  agate

    wrinkles

    scale 3

    texture_map {
    [0 pigment { granite scale 0.1 } normal {agate scale 0.1}  ]

    [1 pigment { granite scale 0.1 color_map { [0 color Green/2][0.3 color (Green+Yellow)/2]  [0.6 color (Green+Tan)/2]  [0.6 color Tan/2]   } } normal {granite scale 0.1}  ]

    }



 }





 
#declare groundtex1=    texture {
 //   pigment {checker color Green color <0,.6,0> scale 0.15}
  pigment { 
 //  color rgbt <124, 252, 0>/255
//  color rgbt <138/255, 154/255, 91/255,0>/3

//wrinkles  scale 0.1
// crackle   turbulence 0.6
  granite

//  turbulence 0.1
 
//color_map {
//[0 color rgbt <138/255, 154/255, 91/255,0>/3]
// [1  color rgbt <.5,.5,.5,0>/4 ]
//} 
 

 color_map {
 [0 color rgbt <138/255, 154/255, 91/255,0>/3]
 [1  color rgbt <124, 252, 0>/255 ]
}
  

 }
 

 normal {

//crackle turbulence 1 scale 0.01
//granite scale 0.03
spotted scale 0.003 bump_size 30
//  agate
//  wrinkles scale 0.1


bump_size 10
}
             

  finish {specular 0.6}



  }








#declare planeground1=plane {
  y, 0

 texture {groundtex2}
}
   

  
#declare ellips1= object {

sphere {0,1}

scale z/2
scale y/20

//rotate x*90

translate x*0

}



#declare dwarf1=union {

    #declare numus1=7;
 
    #declare skk1=0.1;



    #for (n,0, numus1)
        #declare randirot1=rand(1)*360;
        #declare yt1=n*0.1;


    union {

    #declare roty1=0;
    #declare rotz1=20;
    object {ellips1 scale skk1 texture {pigment {Green/5} } rotate rotz1 rotate roty1 translate x*skk1}
    #declare roty1=0;

    object {ellips1 scale skk1 texture {pigment {Green/5} } rotate -rotz1 rotate roty1 translate x*-skk1}       

    rotate y*randirot1

    translate y*yt1
    
    }




    #end
    
 cone {
<0,-skk1,0>,0.02,<0,numus1*skk1,0>,0.01

texture {pigment {Green/5} }
}

 


}








#macro tree1(level, levels1)

// seed(1239)
 



#if((level)>levels1)
// sphere {0,0.2 pigment {color Green}}

cone { <0,0,0>, 0.15, <0,1,0>, 0.005 pigment {color rgb <10,72,30>/255 } scale 1} 


#else


       cone {
      <0, 0, 0>,.05, <0, 1, 0>, .04
       scale 1
       pigment {color <130,112,100>/255}  
       normal {granite}
    }
//#declare level=level+1;
  
//  sphere {0,0.2 pigment {color Red}}

union{
 union {       tree1(level+1, levels1) 
       rotate z*-60  *rand(1)
      }
  union {       tree1(level+1, levels1) 
       rotate z*60  *rand(1)
      }
  union {       tree1(level+1, levels1) 
       rotate x*-60 *rand(1)
      }
  union {       tree1(level+1, levels1) 
       rotate x*60 *rand(1)
      }

translate y*1

  #declare sk2=max(rand(1),1)*0.2+0.8;  
 scale sk2*0.7
  

 


}


#end







#end








#macro grass1(numgrass, dimension1)

#declare halfdim1=dimension1/2;
#declare dimension2=dimension1*2;

#for (nn,0,numgrass)
  
#declare x1=rand(1)*dimension1-halfdim1 ;
 #declare z1=rand(1)*dimension1-halfdim1 ;
 #declare roz1=rand(1)*dimension2;
  #declare rox1=rand(1)*dimension2; 
#declare roy1=rand(1)*360;

object {

object {
cone {<0,0,0>,0.02,<0,1,0>,0.001}

texture {
pigment {color rgbt <124, 252, 0>/255}
}  


scale 0.3
}
 
scale x*0.1
 rotate z*roz1 
rotate x*rox1
rotate y*roy1


translate x*x1
translate z*z1
}

#end

#end


  

#macro stones(number1, dimension1)
    
    #declare quu1=1;
    #declare halfdim1=dimension1/2 ;
    #for (nn,0,number1)
  
    #declare x1=rand(1)*dimension1-halfdim1 ;
    #declare z1=rand(1)*dimension1-halfdim1 ; 
    #declare y1=rand(1)*0.01 ; 
    #declare s1=0.3+rand(1)*1.5 ; 

    #declare roz1=rand(1)*360;
    #declare rox1=rand(1)*360; 
    #declare roy1=rand(1)*360;

     #declare quu1=mod(quu1+1, mquu);
    object {
    sphere { 0,1 }     

  //  texture {
   // pigment {color rgb <1,1,1>/6} 
    //T_Stone40   
     texture{
    stouns[quu1] scale 0.1
    finish {phong 0} 
    normal {granite scale 5}
    }  


    scale 0.1*s1
 scale y/3
 scale x/1.5
 

    //rotate z*roz1 
    //rotate x*rox1
    rotate y*roy1


    translate x*x1
    translate z*z1
     translate y*y1
    }

    #end

#end

 

#macro tuft1(numm1)
 
intersection
{

union {
#for (nn,0,numm1)

#declare rr1=1;
#declare fii1=rand(1)*360;
#declare fii2=rand(1)*180;

#declare fii3=fii2+fii1;
  
#declare s1=rand(1)*0.5+0.75;
  
#declare rr2=s1*rr1;

//#if (fii2>90)
//#declare fii3=0;
//#end


object {
cone {<0,0,0>,0.02,<rr2,0,0>,0.0001 scale z/5}
texture {pigment {color rgbt <124, 252, 0>/255}}

 rotate <0,fii1,fii3>
}

 
#end

}

   

box{<-1,0,-1>,<1,1,1>}
  

scale 0.1
}

#end // end macro




#macro tufts1(number1, dimension1)

    #declare halfdim1=dimension1/2 ;
    #for (nn,0,number1)
  
    #declare x1=rand(1)*dimension1-halfdim1 ;
    #declare z1=rand(1)*dimension1-halfdim1 ; 
    #declare y1=rand(1)*0.01 ; 
    #declare s1=0.3+rand(1)*1.5 ; 

    #declare roz1=rand(1)*360;
    #declare rox1=rand(1)*360; 
    #declare roy1=rand(1)*360;


    object {
  //  sphere { 0,1 }     
     
    object {

    tuft1(20)

    //translate y*0.5  

    //translate z*-4
    }

//    texture {
   // pigment {color rgb <1,1,1>/6} 
//    T_Stone40
 //   }  


    scale 1
// scale y/4
// scale x/2
 

    //rotate z*roz1 
    //rotate x*rox1
//    rotate y*roy1


    translate x*x1
    translate z*z1
 //    translate y*y1
    }

    #end

#end





#macro vegetat1(number1, dimension1) 

    #declare quu1=1;
    #declare qnum=44;

      #declare halfdim1=dimension1/2 ; 


    #for (nn,0,number1)
    #declare quu1=mod(quu1+1, qnum);
    #declare x1=rand(1)*dimension1-halfdim1 ;
    #declare z1=rand(1)*dimension1-halfdim1 ; 
    #declare y1=rand(1)*0.01 ; 
    #declare s1=0.3+rand(1)*1.5 ; 

    #declare roz1=rand(1)*360;
    #declare rox1=rand(1)*360; 
    #declare roy1=rand(1)*360;

    #declare objnum1=int(rand(1)*30);
 
    #if(objnum1=0)

     object {
        sphere { 0,1 }     

         texture {

           // T_Stone40   
                  stouns[quu1] scale 0.3
            finish {phong 0} 
            normal {granite scale 5}
            }  


        scale 0.1*s1
        scale y/3
        scale x/1.5
 

        rotate y*roy1


        translate x*x1
        translate z*z1
        translate y*y1
    
        }

     #end


    #if(objnum1=1)

        object {

     
        object {

        tuft1(15)

        }


        scale 3

        translate x*x1
        translate z*z1
 


        }  
    #end
 

     #if(objnum1=2)

        object {

     
   

        dwarf1

   

        scale 0.2

        translate x*x1
        translate z*z1
 


        }  
    #end

  


     #if(objnum1>2)   


        object {
            cone {<0,0,0>,0.02,<0,1,0>,0.001}

        texture {
            pigment {color rgbt <124, 252, 0>/255}
        }  


        scale 0.3
 
        scale x*0.1
        //rotate z*roz1 
        //rotate x*rox1
        rotate y*roy1


        translate x*x1
        translate z*z1
        }  
  
   #end



    #end  // loop




#end


 #declare isoground_base1=

isosurface {
function {

// y-f_wrinkles(x*10, y*5, z*10)*1
  
//y-f_granite(x,y,z)

f_sphere(x,y,z,1)-f_granite(x,y,z)*0.1  


}  
                  
accuracy 0.01
   max_gradient 40
    contained_by { box { -2, 2 } }

 scale <5,2,5> scale 1/5 translate y*-0

}  


 

object {planeground1}


object {isoground_base1 scale y*1  texture {T_Stone40 } translate x*1 translate z*3 }



//union { stones(40, 5) translate z*-3 }

//union { tufts1(30, 5)  translate z*-3 }


//object { union {grass1(1000,3) } scale y*2 translate z*-3 }


// fractal tree

object {   union {tree1(0,7) } translate z*-0} 


// simple vegation objects

vegetat1(2000, 5)

Licensing[edit]

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current10:16, 20 July 2023Thumbnail for version as of 10:16, 20 July 20231,600 × 1,200 (1.38 MB)Merikanto (talk | contribs)Update
14:25, 19 July 2023Thumbnail for version as of 14:25, 19 July 20231,600 × 1,200 (1.51 MB)Merikanto (talk | contribs)Update
12:33, 19 July 2023Thumbnail for version as of 12:33, 19 July 20231,600 × 1,200 (1.43 MB)Merikanto (talk | contribs)Update
09:23, 19 July 2023Thumbnail for version as of 09:23, 19 July 20231,600 × 1,200 (1.63 MB)Merikanto (talk | contribs)Update
05:18, 19 July 2023Thumbnail for version as of 05:18, 19 July 20231,600 × 1,200 (1,015 KB)Merikanto (talk | contribs)Uploaded own work with UploadWizard

There are no pages that use this file.

Metadata