![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Warp
Subject: Re: Can you use the trace command on a heightfield?
Date: 9 Apr 2010 01:49:18
Message: <4bbebfde@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Dre <and### [at] gmail com> wrote:
> No it parses correctly, however none of the intersections are correct, they
> are all either at <0, 0, 0> or some weird location.
Because you are not shooting the rays towards <0, -1, 0>.
--
- Warp
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Warp <war### [at] tag povray org> wrote:
> Dre <and### [at] gmail com> wrote:
> > Yet this does:
>
> > #declare norm = <0, 0, 0>;
> > #declare startPoint =<xPos, 10, zPos>;
> > #declare endPoint = <xPos, -10, zPos>;
> > trace(object, startPoint, endPoint, norm)
>
> I don't think it does (well, not in the way you want). The third parameter
> of trace() specifies a direction, not an endpoint.
>
> Probably you want the third parameter to be <0, -1, 0> because that's
> the direction you are shooting the rays towards.
>
Warp's correct. (Also, I would assume that <0,-10,0> has the same directional
effect as <0,-1,0> )
There's a big difference between <xpos,-10,zPos> and <0,-10,0> as a *direction*
vector. Let's say xPos=7 and zPos=5. That produces a *direction* of
<7,-10,5>--which certainly isn't straight down. The trace rays are probably not
even hitting the HF (and your placed object(s) are ending up at a <0,0,0>
location by default, unless you're using Norm to 'stop' that in some way, which
I assume you are.)
As has been mentioned:
* The trace ray 'start' location needs to be somewhere *above* the
HF...obviously ;-) Personally, I would use <xPos,1000,zPos> to be safe.
* the 'start' vector is an actual location point; the trace ray direction is a
*directional* vector, NOT the location of a point, and shouldn't normally
change--at least when tracing a HF.
Ken
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Thomas de Groot
Subject: Re: Can you use the trace command on a heightfield?
Date: 10 Apr 2010 03:23:55
Message: <4bc0278b$1@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Kenneth" <kdw### [at] earthlink net> schreef in bericht
news:web.4bbf648570f2d07d65f302820@news.povray.org...
> As has been mentioned:
> * The trace ray 'start' location needs to be somewhere *above* the
> HF...obviously ;-) Personally, I would use <xPos,1000,zPos> to be safe.
> * the 'start' vector is an actual location point; the trace ray direction
> is a
> *directional* vector, NOT the location of a point, and shouldn't normally
> change--at least when tracing a HF.
>
Yes, and when you want to trace, say, a spherical object, like a planet, the
following macro by Tim Attwood comes in handy:
//start code
//--- Tim Attwood's random distribution macro ---
#macro RandOnSurface(Obj, rsd, thresh)
#local mn = min_extent(Obj)-thresh;
#local mx = max_extent(Obj)+thresh;
#local dist = 1000000;
#while (dist>thresh)
#local flag = 0;
#while (flag = 0)
#local rfrom = VRand_In_Box(mn, mx, rsd);
#local rdir = vrotate(<1,1,1>,
<360*rand(rsd),360*rand(rsd),360*rand(rsd)>);
#declare Norm = <0, 0, 0>;
#local hit = trace(Obj, rfrom, rdir, Norm);
#if (vlength(Norm) != 0)
#local flag = 1;
#end
#end
#local dist = vlength( hit - rfrom);
#end
#local result = hit;
(result)
#end
//end code
Thomas
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Dre
Subject: Re: Can you use the trace command on a heightfield?
Date: 11 Apr 2010 20:19:57
Message: <4bc2672d@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Warp" <war### [at] tag povray org> wrote in message
news:4bbebfde@news.povray.org...
> Dre <and### [at] gmail com> wrote:
>> No it parses correctly, however none of the intersections are correct,
>> they
>> are all either at <0, 0, 0> or some weird location.
>
> Because you are not shooting the rays towards <0, -1, 0>.
>
> --
> - Warp
I believe I am shooting them in that direction, they are starting at <x, 10,
z> and finishing at <x, -10, y>, thats towards <0, -1, 0> in my mind or am I
wrong here?
Cheers Dre
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Dre
Subject: Re: Can you use the trace command on a heightfield?
Date: 11 Apr 2010 20:21:52
Message: <4bc267a0@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Warp" <war### [at] tag povray org> wrote in message
news:4bbebfaf@news.povray.org...
> Dre <and### [at] gmail com> wrote:
>> "Warp" <war### [at] tag povray org> wrote in message
>> news:4bbda1be@news.povray.org...
>> > Dre <and### [at] gmail com> wrote:
>> >> Yet this does:
>> >
>> >> #declare norm = <0, 0, 0>;
>> >> #declare startPoint =<xPos, 10, zPos>;
>> >> #declare endPoint = <xPos, -10, zPos>;
>> >> trace(object, startPoint, endPoint, norm)
>> >
>> > I don't think it does (well, not in the way you want). The third
>> > parameter
>> > of trace() specifies a direction, not an endpoint.
>> >
>> > Probably you want the third parameter to be <0, -1, 0> because that's
>> > the direction you are shooting the rays towards.
>> >
>> > --
>> > - Warp
>
>> Well it does to what I want now that I changed the way I coded it to the
>> example above. I then modified the norm as you stated but it didn't make
>> any difference at all. Both my norm and yours are below my start point
>> so
>> they are essentially shooting the rays in the same direction.
>
> The normal is the *fourth* parameter. I was talking about the *third*
> parameter, which is the direction. That should be <0, -1, 0>.
>
> --
> - Warp
What difference does it make if its -1 or -10, they are both in the same
plane.
Or are you saying the 3rd parameters is a direction vector not a final end
point vector?
Cheers Dre
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Kenneth" <kdw### [at] earthlink net> wrote in message
news:web.4bbf648570f2d07d65f302820@news.povray.org...
> Warp <war### [at] tag povray org> wrote:
>> Dre <and### [at] gmail com> wrote:
>> > Yet this does:
>>
>> > #declare norm = <0, 0, 0>;
>> > #declare startPoint =<xPos, 10, zPos>;
>> > #declare endPoint = <xPos, -10, zPos>;
>> > trace(object, startPoint, endPoint, norm)
>>
>> I don't think it does (well, not in the way you want). The third
>> parameter
>> of trace() specifies a direction, not an endpoint.
>>
>> Probably you want the third parameter to be <0, -1, 0> because that's
>> the direction you are shooting the rays towards.
>>
>
> Warp's correct. (Also, I would assume that <0,-10,0> has the same
> directional
> effect as <0,-1,0> )
>
> There's a big difference between <xpos,-10,zPos> and <0,-10,0> as a
> *direction*
> vector. Let's say xPos=7 and zPos=5. That produces a *direction* of
> <7,-10,5>--which certainly isn't straight down. The trace rays are
> probably not
> even hitting the HF (and your placed object(s) are ending up at a <0,0,0>
> location by default, unless you're using Norm to 'stop' that in some way,
> which
> I assume you are.)
>
> As has been mentioned:
> * The trace ray 'start' location needs to be somewhere *above* the
> HF...obviously ;-) Personally, I would use <xPos,1000,zPos> to be safe.
> * the 'start' vector is an actual location point; the trace ray direction
> is a
> *directional* vector, NOT the location of a point, and shouldn't normally
> change--at least when tracing a HF.
>
> Ken
>
Thanks very much for the clarification. That clears things up completely :)
I was getting the third parameter wrong, I thought it was an end point
rather than a direction vector, I mentioned this in my reply to warp.
So much POV to learn, so little time!
Cheers Dre
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Dre" <and### [at] gmail com> wrote:
> So much POV to learn, so little time!
Not a day goes by that I don't learn something new as well, some new trick that
POV-Ray is capable of, or some new 'understanding.' The best way to learn
is...practice, practice, practice. ;-) And to read these newsgroups, of
course--they are a real fountain of knowledge.
I remember the trace command being difficult to fully understand as well, when I
first tried to use it. (In fact, a newsgroup query may have helped *me* at the
time.) And that Norm thing had me guessing too--until I finally
realized that the value (the vector) that's placed there--with #declare norm =
<0,0,0> --is just to set it up, as a kind of 'place-holder.' (In fact, the
vector can contain *any* three values.) Then, when trace() is used or called, it
RETURNS an *actual* vector (a directional vector again!) found at the traced
point, and loads it into 'norm', replacing the temporary values--which can then
be used elsewhere in the scene. The documentation describes some of this, but in
a roundabout way, not completely clear. (Which is unfortunate, because trace is
an *extremely* valuable and fun tool!) So don't feel bad about your temporary
lack of understanding.
Ken
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Warp
Subject: Re: Can you use the trace command on a heightfield?
Date: 12 Apr 2010 07:47:59
Message: <4bc3086f@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Dre <and### [at] gmail com> wrote:
> "Warp" <war### [at] tag povray org> wrote in message
> news:4bbebfde@news.povray.org...
> > Dre <and### [at] gmail com> wrote:
> >> No it parses correctly, however none of the intersections are correct,
> >> they
> >> are all either at <0, 0, 0> or some weird location.
> >
> > Because you are not shooting the rays towards <0, -1, 0>.
> >
> > --
> > - Warp
> I believe I am shooting them in that direction, they are starting at <x, 10,
> z> and finishing at <x, -10, y>, thats towards <0, -1, 0> in my mind or am I
> wrong here?
You are shooting them towards <x, -10, y>, not towards <0, -1, 0> because
that's what you are telling trace() to do.
You have to do it like this:
trace(TheObject, <X, 10, Z>, <0, -1, 0>, TheNormal)
--
- Warp
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Warp
Subject: Re: Can you use the trace command on a heightfield?
Date: 12 Apr 2010 07:48:49
Message: <4bc308a1@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Dre <and### [at] gmail com> wrote:
> > The normal is the *fourth* parameter. I was talking about the *third*
> > parameter, which is the direction. That should be <0, -1, 0>.
> >
> > --
> > - Warp
> What difference does it make if its -1 or -10, they are both in the same
> plane.
<X, -10, Z> is not the same thing as <0, -10, 0>.
> Or are you saying the 3rd parameters is a direction vector not a final end
> point vector?
It's a direction vector.
--
- Warp
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
> "Warp"<war### [at] tag povray org> wrote in message
> news:4bbebfde@news.povray.org...
>> Dre<and### [at] gmail com> wrote:
>>> No it parses correctly, however none of the intersections are correct,
>>> they
>>> are all either at<0, 0, 0> or some weird location.
>>
>> Because you are not shooting the rays towards<0, -1, 0>.
>>
>> --
>> - Warp
>
> I believe I am shooting them in that direction, they are starting at<x, 10,
> z> and finishing at<x, -10, y>, thats towards<0, -1, 0> in my mind or am I
> wrong here?
>
> Cheers Dre
>
>
You are wrong :(
If you start at <x,10,z> and have a direction of <x,-10,z>, then, you
shoot toward <x*2,0, z*2>.
Remember, the first value is the starting location.
The second value is a *direction* vector, it is ADDED to the start
location. If you use a /location/ your tracing rays will fan out.
The result is that most rays, about 75% if the hight_field is around the
X-Z plane, will totaly miss the hight_field. Any ray that don't hit the
target will return a location of <0,0,0> and a normal of <0,0,0>.
If the hight_field is a around -10*y, then only 1/16 trace will hit it,
at the wrong locations.
Alain
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |