|
![](/i/fill.gif) |
Ron Parker wrote:
>
> You could use a kd-tree, but if you manage to implement one in POV
> code - particularly one that handles dynamic insertions gracefully -
> you're a better man than I. I have a couple questions on your use of
> trace(), though. First, what do you do if you have two intersections
> along one traced ray?
Each axis in each cell is only tested once. If an intersection is found a
proximity test is conducted; the script then moves on to the next axis/cell
whether or not a light was created. I think this is sufficient: if more
precision is required, a higher division rate should be set.
> Second, wouldn't it be faster to just trace the
> four corner-to-corner rays, especially in the cases where it doesn't
> hit anything?
I'm not sure. The problem is that this would create errors in extreme cases (for
ex. tracing a box), when the object is tangent to some cells, but doesn't
intersect them. Secondly, I would need to allow 2 light sources per axis (for
ex. to get symmetrical distribution on a cylinder that is divided only 1X along
the length) - or double the division rate.
My current method allows only 1 light per axis. The coordinates of all light
sources are stored in an array (array[Axis][CellX][CellY][CellZ]); so it is easy
to fetch the coordinates of a light on a particular axis in a particular cell
and compare it with the current intersection point. With 2 lights possible on an
axis, the array would need to be given another dimension or something... I need
to think about this.
>
> Do you currently ignore cells whose closest point is further than
> the closest one found so far?
No. But if I'm not mistaken, I would still have to check the distance between
the current intersection point and the closest point of the adjacent cell? If
so, this would give me no advantage.
> Ditto if those cells are further than the
> minimum distance to make then "too close."
The cells are not necessarily cube-shaped, this makes things more difficult.
Btw, I'll check tomorrow as to what is a "kd-tree" - and if I can make it handle
those dynamic intersections gracefully in POV code ;)
Thanks
Margus
Post a reply to this message
|
![](/i/fill.gif) |