Skip to content

Conversation

@mnmly
Copy link

@mnmly mnmly commented Oct 28, 2025

Implements lens shift support for PerspectiveCamera.

Changes to PerspectiveCamera

  • New properties:

    • lensShiftX: Horizontal lens shift parameter (normalised units)
    • lensShiftY: Vertical lens shift parameter (normalised units)
    • enableFrustumShift: Toggle to enable/disable frustum shift calculation
  • Core functionality:

    • Implemented frustumShiftPerspectiveMatrixf() in SatinCore to compute off-axis projection matrices
    • Updated projection matrix getter to conditionally use frustum shift when enabled
    • Added lens shift extraction from existing projection matrices in the setter
  • Helper methods:

    • setLensShift(_:_:): Convenience method to set both shift values and auto-enable
    • resetLensShift(): Resets shift values and disables frustum shift
  • Serialisation:

    • Added Codable support for the new properties with backward compatibility

(Ideally I want to have an equivalent implementation to what THREE.js offers with PerpsectiveCamera.setViewOffset. But for now, lets start at minimum...)

@vade
Copy link

vade commented Dec 9, 2025

Hey! I apprear to have had somehow a bad github notification setup on Satin ! Apologies for only seeing this now, this is super interesting - ill review tomorrow - much appreciated and apologies!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants