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

[3.x] Add options for sorting transparent objects #63040

Merged
merged 1 commit into from
Aug 30, 2022

Conversation

QbieShay
Copy link
Contributor

@QbieShay QbieShay commented Jul 15, 2022

This commit adds two properties to visual instance:

  • sorting_use_aabb_center default to true, use the aabb center for sorting. if set to false, it uses the origin (pivot) of the object insted.
  • sorting_offset a float value that will change the depth that is assigned to the object in the transparent queue.

This is especially useful for VFX where there are a lot of particle systems on top of each other, giving artists the full control over the ordering of particles within the same vfx, since godot has no concept of a vfx. (this can't be done with render priority, see: godotengine/godot-proposals#4099 )

I'd love to port this to 4.x but I will need someone's help to figure out where i should touch the renderer.

Video of the new behaviour https/giant.gfycat.com/MetallicTenderFlounder.mp4

This work was kindly sponsored by Pahdo Labs

@QbieShay QbieShay requested review from a team as code owners July 15, 2022 15:53
@Calinou Calinou added this to the 4.0 milestone Jul 15, 2022
@YuriSizov YuriSizov modified the milestones: 4.0, 3.x Jul 15, 2022
Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

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

@reduz approved the feature in PR meeting but wants it checked in depth by @godotengine/rendering folks.

@akien-mga
Copy link
Member

You should also add documentation for the new properties: https://docs.godotengine.org/en/latest/community/contributing/updating_the_class_reference.html

@akien-mga akien-mga changed the title added options for sorting transparent objects [3.x] added options for sorting transparent objects Jul 19, 2022
@akien-mga akien-mga added the cherrypick:3.5 Considered for cherry-picking into a future 3.5.x release label Jul 19, 2022
@clayjohn clayjohn modified the milestones: 3.x, 3.6 Aug 2, 2022
Copy link
Member

@clayjohn clayjohn left a comment

Choose a reason for hiding this comment

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

Looks good to me subject to Akien's comments and my one comment and adding docs

servers/visual/visual_server_scene.cpp Outdated Show resolved Hide resolved
Copy link
Member

@clayjohn clayjohn left a comment

Choose a reason for hiding this comment

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

Great work! This is going to be super useful for many people :)

Comment on lines 232 to 235
sorting_use_aabb_center = true;
sorting_offset = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

More of a nitpick in 3.x, but it's preferred to define the default values in the header instead of the constructor. This should definitely be the case in the master version, if there is one.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah for 3.x I let this go through as this is actually more consistent, since we didn't port most of the codebase.

@YuriSizov
Copy link
Contributor

Left a few notes, most are nitpicks, but the docs have some confusing wording worth correcting before merging.

Co-authored-by: Rémi Verschelde <[email protected]>
Co-authored-by: Clay John <[email protected]>
@YuriSizov YuriSizov merged commit 373a67b into godotengine:3.x Aug 30, 2022
@YuriSizov
Copy link
Contributor

Thanks, everyone! Let's make the master version though :)

Razoric480 pushed a commit to pahdolabs/godot that referenced this pull request Sep 20, 2022
[3.x] added options for sorting transparent objects
Razoric480 pushed a commit to pahdolabs/godot that referenced this pull request Oct 24, 2022
[3.x] added options for sorting transparent objects
@timothyqiu
Copy link
Member

Cherry-picked for 3.5.2

@timothyqiu timothyqiu removed the cherrypick:3.5 Considered for cherry-picking into a future 3.5.x release label Dec 12, 2022
akien-mga added a commit that referenced this pull request Dec 23, 2022
Added options for sorting transparent objects (port of PR #63040)
@akien-mga akien-mga changed the title [3.x] added options for sorting transparent objects [3.x] Add options for sorting transparent objects Sep 9, 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.

8 participants