|
|
On Fri, 24 Oct 2014 03:11:21 +0200, Bald Eagle
<cre### [at] netscapenet> wrote:
Here's a scene with a leaf
// Begin code //////////////////////////////////////////////////////////
///
//----------------------------------------------------------------------
----
#version 3.7;
global_settings{ assumed_gamma 1.0 }
#default{ finish{ ambient 0.1 diffuse 0.9 }}
//----------------------------------------------------------------------
----
#include "colors.inc"
#include "textures.inc"
#include "glass.inc"
#include "metals.inc"
#include "golds.inc"
#include "stones.inc"
#include "woods.inc"
#include "shapes.inc"
#include "shapes2.inc"
#include "functions.inc"
#include "math.inc"
#include "transforms.inc"
//----------------------------------------------------------------------
----
// camera
------------------------------------------------------------------
#declare Camera_0 = camera {/*ultra_wide_angle*/ angle 75 // fron
t
view
location <0.0 , 1.3 ,-3.0>
right x*image_width/image_height
look_at <0.0 , 1.0 , 0.0>}
#declare Camera_1 = camera {/*ultra_wide_angle*/ angle 90 // diagona
l
view
location <2.0 , 2.5 ,-3.0>
right x*image_width/image_height
look_at <0.0 , 1.0 , 0.0>}
#declare Camera_2 = camera {/*ultra_wide_angle*/ angle 90 // right sid
e
view
location <3.0 , 1.0 , 0.0>
right x*image_width/image_height
look_at <0.0 , 1.0 , 0.0>}
#declare Camera_3 = camera {/*ultra_wide_angle*/ angle 90 // to
p
view
location <0.0 , 3.0 ,-0.001>
right x*image_width/image_height
look_at <0.0 , 1.0 , 0.0>}
camera{Camera_0}
// sun
---------------------------------------------------------------------
light_source{<-1500,2500,-2500> color White}
// sky
---------------------------------------------------------------------
sky_sphere { pigment { gradient <0,1,0>
color_map { [0.00 rgb <1.0,1.0,1.0>]
[0.30 rgb <0.0,0.1,1.0>]
[0.70 rgb <0.0,0.1,1.0>]
[1.00 rgb <1.0,1.0,1.0>]
}
scale 2
} // end of pigment
} //end of skysphere
// fog
---------------------------------------------------------------------
// ground
------------------------------------------------------------------
plane{ <0,1,0>, 0
texture{ pigment{ color rgb <0.825,0.57,0.35>}
normal { bumps 0.75 scale 0.025 }
finish { phong 0.1 }
} // end of texture
} // end of plane
//----------------------------------------------------------------------
----
//---------------------------- objects in scene
----------------------------
//----------------------------------------------------------------------
----
//object{Leaf()}
#ifndef(Rand)
#declare Rand=seed(97531);
#end
#declare LeafHalf=
// 3D curved FINITE (no CSG) surface created from a mesh of triangles
bicubic_patch {
type 0 // patch_type (0..1)
// 0 = Bezier patch, just store the triangular vertices
// 1 = Bezier patch, store all plane equations defined by
// the triangulation of the patch into sub patches
// (faster, uses more memory)
flatness 0 // flatness value
// flatness_value = 0.0 to 1.0, with higher values
// giving flatter, less smooth results
u_steps 4 // # of triangles to subdivide (1-5)
v_steps 4 // # of triangles to subdivide (1-5)
<0,0,0> <0,.266,.054><-.15,.4,.6> (<-.15,.4,.6>+<.506,.3,.508>)/
2
//<.151,.251,.415>
<.119,.175,0> <.5,.2,.2><.4,.2,.318> <.506,.3,.508>
<.288,.334,0> <.4,.3,.2><.8,.1,.05> <.7,0,.067>
(<.288,.234,0>+<.777,.1-.079,0>)/2
<.777,-.079,0><.8,-.167,0> <.7,-.2,0> // <1,-.5,0>
scale <.9,1,1.5>
}
#declare LeafShape=
// rotate a 2-D outline of points around the Y axis to create a 3-D shap
e
// extrude a closed 2-D shape along an axis
prism {
linear_sweep // or conic_sweep for tapering to a point
linear_spline // linear_spline | quadratic_spline | cubic_spline |
bezier_spline
-1, // height 1
1, // height 2
44, // number of points
<0,0>,<.054,0>,
<.65,.08>,<.6,.1>,
<.63,.12>,<.6,.14>,<.64,.16>,<.61,.18>,
<.65,.2>,<.62,.22>,<.66,.24>,<.61,.26>,
<.65,.28>,<.6,.3>,<.62,.35>,
<.57,.35>,<.59,.39>,<.55,.39>,
<.55,.45> ,<.53,.43>,<.52,.52>, <.5,.45>,
<.48,.51>,<.46,.49>,<.44,.54>,<.43,.51>,
<.41,.56>,<.39,.54>,<.37,.58>,<.35,.56>,
<.33,.6>,<.31,.58>,<.28,.63>,<.26,.61>,
<.22,.65>,<.2,.63>,<.15,.68>,<.14,.65> ,
<.12,.7>,<.09,.68>,<.06,.72>,<.04,.71> ,<0,.73> ,<0,0>
//
rotate y*90
rotate x*180
translate <-.11,0,>
scale<1.01,1,1.3>
pigment {rgbft<1,0,1,.3,.3> }
finish{brilliance 4 specular .3}
}
#include "transforms.inc"
#declare Trans1=rand(Rand);
#declare Trans2=rand(Rand);
#macro FracPigm(Recursions,ColA,ColB)
#local Count=0;
#while (Count<Recursions)
wood
rotate Count*30
triangle_wave warp{turbulence <.1+.5*Trans1,0,.1+.5*Trans2>}
scale .5 // warp{turbulence .5}
pigment_map{[0 rgbt
((ColA*(Recursions-Count))+(ColB*Count))/Recursions]
[.05
#local Count=Count+1;
#end
rgbt ColB
#while (Count>0)
]
}
#local Count=Count-1;
#end
#end
#macro FracBump(Recursions,ColA,ColB)
#local Count=0;
#while (Count<Recursions)
//gradient x rotate y*30
//gradient x rotate y*15
wood
rotate Count*30
triangle_wave warp{turbulence <.1+.5*Trans1,0,.1+.5*Trans2>}
scale .5 // warp{turbulence .5}
normal_map{[0 wood -(Recursions-Count)*.3]
[.2
#local Count=Count+1;
#end
quilted .3 rotate <0,45,45> scale <.3,3,1> warp{turbulence .1}
#while (Count>0)
]
}
#local Count=Count-1;
#end
#end
#macro FracTex(Recursions,ColA,ColB)
#local Count=0;
#while (Count<Recursions)
//gradient x rotate y*30
//gradient x rotate y*15
wood
rotate Count*30
triangle_wave warp{turbulence <.1+.5*Trans1,0,.1+.5*Trans2>}
scale .5 // warp{turbulence .5}
texture_map{[0 pigment{ rgbt
((ColA*(Recursions-Count))+(ColB*Count))/Recursions }
normal{wood -(Recursions-Count)*.3 slope_map{[0
<1,0>][1 <0,-1>]}}
finish {diffuse .5,0}
]
[.1
#local Count=Count+1;
#end
pigment{rgbt ColB }
normal{quilted .3 rotate <0,45,45> scale <.3,3,1> warp{turbulenc
e
.1}}
#if(version>3.6)
finish {diffuse 1,.01 ambient .6 specular .5 metallic .5}
#end
#while (Count>0)
]
}
#local Count=Count-1;
#end
#end
//#declare LeafTex1=
#macro LeafTex1()
texture {
object{LeafShape
texture{ pigment{rgbt 1} }
texture{
gradient z rotate y
texture_map{
[0 pigment{ colo
ur
rgb <0.4,0.533,0.035>*.2}]
[.05
FracTex(3,<0.4,0.533,0.035,0>*.2,<0.365,0.533,0.035,.5>*.08)
//rgb .5
rotate
<0,30,-60>
scale
<.6+.1*rand(Rand),.9,.5>*.9
translate
<.5,-.1,0>
warp{turbulence
.01+.01*Trans1}
]
}
}
}
}
#end
#declare Trans1=rand(Rand);
#declare Trans2=rand(Rand);
//#declare LeafTex2=
#macro LeafTex2()
texture {
object{LeafShape
texture{ pigment{rgbt 1} }
texture{
gradient z rotate y
texture_map{
[0 pigment{ colo
ur
rgb <0.4,0.533,0.035>*.5}]
[.05
FracTex(3,<0.4,0.533,0.035,0>*.5,<0.365,0.533,0.035,.1>*.2)
//rgb .5
rotate
<0,30,-60>
scale
<.4+.3*rand(Rand),.9,.5>*.9
translate
<.5,-.1,0>
warp{turbulence
.01+.01*Trans1}
]
}
}
}
}
#end
//#declare Leaf=
#macro Leaf()
union{object{LeafHalf LeafTex1()}
object{LeafHalf LeafTex2() scale <1,1,-1>}
#if (rand(Rand)>.5)
scale <1,1,-1>
#end
}
#end
//object{Leaf()}
object{Leaf() rotate z*-60 rotate y*140 translate y}
//----------------------------------------------------------------------
---------------------------
// End code
////////////////////////////////////////////////////////////////////////
--
-Nekar Xenos-
Post a reply to this message
Attachments:
Download 'leaftest.png' (341 KB)
Preview of image 'leaftest.png'
|
|