|
|
> Inspired by fiddling around with height fields tonight.
>
> My question is ...
>
> Can someone help me figure out how to use trace and the normal
> vector that is set by the function to place my trees only in those
> places that are at a certain level of flatness?
>
> Is such a thing possible?
>
> Thanks ...
First of all, nice pic.
Concerning trace, try this:
You should declare your heightfield
#delcare HF_Object=
heightfield......
and your tree
#declare Tree=
...........
and then you can declare your tree-array
#declare Tree_Array=
union{
#declare A=0;
#while (A<=20) //change this set the amount of trees in this direction
#declare B=0;
#while (B<=20) //change this set the amount of trees in the other
direction
#declare Normal=<0,0,0>;
// when you want to change the distance between the trees change
// this < 1+2*B , 0 , 1+2*A > maybe to this < 1+4*B , 0 , 1+4*A >
// whatever you want
#declare Pos=trace(HF_Object, < 1+2*B , 0 , 1+2*A > + y*20, <0,-1,0>,
Normal);
#if (vlength(Normal))
// I declare the materials often in extra files, when the scene becomes
too big.
object {Tree material{Tree_Material} translate Pos}
#end
#declare B=B+1;
#end
#declare A=A+1;
#end
}
object{HF_Object}
object{Tree_Array}
You can also randomize the placing of the trees a bit, by adding a random
value to the translation string.
Regards,
flo
--
DigitalTwilight
#homepage: http://www.digitaltwilight.de
#email: kin### [at] gmxnet
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 19.08.2003
Post a reply to this message
|
|