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

Confusing camera view definion #6091

Closed
MillionIntegrals opened this issue Sep 25, 2022 · 3 comments
Closed

Confusing camera view definion #6091

MillionIntegrals opened this issue Sep 25, 2022 · 3 comments
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior C-Code-Quality A section of code that is hard to understand or change

Comments

@MillionIntegrals
Copy link

MillionIntegrals commented Sep 25, 2022

Bevy version

0.8.1

What you did

I was working on my own camera system for bevy for a couple days and for the last three I got very confused about how does view matrix work in bevy - because many results that I was getting were rather unintuitive to me.

I'm quite new to the source code of bevy, therefore it took me a while to even find the place where camera matrix got uploaded to the uniform buffer, but once I found it, the source of my confusion became quite apparent:

The view_proj definition of the uniform buffer loads an inverse of a view matrix here:

view_proj: projection * inverse_view,

while the view part of ViewUniform actually loads the view matrix itself. At least one of those should be fixed and ideally naming around it could be clarified.

In terms of functionality, I think that view_proj is calculated correctly, but it isn't the inverse of a view matrix there but instead it's the "inverse of global transform on camera" is the view matrix.

And I think that view and inverse_view fields of ViewUniform are actually populated incorrectly. I've looked at the shaders briefly and didn't see those used anywhere - so it's likely that this bug hasn't manifested itself yet.

@MillionIntegrals MillionIntegrals added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Sep 25, 2022
@MillionIntegrals MillionIntegrals changed the title Very confusing camera view definion Confusing camera view definion Sep 25, 2022
@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen C-Code-Quality A section of code that is hard to understand or change and removed S-Needs-Triage This issue needs to be labelled labels Sep 26, 2022
@alice-i-cecile
Copy link
Member

Ping @superdump.

@MillionIntegrals
Copy link
Author

I've also found somewhat relevant conversation on the topic here: #5750

@janhohenheim
Copy link
Member

This may or may not have been fixed by #13489

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior C-Code-Quality A section of code that is hard to understand or change
Projects
None yet
Development

No branches or pull requests

3 participants