mke@cseg.uucp (Mike K. Ellis) (02/17/89)
I need a good intersection algorithm for a ray tracing model. The algorithm should be able to handle spheres, boxes, and pyramids. I also need it to be very fast. Thanks in advance for any help or suggestions. - Mike Ellis
ingar@bibsyst.UUCP (ingar) (06/26/91)
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. They always end up looking like deformed spheres, a sphere with angels as a matter of fact. If i ray trace an object in a room the walls alway ends up in looking like "bowls". I have checked my types and they are all correct, and I have checked that all my vector lengths are correct. Does anybody have an idea of what I am doing wrong, except the fact that I started to make a ray traceing program?? Ingar Pedersen, PreIng. ingar@bibsyst.no
grahaf@otago.ac.nz (06/27/91)
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. They always end up looking like deformed > spheres, a sphere with angels as a matter of fact. If i ray trace an > object in a room the walls alway ends up in looking like "bowls". > I have checked my types and they are all correct, and I have checked > that all my vector lengths are correct. > > Does anybody have an idea of what I am doing wrong, except the fact > that I started to make a ray traceing program?? > Someone else had this problem and the answer posted was "You have a fish eye lens problem. Eye View Object plane This results in bent edges | /------/ | / / | | / / | / | |------| | \ | | | / | |______|/ | | Try this. View Object Eye plane | /------/ | / / | | / / | / | |------| | \ | | | / | |______|/ | | Hope this helps, Graham.
nwatson@ENUXHA.EAS.ASU.EDU (Nathan F. Watson) (06/27/91)
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. ^^^^^^ >Someone else had this problem and the answer posted was "You have a fish eye >lens problem. [ ... some diagrams suggesting that the original poster move the eye away from the viewing plane ... ] 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. The problem may be in computing the vector from the eye through a given pixel on the screen. An error in this computation would almost certainly map straight lines to curved lines. --------------------------------------------------------------------- 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
tmkk@uiuc.edu (K. Khan) (06/28/91)
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. They always end up looking like deformed >spheres, a sphere with angels as a matter of fact. If i ray trace an >object in a room the walls alway ends up in looking like "bowls". >I have checked my types and they are all correct, and I have checked >that all my vector lengths are correct. > >Does anybody have an idea of what I am doing wrong, except the fact >that I started to make a ray traceing program?? Here's a wild guess: check the focal length parameter in your projection formulas. Too short a focal length value will give a fish eye lens look to the scene, and cause the distortions you describe.
jk87377@cc.tut.fi (Juhana Kouhia) (06/28/91)
In article <1991Jun27.184538.6963@ux1.cso.uiuc.edu> tmkk@uiuc.edu (K. Khan) writes: > >Here's a wild guess: check the focal length parameter in your projection >formulas. Too short a focal length value will give a fish eye lens look >to the scene, and cause the distortions you describe. As somebody else mentioned this too and someone told the thruth that this is not true. Focal lenght (or distance of the image plane) doesn't distort straight lines; I did verify this mathematically. Hopefully I'm right; this indeed needs imagination to see the difference from the sphere distortion on the images. (Sphere's are ellipsoids.) Juhana Kouhia
jonas-y@isy.liu.se (Jonas Yngvesson) (06/28/91)
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 -- ------------------------------------------------------------------------------ J o n a s Y n g v e s s o n Dept. of Electrical Engineering jonas-y@isy.liu.se University of Linkoping, Sweden ...!uunet!isy.liu.se!jonas-y
chrisg@cbmvax.commodore.com (Chris Green) (06/29/91)
In article <1991Jun28.095138.3617@cc.tut.fi> jk87377@cc.tut.fi (Juhana Kouhia) writes: > >In article <1991Jun27.184538.6963@ux1.cso.uiuc.edu> tmkk@uiuc.edu (K. Khan) writes: >> >>Here's a wild guess: check the focal length parameter in your projection >>formulas. Too short a focal length value will give a fish eye lens look >>to the scene, and cause the distortions you describe. > Here's a wilder guess: You're not basing your ray directions on (shudder) ANGLES, are you? -- *-------------------------------------------*---------------------------* |Chris Green - Graphics Software Engineer - chrisg@commodore.COM f | Commodore-Amiga - uunet!cbmvax!chrisg n |My opinions are my own, and do not - killyouridolssonicdeath o |necessarily represent those of my employer.- itstheendoftheworld r *-------------------------------------------*---------------------------d
nwatson@ENUXHA.EAS.ASU.EDU (Nathan F. Watson) (06/30/91)
In article <jonas-y.678121618@isy.liu.se> 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