Repository navigation
Conversation
The camera component (libossia 687133544e) carries a lens shift, an explicit off-axis frustum or a raw OpenGL projection matrix. cameraProjection() turns a component into score's reverse-Z projection, and scene flattening, the shadow cascades and packCameraUBO all go through it, so an orthographic glTF / FBX camera now also gives an orthographic legacy projection and orthographic cascade slices (they were always perspective). cameraFrustumTangents() gives a perspective camera's tangents (its frustum, or its FOV and shift at an aspect), and an unshifted FOV camera keeps its former matrix exactly. The Camera process takes, besides look-at and FOV: - a lens shift; - OpenCV intrinsics of an image size (positive focal lengths); - pose and projection matrices as text, written row by row as matrices are printed; a projection matrix reports its own near, far, vertical FOV and kind (an orthographic one is an orthographic camera); - a Screen mode: the Kooima frustum and orientation of a screen seen from the eye (Gfx/Calibration/OffAxis.hpp). A matrix that does not parse, a pose that is not affine, non-positive focal lengths or a degenerate screen fall back to look-at and FOV. The pose, target and planes are computed once per change, not per frame. The camera switch blends off-axis frusta as tangents; a FOV camera without an aspect of its own takes the frustum cameras' aspect, so a crossfade between a Screen camera and a FOV camera rendering to the same aspect does not jump. Raw matrices are blended only when every weighted camera has one. Tests: closed-form projections (shift, intrinsics against the OpenCV pinhole, raw matrices, the screen corners landing on the image corners), the fallbacks, the switch's blending, and shadow cascades fitted to an off-axis and to an orthographic camera (test_threedim_shadow_cascades now links score_plugin_gfx). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KdPgujQFUTMVZBdH6Hv7Vj
This branch is waiting to be deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
depends on: #2425, and libossia#995 (ossia/libossia#995)
The camera component can now describe what a calibrated projector or a viewer-tracked screen needs: a lens shift, an explicit off-axis frustum, or a raw OpenGL projection matrix. The component fields come from libossia#995. The gitlink here points at
687133544e, which is the same change applied on master's libossia9123607b46, and it will be repointed once #995 merges.cameraProjection()turns a component into score's reverse-Z projection. Scene flattening, the shadow cascades andpackCameraUBOall go through it. As a result, an orthographic glTF / FBX camera now also gives an orthographic legacy projection and orthographic cascade slices; they were always perspective before.cameraFrustumTangents()gives a perspective camera's tangents: from its frustum, or from its FOV and shift at a given aspect. An unshifted FOV camera keeps exactly the matrix it had before.The Camera process takes, besides look-at and FOV:
Gfx/Calibration/OffAxis.hpp, from Crash on drop of device in device explorer #11).A matrix that does not parse, a pose that is not affine, non-positive focal lengths, or a degenerate screen all fall back to look-at and FOV. The pose, target and planes are computed once per change, not per frame.
The camera switch blends off-axis frusta as tangents. A FOV camera without an aspect of its own takes the frustum cameras' aspect, so a crossfade between a Screen camera and a FOV camera rendering to the same aspect does not jump. Raw matrices are blended only when every weighted camera has one.
Commits
9c713152e7gfx, threedim: camera lens shift, off-axis frustum and raw projectionTests
test_threedim_camera_off_axis(tests/threedim/CameraOffAxis.cpp) checks closed-form projections: shift, intrinsics against the OpenCV pinhole, raw matrices in reverse-Z, the screen corners landing on the image corners, frustum tangents, OpenGL world-from-camera and view poses, the fallbacks (bad matrices and focal lengths, a screen behind the eye), and the camera switch blending without a jump.test_threedim_shadow_cascadesgains a case for cascades fitted to an off-axis and to an orthographic camera, and now linksscore_plugin_gfx.test_gfx_shader_corpus_targets,test_gfx_window_layout,test_threedim_ply_fingerprint,test_unit_miniaudio_alsaand the few others master's run lists).Notes for review
3rdparty/libossiahere to the merged commit before merging. The PR targetssplit/calibration-math, so GitHub will retarget it to master once Crash on drop of device in device explorer #11 merges.🤖 Generated with Claude Code
https://claude.ai/code/session_01KdPgujQFUTMVZBdH6Hv7Vj