You want a 45 fov and 1 aspect ratio this means that the focal length f
is
f = (w/2) / tan(45/2) = (h/2) / tan(45/2)
where w
and h
are the width and height of your film plane.
If your plane is normalized (in [-1,1]^2) f
is simply:
f = 1/tan(45/2)
In a right handed coordinate system your ray origin will be (0,0,f)
.
The camera is independent from the focal length. You can transform your ray in world space by the camera transformation or transform your world in camera space with the inverse of the camera.