Hi,
I'm implementing the height field object to my ray tracer and reasoned that
I should use a line drawing algorithm to check the ray against exactly
those triangles which lie along its path. I chose the Bresenham's algorithm
because of its speed. It didn't quite work: there were holes in the height
field. After some thinking I realized that it is because the fractional
parts of the entry and exit coordinates (in "pixel" units) matter, and the
standard algorithm didn't take them into account. I'd like some hints on
how to do that. Perhaps calculating somehow an initial value for the
Bresenham's "error" variable? Or should I take an entirely different
approach?
I'll post an illustration of the problem to p.b.i shortly. It'll probably
be more descriptive than my text above ;).
-Johannes
Post a reply to this message
|