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

Backdrop : Improve ordering of nested backdrops #5596

Merged
merged 2 commits into from
Jan 2, 2024

Conversation

johnhaddon
Copy link
Member

We now automatically draw larger backdrops behind smaller ones, so that nested backdrops "just work". An additional depth plug allows the user to override this in rare cases where they want a smaller backdrop to appear beneath a larger one.

Peek 2023-12-19 14-37

Copy link
Contributor

@murraystevenson murraystevenson left a comment

Choose a reason for hiding this comment

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

Thanks John! I'll leave the maths to Daniel, but from a user perspective this seems to nicely walk the line of "smart enough to automatically do what I want in the majority of cases, while providing just enough control to allow me to get out of ambiguous situations of my own making".

I went through the carefully constructed backdrops of Gaffer's examples to check for regressions. Everything worked as expected for the most part, but it did highlight a couple of issues that I've commented inline...

src/GafferUI/BackdropNodeGadget.cpp Show resolved Hide resolved
src/GafferUI/BackdropNodeGadget.cpp Outdated Show resolved Hide resolved
@danieldresser-ie
Copy link
Contributor

Code all looks reasonable to me - Murray seems to have done a good job of catching weird cases interactively.

Do we have a quick way of disabling depth write for pixels with zero alpha, so the text just has super ugly edges, instead of being surrounded by a gray box?

@johnhaddon
Copy link
Member Author

Thanks for the reviews - I've pushed a couple of commits that hopefully get this into a reasonable place.

Copy link
Contributor

@murraystevenson murraystevenson left a comment

Choose a reason for hiding this comment

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

Fixes look good to me, thanks!

I do wonder if we shouldn't just be refusing to render text outside the backdrop, but maybe that's best left for another time.

Yeah, maybe we consider that at the same time as tackling more advanced text layout for backdrops...

We now automatically draw larger backdrops behind smaller ones, so that nested backdrops "just work". An additional `depth` plug allows the user to override this in rare cases where they want a smaller backdrop to appear beneath a larger one.
We were already trying to discard fragments with zero alpha so that they don't affect selection hits. But we were doing that before taking the texture alpha into account. Although the original motivation was selection hits, discarding zero alpha also avoids depth buffer writes, which is important now that Backdrops use depth buffering to control the order of nesting.
@johnhaddon
Copy link
Member Author

Rebased to squash fixup in - merging.

@johnhaddon johnhaddon merged commit 8f8f992 into GafferHQ:main Jan 2, 2024
4 checks passed
@johnhaddon johnhaddon deleted the backdropDepth branch March 15, 2024 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants