c++ - From pixel to world coordinate formula explanation -
i have following (relatively easy) problem. developing ray tracer , following tutorial explained in link:
there formula don't though, used map pixel (i,j) world coordinates. formula following:
float fov = 30, aspectratio = width / height; float angle = tan(m_pi * 0.5 * fov / 180.); float xx = (2 * ((x + 0.5) * invwidth) - 1) * angle * aspectratio; float yy = (1 - 2 * ((y + 0.5) * invheight)) * angle;
in tutorial camera placed @ (0,0,0) , up/right/lookat vector not used @ all. seems in every tutorial different formula used map pixel , don't manage reason. moreover, if camera not placed @ (0,0,0) in position can decide? how formula vary? may kindly me? thanks!
http://scratchapixel.com/lessons/3d-basic-rendering/3d-viewing-pinhole-camera
if had made more research on website have found answer. whole point of website explain sort of technique. please make effort before expecting on answer you. question should heavily down voted. pure lazyness.
Comments
Post a Comment