Xref: utzoo comp.sources.wanted:17318 comp.graphics:18922 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ucbvax!ENUXHA.EAS.ASU.EDU!nwatson From: nwatson@ENUXHA.EAS.ASU.EDU (Nathan F. Watson) Newsgroups: comp.sources.wanted,comp.graphics Subject: Re: Ray tracing Message-ID: <9106292058.AA21059@enuxha.eas.asu.edu> Date: 29 Jun 91 20:58:28 GMT References: <383@bibsyst.UUCP> <1991Jun27.155718.625@otago.ac.nz> <9106271635.AA21398@enuxha.eas.asu.edu> Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: nwatson@enuxha.eas.asu.edu (Nathan F. Watson) Organization: Arizona State University Lines: 69 In article jonas-y@isy.liu.se (Jonas Yngvesson) writes: >nwatson@ENUXHA.EAS.ASU.EDU (Nathan F. Watson) writes: > >>In article <1991Jun27.155718.625@otago.ac.nz> grahaf@otago.ac.nz writes: >>>In article <383@bibsyst.UUCP>, ingar@bibsyst.UUCP (ingar) writes: >>>> I'm not sure i made myself clear the last time so I try again. >>>> >>>> In my ray tracing program I am not able to ray trace cubes, or anything >>>> that contains a strait line. >> ^^^^^^ > >>The proposed solution involves diminishing the field-of-view angle by >>moving the eye away from the viewing plane. I do not believe this will >>work as any projection of a straight line (or boundary between polygonal >>patches) will be mapped to a straight line on the viewing plane (and >>screen) no matter how close to the viewing plane the eye happens to be. >>Since the original poster states that straight lines are curved, the >>field-of-view angle is not the problem. > >Yes it is, sort of. The problem is that you assume that the distance from the >viewpoint to the viewplane is constant over the whole image. This is of course >not the case, the distance are bigger in the corners than in the middle. If >the viewpoint is close to the viewplane the relative difference is quite large >and straight lines *will* map to curves. Moving the viewpoint away from the >viewplane makes the relative difference smaller. Straight lines still maps >into curves, but the curvature is usually so small that you can't see >it. > >--Jonas Well, as I (nwatson@enuxha) said later in my posting, the original problem may be related to calculating the original vector from the eye passing through a particular pixel. When I wrote my ray tracer, I computed the vector from the eye to the viewing plane pixel and then normalized it before tracing the ray. The approach worked accurately (there may be a more efficient way to do it than I did) and preserved straight lines, no matter what the field-of-view angle was. I am not sure whether your phrase "... assume that the distance from the viewpoint to the viewplane is constant ..." refers to me or the original poster. In any case, I never made said assumption, and said assumption should never be made, unless for special effects. To drive home the point that projected lines are never distorted into curves, you may use some elementary geometry. The set of rays that pass through the eye point and the points of the world-space line are in a single plane. The intersection of that plane with the viewing plane is a straight line. Excuse my pedanticism. --------------------------------------------------------------------- Nathan F. Watson Arizona State University nwatson@enuxha.eas.asu.edu Computer Science Department "Remember: No matter where you go, there you are." - Mr. B. Banzai