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

Sort decals and lights based on camera origin #71709

Merged
merged 1 commit into from
Jan 20, 2023

Conversation

clayjohn
Copy link
Member

Also implement sort_offset for decals

Fixes: #49639
Supersedes: #60253
Follow up to: #69998

Primarily this PR is about ensuring that decals and lights do not change their calculated distance when the camera rotates. For both this is important if distance fade is enabled. For decals, this is important so decals do not flicker in and out when the camera rotates.

To fix decals changing sort order when the camera moves I have extended the sort-offset to decals.

In the sorting code for both I have removed redundancy and avoided calculating distance more than necessary.

Finally, this PR also hides the sorting properties from most VisualInstance3D-derived types as only GeometryInstances and decals can use them. And Decals can only use sort-offset.

Copy link
Contributor

@BastiaanOlij BastiaanOlij 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

Also implement sort_offset for decals

Co-authored-by: Hugo Locurcio <[email protected]>
@clayjohn clayjohn force-pushed the decals-lights-sorting branch from 717072a to 49bebf2 Compare January 20, 2023 17:58
@clayjohn clayjohn requested a review from a team as a code owner January 20, 2023 17:58
@clayjohn
Copy link
Member Author

Pushed the requested changes. Should be good now

@akien-mga akien-mga merged commit d5838a0 into godotengine:master Jan 20, 2023
@akien-mga
Copy link
Member

Thanks!

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.

Vulkan: Decal sorting changes unexpectedly depending on camera rotation
3 participants