|
|
Hello,
I'am playing with ridgedfm heightfield and I'am trying
to place some "trees" (cylinders, right now ;-) on it.
But something is wrong: when I made box, sphere,
isosurface with function { y } instead of heightfield,
it works. When I use ridgedmf, or noise, or pigment
in fuction it is unable to fund intersection of rays
with hf. But is heightfield itself displays correctly.
Any idea, what I'am doing bad?
Thanks
Disnel
Source code of testing scene:
#version unofficial MegaPov 0.5;
camera {
location <10, 10, -10>
angle 20
look_at <0, 0, 0>
}
light_source {< 100, 100, -50> color rgb 1}
light_source {<-100, 100, -50> color rgb .5}
#default {
texture {
pigment {color rgb 1}
finish {ambient 0 diffuse .8}
}
}
//background {color rgb .7}
#declare H=1.0;
#declare Lac=1.5;
#declare Octs=12;
#declare Offset=0.0;
#declare T=1.0;
#declare HF_Func=function {"heteroMF",<H, Lac, Octs, Offset, T> }
#declare Landscape=
isosurface{
function{y - HF_Func(x,0,z) + 1 }
eval
contained_by { box {<-2, -2, -2>, <2, 0, 2>} }
scale <1, .4, 1>
}
//#declare Landscape=box {<-2, -1, -2>, <2, 0, 2>}
//#declare Landscape=sphere {<0, -10, 0>, 10}
object {Landscape}
#declare Step_x=0.3;
#declare Step_z=0.3;
#declare Max_x=2;
#declare Max_z=2;
#declare Tree=
cylinder {
<0, 0, 0>, <0, .25, 0>, .02
texture {
pigment {color rgb <.5, 1, .5>}
}
}
#macro PlaceTree(px, pz)
#local Normal=<0, 0, 0>;
#local Where=trace(Landscape, <px, 10, pz>, <0, -1, 0>, Normal);
#if (Normal.x = 0 & Normal.y = 0 & Normal.z = 0)
#warning "Tree not placed\n"
#else
object {Tree translate Where}
#end
#end
#local px=0;
#while (px < Max_x)
#local pz=0;
#while (pz < Max_z)
PlaceTree(px, pz)
#if (px > 0)
PlaceTree(-px, pz)
#if (pz > 0)
PlaceTree(-px, -pz)
#end
#end
#if (pz > 0)
PlaceTree(px, -pz)
#end
#local pz=pz+Step_z;
#end
#local px=px+Step_x;
#end
Post a reply to this message
|
|