Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera: Add code to update View and Projection Matrices in update function #13552

Merged
merged 2 commits into from
Feb 22, 2023

Conversation

PolygonalSun
Copy link
Contributor

@PolygonalSun PolygonalSun commented Feb 21, 2023

A user on the forums had recently found an issue when performing input while using an on-demand rendering loop. The issue was that the onViewMatrixChangedObservable wasn't firing as a part of pointer input. This behavior was present in previous versions. It was determined that the Lazy Picking changes may have caused this change because the aforementioned observable only fires during getViewMatrix() calls. Before the Lazy Picking implementation, this function was called as a part of the creation and assignment of the picking ray for a PickingInfo object. Since this ray is only created when picking happens, a pointer event that doesn't require picking info won't ever get to the point where getViewMatrix is called. Technically, these get functions should be called as a part of the camera's update function so the fix is to do just that.

Tests have been added to verify that onViewMatrixObservable and onProjectionMatrixObservable are firing properly.

Forum Link: https://forum.babylonjs.com/t/on-demand-rendering-solution-broken-since-5-29/36379/1
Issue Link: #13551

@bjsplat
Copy link
Collaborator

bjsplat commented Feb 21, 2023

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@bjsplat
Copy link
Collaborator

bjsplat commented Feb 21, 2023

@bghgary
Copy link
Contributor

bghgary commented Feb 21, 2023

  • Are there any performance implications with this?
  • Should we add tests for this?

@PolygonalSun
Copy link
Contributor Author

PolygonalSun commented Feb 22, 2023

  • Are there any performance implications with this?

This shouldn't have any significant perf impacts. Worst case scenario is that we have a couple more if statement evals during a frame's lifespan

  • Should we add tests for this?

I'm not sure that we can write tests any of the get*Matrix() calls but I am in the process of writing tests to verify that the observables are firing.

@PolygonalSun PolygonalSun marked this pull request as ready for review February 22, 2023 17:43
@sebavan sebavan merged commit c3104d1 into BabylonJS:master Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants