|
|
On Fri, 17 Oct 2014 08:03:14 +0200, s.day <s.d### [at] uelacuk> wrote:
> "Nekar Xenos" <nek### [at] gmailcom> wrote:
>>
>> How about making a smooth leaf and then add triangles on the edges?
>>
>
> Why didn't I think of that (not enough monkeys obviously ;-)
>
> Well below is a bit rough around the edges (pun intended) but only too
k
> a minute
> to add, some tweaking would be required for a better effect.
>
> Thanks, this could come in handy.
>
> Sean
For the texture I made a recursive texture macro. Maybe you could adapt
it
to your code
//========================
========================
=======================
// Begin Code
//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 .5,.01}
#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>*.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
<.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}
// End Code
//========================
========================
=======================
--
-Nekar Xenos-
Post a reply to this message
|
|