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

Fixing issues with LookAt cameras #638

Merged
merged 1 commit into from
Nov 20, 2023

Conversation

davesmith00000
Copy link
Member

@davesmith00000 davesmith00000 commented Nov 20, 2023

I started this work to fix #622, as reported by @Akkete. This was a graphical glitch that showed gaps between clone tiles when using a look-at camera.

As expected, the issue was simply a rounding error which I replicated in the test scene in this PR, and then fixed.

However, while I was doing that I also noticed that LookAt camera's were behaving weirdly when you have different levels of magnification going. Essentially, layers are all rendered at 1:1 and then stretched up to the right size (this helps give nice crisp pixels and reduce's rendering requirements quadratically) and so the projection matrices were being calculated with a magnification of 1 irrespective of what the layer / scene update fragment had to say. This works fine for fixed cameras, but look-at camera's need the real magnification for their matrix calculations.

No doubt this just slipped the testing net in days of old, and I haven't used a look-at camera since. It happens. 😬

I've fixed both issues at once, and tested this in a variety of combinations (this time...), including WebGL 1. The solution is a bit... ugly. The CameraHelper should probably be refactored. It currently manages to produce the projection matrix for several possible scenario's at once, and is a bit spaghetti-like... but it works.

@davesmith00000 davesmith00000 requested a review from a team November 20, 2023 00:45
@davesmith00000 davesmith00000 self-assigned this Nov 20, 2023
@davesmith00000 davesmith00000 merged commit 1c62788 into main Nov 20, 2023
2 checks passed
@davesmith00000 davesmith00000 deleted the issue/622/lookat-camera-issues branch November 20, 2023 08:52
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.

Graphical glitch with cropped clonetiles and camera when height is odd
1 participant