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

Make viewport grid visible on all three planes in orthogonal camera view #93869

Merged
merged 1 commit into from
Aug 16, 2024

Conversation

MajorMcDoom
Copy link
Contributor

@MajorMcDoom MajorMcDoom commented Jul 2, 2024

This PR makes it so that grid visibility is only determined on a per-plane basis in perspective viewports. The rationale is that specifying per-plane grid visibility serves primarily to prevent the rendering of multiple grids that you don't need overlayed on top of each other in perspective mode, like this:
Screenshot 2024-07-02 124528
That is, it only makes sense in an environment where there at least exists the possibility of multiple grids being visible.

In ortho view, only one grid is ever visible. And its visibility is already controllable via two other visibility toggles in the viewport menu and in the view menu. It is even bound to a hotkey.

On the other hand, 3D devs often need grids the ortho views to align or measure. In its current state, Godot doesn't let you see the grid in ortho side view or ortho front view, unless it's also always visible in perspective view, even though you might only want a ground plane to be visible in perspective view. This workflow is extremely tedious, and there is no quick toggle that can address that.

This PR makes it so the existing editor settings for per-plane grid visibility essentially become perspective-view-only settings. The ortho view grid visibility would be determined exclusively via the view options. This should have zero to minimal impact on existing ortho-centric workflows. This behaviour is also consistent with other 3D tools and engines.
grids

However, in the long run, we should really make the editor render a grid per-viewport. Right now, there is one grid instantiated, and in the 4-view layout, its properties are being determined entirely by the primary (top-left) viewport. But that is another bug for another PR.

@MajorMcDoom MajorMcDoom requested review from a team as code owners July 2, 2024 18:08
@Mickeon Mickeon added this to the 4.x milestone Jul 2, 2024
Copy link
Contributor

@Mickeon Mickeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation is much better and the rationale makes sense to the (not so savvy) me.

@fire fire requested a review from a team July 2, 2024 23:00
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally, it works as expected.

Grid appearance is a bit strange when rotating the view in orthogonal mode though: the X/Y and Y/Z planes remain visible without any rotation even when the camera is slightly offset from the axis. This is not an issue introduced by this PR, but it'll become more noticeable since it'll be shown by default.

ortho_grid.mp4

@MajorMcDoom
Copy link
Contributor Author

MajorMcDoom commented Jul 3, 2024

Tested locally, it works as expected.

Grid appearance is a bit strange when rotating the view in orthogonal mode though: the X/Y and Y/Z planes remain visible without any rotation even when the camera is slightly offset from the axis. This is not an issue introduced by this PR, but it'll become more noticeable since it'll be shown by default.

ortho_grid.mp4

It looks unintuitive, but it is actually displaying correctly. I think? Lol it depends on how the viewport math is being handled.

The way I'm interpreting this is, when one of the axes is pretty much pointing toward the screen, the grid is parallel enough to the screen to render, and looks unrotated. However, because it's Ortho, the axis that's pointing at the screen looks like it's going diagonal (it always will unless perfectly perpendicular). This trips up our brain because it looks like the whole world is rotating while the grid isn't. But in reality it's barely rotating at all, and the effect is only noticeable in perspective.

Copy link
Member

@aaronfranke aaronfranke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this. I introduced those editor settings bools years ago, but yeah it makes sense to always have it enabled in ortho view.

@MajorMcDoom
Copy link
Contributor Author

Hi y'all, is this still waiting on something? Can we merge it?

@akien-mga akien-mga modified the milestones: 4.x, 4.4 Aug 16, 2024
@akien-mga akien-mga merged commit f02e89b into godotengine:master Aug 16, 2024
18 checks passed
@akien-mga
Copy link
Member

Thanks!

@akien-mga akien-mga changed the title Make viewport grid visible on all three planes in ortho camera view Make viewport grid visible on all three planes in orthogonal camera view Aug 26, 2024
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.

6 participants