|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Heya!
I'm trying to create some scenes automatically. My goal is to have an island
with hills, lakes and trees. The Island shape is defined by an height field
created by another application. Now I want to add trees and other objects on
this height field surface. The Question is:
Is it possible to define the z-position (if z is pointing up) of the trees
automatically by accessing the height field data, and if yes, how, if no, what
else could be done :)
Thanks a lot,
Phil
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Phil <nomail@nomail> wrote:
> Is it possible to define the z-position (if z is pointing up) of the trees
> automatically by accessing the height field data, and if yes, how, if no, what
> else could be done :)
See the trace() function at
http://povray.org/documentation/view/3.6.1/229/#s02_02_01_04_05
--
- Warp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> See the trace() function at
> http://povray.org/documentation/view/3.6.1/229/#s02_02_01_04_05
Thanks for this tip, but what, if the surface is not hit by a ray at the
location, I want to plant a tree?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Phil <nomail@nomail> wrote:
> Thanks for this tip, but what, if the surface is not hit by a ray at the
> location, I want to plant a tree?
You want to plant a tree at a place where there's no terrain?
--
- Warp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Phil" <nomail@nomail> wrote:
> Heya!
>
> I'm trying to create some scenes automatically. My goal is to have an island
> with hills, lakes and trees. The Island shape is defined by an height field
> created by another application. Now I want to add trees and other objects on
> this height field surface. The Question is:
>
> Is it possible to define the z-position (if z is pointing up) of the trees
> automatically by accessing the height field data, and if yes, how, if no, what
> else could be done :)
>
>
> Thanks a lot,
> Phil
As Warp mentioned, the trace() macro is perfect for this. In addition to giving
you a location to place your objects at, it can also provide the normal, which
lets you determine the slope at that position. This can allow you to, for
instance, place trees only on the flatter parts of the heightfield, or maybe
only on the flatter parts below a certain elevation, or maybe only on the
flatter parts above a certain elevation but below another and only on
"southward" facing parts of the heightfield.
While the documentation does an adequate job of explaining how trace works, I
think I will write a wiki article about how it can be used for this. Please
let us know if you need more help or how things went.
-Reactor
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
web.48bc338bcd5c21438abea67c0@news.povray.org...
>> See the trace() function at
>> http://povray.org/documentation/view/3.6.1/229/#s02_02_01_04_05
>
> Thanks for this tip, but what, if the surface is not hit by a ray at the
> location, I want to plant a tree?
>
If the surface is not hit by a ray with a -z direction, there is no terrain
at this location.
It is a good idea to test the length of the returned normal vector : it is
null if the trace vector does not intersect the surface.
Marc
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"m_a_r_c" <jac### [at] wanadoofr> wrote:
> web.48bc338bcd5c21438abea67c0@news.povray.org...
> >> See the trace() function at
> >> http://povray.org/documentation/view/3.6.1/229/#s02_02_01_04_05
> >
> > Thanks for this tip, but what, if the surface is not hit by a ray at the
> > location, I want to plant a tree?
> >
> If the surface is not hit by a ray with a -z direction, there is no terrain
> at this location.
>
> It is a good idea to test the length of the returned normal vector : it is
> null if the trace vector does not intersect the surface.
>
> Marc
Heya!
I've understood! Thanks a lot. I will try this tomorrow and tell you my results.
Phil
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
As promised here are my results:
The trace-Makro is really perfect for my needs, and I wonna thanks you all a lot
for the quick and high-quality answers.
My planting now like this:
#declare map = object {
height_field {
...
}
}
map
#define norm = <0,0,0>;
#while (IN A REGION WE WANT TO PLANT)
#declare h = trace(map, <x,y,2>, <x,y,0>, norm);
#if ((vlength(norm) != 0) & (vlength(h) < 0.5))
object {
tree
translate h
}
#end
#end
This is working pretty good. Thanks again.
Phil
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
web.48bddbcdcd5c21439ef408df0@news.povray.org...
>
> #while (IN A REGION WE WANT TO PLANT)
> #declare h = trace(map, <x,y,2>, <x,y,0>, norm);
// beware trace() waits for a coordinates vector then a DIRECTION vector,
not a destination one.
// I'd write instead trace(map, <x,y,2>, -z , norm);
Marc
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"m_a_r_c" <jac### [at] wanadoofr> wrote:
> web.48bddbcdcd5c21439ef408df0@news.povray.org...
> >
> > #while (IN A REGION WE WANT TO PLANT)
> > #declare h = trace(map, <x,y,2>, <x,y,0>, norm);
>
> // beware trace() waits for a coordinates vector then a DIRECTION vector,
> not a destination one.
> // I'd write instead trace(map, <x,y,2>, -z , norm);
>
> Marc
Yup, you're totally right.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |