In ray-tracing technique critical point is to calculate rays which came out from eye $E$ to target $T$ through pixel $P_{ij}$ on viewport. The "viewport" is represented as rectangle divided to square pixels - this rectangle is perpendicular to line which go through points $E$, $C$ (viewport center) and $T$. The ray (red line on image) is represented by point $E$ and unit vector $r_{ij}$ (not shown in picture but it lay on red line) - below is picture which show "geometry" - but what are the formulas to calculate $r_{ij}$?
The given input values are:
- eye position $E$,
- target position $T$,
- field of view $\theta$ (angle, for human eye $\approx 90^\circ$),
- number of square pixels $k$ (horizontal direction) and $m$ (vertical direction).
- we also know vertical $w$ vector usually equal to $w=[wx,wy,wz]=[0,1,0]$ (not shown on picture) which indicate where is up and where is down
The orthogonal vectors $v$ and $b$ (and $t$) on picture are determined by $w$ and $t=T-E$ and maybe will useful in $r_{ij}$ calculations. The $d$ and pixel size is arbitrary and don't change the result because of fixed $\theta$.
Question: How to calculate unit vector $r_{ij}$ knowing input values described above?
