|
![](/i/fill.gif) |
Peter Popov wrote:
>
> Please... anyone!
I looked slightly code and here are my comments. If I have time, then I
try to look it more.
> What I know for the moment is that:
>
> a) boxes don't render properly. The intersection routine correctly
> identifies if a ray intersects a box but returns the wrong depth
>
> b) spheres don't transform at all
Seems like you use one transformation for points, vectors and normals,
but they should be transformed differently. Look POV-Ray source for
details. Generally when transforming vectors, then translations should
not be taken into account and normals should be transformed by inverse
transpose matrix. I guess that this is problem: in CSphere::Intersection
you transform TDirection and
Other problem, which I found, is in transformation code: e.g. in method
CVector::VInverseTransform you modify first x value of vector, then use
this modified value to calculate y and then use modified x and y to
calculate z. This leads to wrong result, of course. Instead you should
cache current values for x, y and z and then calculate new values by
using these cached values.
Correct these errors and I guess that most transformation problems will
disappear.
HTH,
Vahur
Post a reply to this message
|
![](/i/fill.gif) |