POV-Ray : Newsgroups : povray.programming : OT - need help tracking a (few) bug(s) in my little raytracer (C++) : Re: OT - need help tracking a (few) bug(s) in my little raytracer (C++) Server Time
28 Jul 2024 12:31:20 EDT (-0400)
  Re: OT - need help tracking a (few) bug(s) in my little raytracer (C++)  
From: Vahur Krouverk
Date: 8 Aug 2001 14:09:48
Message: <3B71815D.7A76741D@comtrade.ee>
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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.