|
-
Jul 15th, 2003, 06:54 PM
#1
Thread Starter
New Member
Ray Tracer Equations
Given:
eye is at (x,y,z)
SphereA is at (Sx,Sy,Sz)
Radius = 3
Screen is set up as shown:
(TopLeft) (WidthVector)
0------------------------------------>
|
|
|(HeightVector)
|
|
|
V
TopLeft is (Cx,Cy,Cz)
WidthVector is [Wx,Wy,Wz]
heightVector is [Hx,Hy,Hz]
For each Pixel on the screen is an ordered pair (w,v)
where w numbers each horizontal pixel
and v numbers the verticle ones.
Show me an equation for the shortest distance to the sphere
for a ray coming from the eye through the
correlating spot on the view plane for every pixel.
If there is no intersection this should result in division by zero.
Good Luck
There are 10 types of people out there: Those who know binary and those that dont.
-
Jul 15th, 2003, 09:44 PM
#2
Thread Starter
New Member
Come on!
Is nobody interested??
Surely this cant be too difficult. i did this in QBASIC as a Freshman in highschool.
There are 10 types of people out there: Those who know binary and those that dont.
-
Jul 16th, 2003, 08:46 AM
#3
Thread Starter
New Member
The first step is to find the point on the view plane that corresponds to the ordered pair (w,v)
this is easy:
(assuming 800 by 600 screen rez.)
ViewX = TopLeft.x + (WidthVector.x * w/800) + (HeightVector.x * v/600)
ViewY = TopLeft.y + (WidthVector.y * w/800) + (HeightVector.y * v/600)
ViewZ = TopLeft.z + (WidthVector.z * w/800) + (HeightVector.z * v/600)
The point is (ViewX, ViewY, ViewZ)
There are 10 types of people out there: Those who know binary and those that dont.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|