Results 1 to 3 of 3

Thread: Ray Tracer Equations

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2003
    Location
    Wichita, KS
    Posts
    4

    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.

  2. #2

    Thread Starter
    New Member
    Join Date
    Jul 2003
    Location
    Wichita, KS
    Posts
    4
    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.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2003
    Location
    Wichita, KS
    Posts
    4
    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
  •  



Click Here to Expand Forum to Full Width