File:Fractal trees on isosurface 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: 2.34 MB, MIME type: image/png)

Captions

Captions

Fractal trees on isosurface

Summary

[edit]
Description
English: Fractal trees on isosurface. Created with POV-Ray.
Date
Source Own work
Author Merikanto

POV-Ray 3.7 source code

// // fractal tree example // ground isosurface, offset of trees with functrion that match simple multiple sin() based isosurface // POV-Ray 3.7 source code // // 20.7.2023 0000.0000 //

  1. include "colors.inc"


  1. include "textures.inc"
  2. include "stones.inc"
  3. include "woods.inc"
  1. include "rand.inc"
  2. include "functions.inc"
  3. include "transforms.inc"

camera { // location <0, 20, -10>/3 // location <0, 10, -10>/3

location <7, 1, -10>  *1/10

// location <0, 10, 0> /2

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 }


  1. 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}  ]
   }
}


  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}
 }
  1. declare planeground1=plane {
 y, -2
 
pigment {color Green}

// texture {groundtex2} }


  1. declare watertex1= texture
 {
   pigment { color rgb < 0.3, 0.3, 0.7 > }
   normal { bumps 0.2 scale < .5, 0.25, 0.15 > }
   finish { phong 1 reflection 1.0 ambient 0.2 diffuse 0.2 specular 1.0 }
 }
  1. declare water1=plane

{

 y, 0
 texture
 {
 watertex1
 }
   translate < 0, .20 , 0 >

}

//object {planeground1}

  1. declare obj1= object {

//sphere {0,1} cone {0,0.75,<0,2,0>,0.003}

translate y*0

// Reorient_Trans(-y,-y)  
    

}


//object { obj1 translate inter1 }

/* object {

sphere { 0,1 }

scale y/10 scale 10

pigment {color Red}

}


  • /


#macro tree1(level, levels1)

// seed(1239)


  1. 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}

  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
 


}

  1. end
  1. end


#declare ypos1 = 0;
  1. macro yyyy(x1,z1)

//#declare ypos1=0-sin(sqrt ( x1*x1+z1*z1 ))

  1. declare ypos1=0-sin(sqrt ( (x1*x1+z1*z1)*10))/2-sin(x1*10)/2-sin(z1*10)/2 ;

//+sin(x1-z1);

  1. declare ypos1=ypos1/20;
  1. end
  1. declare field1=union {
  1. for (zz,-5,5)
  1. for (xx,-5,5)
  1. declare skal1=.1;
  1. declare x1=xx*skal1;
  2. declare z1=zz*skal1;
  1. declare x2=x1+skal1;
  2. declare z2=z1+0;
  1. declare x3=x1+skal1;
  2. declare z3=z1+skal1;
  1. declare x4=x1+0;
  2. declare z4=z1+skal1;

yyyy(x1,z1);

  1. declare y1=ypos1;
yyyy(x2,z2);
  1. declare y2=ypos1;

yyyy(x3,z3);

  1. declare y3=ypos1;
yyyy(x4,z4);
  1. declare y4=ypos1;
  1. declare p1= <x1,y1,z1>;
  2. declare p2= <x2,y2,z2>;
#declare p3= <x3,y3,z3>;
#declare p4= <x4,y4,z4>;
  1. declare po1 = polygon { 3, p1,p4,p2 };
#declare po2 = polygon { 3, p4,p2,p3 };

// #declare po3 = polygon { 5,p4,p3,p2,p1,p4 };


//object {po1 } //object {po2 } // object {po3 texture { pigment {color Red}}}

//object {sphere {0,0.1} texture { pigment {color Red}} translate <x1,y1,z1>}

//object {sphere {0,0.03} texture { pigment {color Red}} translate <x1,y1,z1>} // object { obj1 scale 0.03 texture {pigment{ color Green } } translate <x1,y1,z1> }

object { union {tree1(0,3) scale 0.03 } translate <x1,y1,z1> }

  1. end
  1. end


}

  1. declare iso1= object {

isosurface {

function { y-0+sin(sqrt ( (x*x+z*z)*10))/2+sin(x*10)/2+sin(z*10)/2 }

accuracy 0.01
max_gradient 45

contained_by {sphere {0,5}}

}

}


  1. macro randomlocs_in_surf(nunna)
#for (nn,0,nunna)
  1. declare x1= rand(1)*2-1;
  2. declare z1= rand(1)*2-1;
yyyy(x1,z1);
  1. declare y1=ypos1;
  1. if(y1>0.0)

object { sphere {0,1} // cone {<0,0,0>,1,<0,1,0>,0.01 } //scale 0.003

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

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


translate <x1,y1,z1>

translate z*0 }


  1. end // end if
  1. end // loop
  2. end // macro


object {planeground1 texture {groundtex1} translate y*1.95}


object {

disc { 0,<0,1,0>,0.8 }

texture {watertex1 scale 0.02}

translate y*-0.049 }

//object {water1 scale 0.1 translate y*-2/5}

object {field1}



object {iso1 scale y/20 translate z*-0

//texture {pigment {color Green/5}

 texture {groundtex2 scale 0.05}

//normal {granite }

// translate y*5

// rotate x*90


 } 


//randomlocs_in_surf(100)


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
current13:16, 20 July 2023Thumbnail for version as of 13:16, 20 July 20231,600 × 1,200 (2.34 MB)Merikanto (talk | contribs)Uploaded own work with UploadWizard

There are no pages that use this file.

Metadata