c++ - From pixel to world coordinate formula explanation -


i have following (relatively easy) problem. developing ray tracer , following tutorial explained in link:

http://www.scratchapixel.com/code.php?id=3&origin=/lessons/3d-basic-rendering/introduction-to-ray-tracing

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

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -