-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Camera pan clips shadows? #3552
Description
I am trying to implement a simple 2D panning of the viewport by pre-multiplying the camera matrix with a translation; something like
auto cp = camera->getCullingProjectionMatrix();
math::mat4f trans(math::float4{1.0f, 0, 0, 0},
math::float4{0, 1.0f, 0, 0},
math::float4{0, 0, 1.0f, 0},
math::float4{pan.x, pan.y, 0, 1.0f} );
camera->setCustomProjection(trans * cp, camera_near, camera_far);
This pans the view fine, but it also clips shadows depending on how far I pan. Using getProjectionMatrix instead of getCullingProjectionMatrix does not change that.
Am I misunderstanding the logic or conventions followed in Filament for the camera matrix? I am doing something fairly similar in three.js, where it works as expected. Thanks!
(If there is a better way to pan the view then I'm all ears. Would like to avoid changing the viewport as it tends to be slower with three.js than changing the camera matrix, and would require me to change more backend code. In any case, I'd like to understand what I am doing wrong above).