Path: utzoo!attcan!uunet!cbmvax!steveb From: steveb@cbmvax.UUCP (Steve Beats) Newsgroups: comp.graphics Subject: Re: raytracing in || Message-ID: <5263@cbmvax.UUCP> Date: 18 Nov 88 14:47:30 GMT References: <9700001@datacube> <3148@uoregon.uoregon.edu> <1351@umbc3.UMD.EDU> Reply-To: steveb@cbmvax.UUCP (Steve Beats) Organization: Commodore Technology, West Chester, PA Lines: 32 In article <1351@umbc3.UMD.EDU> bodarky@umbc3.UMD.EDU (Scott Bodarky) writes: > >[stuff about transputer raytracing deleted] > >1) Given a pixel on the screen, there are an infinite number of light > rays that might hit it. Does one only calculate the ray perpendicular > to the screen, or is that insufficient? How many rays does one > calculate? > Generally, you will take a ray from the viewpoint and cast it through the relevant pixel on your view plane (screen). If your view is anything other than perpendicular to an axis (and passing through the origin) you will have to perform some transformations to make the calculation of the ray direction a little simpler. Foley and Van Dam suggest rotating and transforming the whole scene from world co-ordinates to image (view) co-ordinates. This works quite well. If you sample the scene using one pixel per ray, you will get pretty severe aliasing at high contrast boundaries. One trick is to sample at twice the vertical and horizontal resolution (yielding 4 rays per pixel) and average the resultant intensities. This is a pretty effective method of anti-aliasing. Of course, there's nothing to stop you using 8 or 16 rays per pixel, but this gets very expensive in terms of CPU time. >2) From an intersection point, one sends a test ray directly at the light > sources to test for objects that might cast shadows. What if you > are on the far side of an object from a light source? > Providing you are not working with transparent objects, just take the dot product of the surface normal and the vector to the light source. Negative and positive values determine whether the surface is facing away or towards the light source. Steve