Hacker News new | ask | show | jobs
by ohwp 4588 days ago
For many year I also tried to build a simple ray tracer. The math got me to, but in the end I was able to write different types of render engines.

What helped me:

  learn about vectors
  learn about (vector) normalization
  learn about camera models http://www.ventrella.com/Ideas/Camera/Arm_Camera.pdf
  learn about pixels (pixels are just dots without size)
  use a 3D coordinate-system that works for you (mine is: x = right, y = forward, z = up)
  start with a simple camera model (always looking forward)
  normalize all direction vectors
  place the screen of pixels 1 unit in front of the camera
  normalize the screen of pixels
  know that the center pixel is on the forward vector of the camera
  try to calculate a vector from the camera position to the left top of the pixel screen in front of the camera