{"id":16521944,"url":"https://github.com/meshula/labcamera","last_synced_at":"2025-03-16T19:31:04.567Z","repository":{"id":27660730,"uuid":"31146404","full_name":"meshula/LabCamera","owner":"meshula","description":"A physically based camera model for virtual production and computer graphics","archived":false,"fork":false,"pushed_at":"2023-12-11T19:17:29.000Z","size":2160,"stargazers_count":86,"open_issues_count":1,"forks_count":4,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-03-16T04:51:11.729Z","etag":null,"topics":["3d","camera","computer-graphics","math","realtime","render","vfx","virtual-production"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/meshula.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-02-22T00:06:28.000Z","updated_at":"2025-03-12T09:26:50.000Z","dependencies_parsed_at":"2024-10-27T11:22:11.015Z","dependency_job_id":null,"html_url":"https://github.com/meshula/LabCamera","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meshula%2FLabCamera","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meshula%2FLabCamera/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meshula%2FLabCamera/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meshula%2FLabCamera/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/meshula","download_url":"https://codeload.github.com/meshula/LabCamera/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243919964,"owners_count":20368971,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["3d","camera","computer-graphics","math","realtime","render","vfx","virtual-production"],"created_at":"2024-10-11T16:58:43.140Z","updated_at":"2025-03-16T19:31:04.243Z","avatar_url":"https://github.com/meshula.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LabCamera\n\nCopyright (c) 2013 Nick Porcino, All rights reserved.\n\nLicense is MIT: http://opensource.org/licenses/MIT\n\nVersion 1.0 alpha\n\nLabCamera has no external dependencies. Include LabCamera.cpp in your\nproject, and LabCamera.h in your include search path.\n\nThe camera is modeled as a set of elements, each with a distinct physical\nrole in the capture of an image. Each element is modeled by a struct, and\na camera struct is a composition of those elements.\n\nlc_mount describes the pose of the camera. The mount is really a virtual\nmount whose origin is at the lens' entrance pupil. It's up the\napplication to model a kinematic chain such as a tripod or boom arm. The\nrigid transform within the mount should be constrained to that kinematic\nchain.\n\nFollowing light from object in the world to sensor plane, the objects are:\n\n- lc_optics - a mathematical description of a simple lens\n- lc_aperture - the lens' exit pupil geometry\n- lc_sensor - geometry of the imaging plane\n\nLabCamera also provides an interactive controller that modifies camera\nparameters in response to various input signals. It provides popular\ncinematic and modeling controls: crane, dolly, tilt-pan, as well as\nturntable and arcball control.\n\nThe single stick interface responds to an x/y motion vector. This interface\ncan be used where the control is via mouse interaction with a single\nwidget, or drags in an rendered viewport.\n\nThe dual stick interface responds to x/y motion vectors assigned\nindependently to position and orientation. This interface can be used where\nthe control inputs come from a device like a gamepad.\n\nThe through-the-lens interface is meant for control via pointing in a\nrendered interactive view. Wherever possible, a location under a pointer\nwill remain under the pointer through the interaction. As a use case, the\npan-tilt interaction mode enables grabbing a visible feature in the image\nand pulling that feature to a desired location in image space.\n\nThe constrained through-the-lens control extends the through the lens\ninterface to keep a hit-tested object in world space under the cursor. As a\nuse case, the crane interaction mode enables clicking an object at an\narbitrary distance from the camera and moving the camera proportional to\nthe distance to maintain the click point under the cursor as it moves.\n\nLabCameraImgui is a convenient panel implementing various camera controls,\nincluding a lens kit.\n\nexamples/Navigator is a demo app demonstrating the use of LabCamera.\n\n_________\n\n## Goals\n\n### Modeling\n\n- Physical camera modeling of optics, aperture, sensor, and mount\n- Support for offset frustums for sensor shift and image tiling\n\n### Interaction\n\n- Cinematic interaction controls: pan, dolly, crane\n- Modeling controls: arcball and turntable\n- Through the lens and joystick style interaction\n\n### Convenience\n\n- Camera raycast helpers\n- Sample Dear Imgui camera control panel for easy drop in usage\n- Functions to create view and projection matrices\n\n### Implementation\n\n- No dependencies on a UI toolkit or graphics library or event model\n- Trivial math types compatible with other libraries via static casting or copy\n- No leakage of implementation details, including the math library\n\n_________\n\n## Model\n\n\nLabCamera models a physical camera.\n\n```Mount``` describes a camera's location and orientation in space, with the\norigin of its coordinate system on the sensor plane\n\n```Sensor``` describes the geometry of the sensor plane\n\n```Optics``` is at the moment a simple pinhole lens.\n\n```Camera``` composes a Mount, Sensor, and Optics.\n\n```PanTiltController``` manipulates position, azimuth, and declination controls\nto update the camera mount.\n\n________________________________________________________________________________\n\n\nLabCamera doesn't provide a math library, just these trivial types compatible\nwith almost any other library via static casting or copying.\n\n```\ntypedef struct { float x, y; }       lc_v2f;\ntypedef struct { float x, y, z; }    lc_v3f;\ntypedef struct { float x, y, z, w; } lc_v4f;\ntypedef struct { float x, y, z, w; } lc_quatf;\ntypedef struct { lc_v4f x; lc_v4f y; lc_v4f z; lc_v4f w; } lc_m44f;\ntypedef struct { lc_v3f pos; lc_v3f dir; } lc_ray;\n```\n\n________________________________________________________________________________\n\n```Mount``` is a nodal mount, centered on the camera's sensor.\nThe mount's transform is by default, left handed, y is up, -z is forward\n\n```Sensor``` describes the plane where an image is to be resolved.\nThe sensor's coordinate system has its center at (0, 0) and\nits bounds are -1 to 1.\nenlarge is a multiplicative value; and shift is an additive value\nin the sensor's coordinate system.\n\nShift and enlarge can be used to create projection matrices for\nsubregions of an image. For example, if the default Sensor is to be\nrendered as four tiles, a matrix for rendering the upper left quadrant\ncan be computed by setting enlarge to { 2, 2 }, and\nshift to millimeters{-17.5f}, millimeters{-12.25f}.\n\nThe default sensor aperture is as for 35mm DSLR.\n\n````Optics````\n\n A and B are on the sensor plane.\n\nThere is a point at infinity, O, on the axis of the lens, whose parallel rays\n    converge on B.\n````\n                                   a\n        ---------------------------+---------------+ A\n                                 b| |              |\n        O--------------------------+---------------+ B\n                                 c| |              |\n        ---------------------------+---------------+\n        infinity                 lens           sensor plane\n        C\n\n    h = A-B is half the sensor plane aperture.\n    f = b-B is the focal length\n````\n\nThere is a point C at infinity, whose parallel rays through a, b, and c,\nconverge on the edge of the sensor plane, at A.\n\nThe field of view of the lens, at infinity, can therefore be approximated by\n````fov = 2 atan((h/2) / f)````\n\nGiven a field of view, the assumption of a focus at infinity, and a sensor\naperture, the focal length may be calculated accordingly:\n\n````f = tan(fov/2) / (h/2)````\n\nan anamorphic lens' horizontal field of view must take squeeze into account:\n\n````fov = 2 atan((s * h/2) / f)````\n\nThe hyperfocal distance is useful for determining what ranges are in focus.\n\nIf a camera is focused at infinity, objects from the hyperfocal distance to\ninfinity are in focus.\n\n````\n    O----------------H----------------------------|\n    Infinity       hyperfocal distance         Sensor plane\n````\n\nIf a camera is focused at the hyperfocal distance, then objects from 1/2 H to\ninfinity are in focus.\n\n````\n    O----------------H----------H/2---------------|\n    Infinity       hyperfocal distance         Sensor plane\n````\n\nGiven a focus distance, and the hyperfocal distance, the in-focus range is\ngiven by\n\n````\n        Dn = hd / (h + (d - f))\n        Df = hd / (h - (d - f))\n````\n\nGiven a circle of confusion, such as 0.002mm as might be typical for 35mm film,\nthe hyperfocal distance can be determined.\n\n```h = f^2/(fstop * CoC)```\n\n````Camera````\n\n A Camera is comprised of a Mount, a Sensor, and Optics.\n\n````PanTiltController````\n\nImplements an interactive pan tilt controller\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeshula%2Flabcamera","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeshula%2Flabcamera","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeshula%2Flabcamera/lists"}