Calculating initial ray direction