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

Vulkan: Decal sorting changes unexpectedly depending on camera rotation #49639

Closed
Tracked by #57284
Calinou opened this issue Jun 16, 2021 · 5 comments · Fixed by #71709
Closed
Tracked by #57284

Vulkan: Decal sorting changes unexpectedly depending on camera rotation #49639

Calinou opened this issue Jun 16, 2021 · 5 comments · Fixed by #71709

Comments

@Calinou
Copy link
Member

Calinou commented Jun 16, 2021

Godot version

4.0.dev (6d98f84)

System information

Fedora 34, GeForce GTX 1080 (NVIDIA 465.31)

Issue description

The new Decal node exhibits sorting issues when the camera moves or rotates. This can be seen both in the editor and in running projects:

decal_sorting.mp4

I'm not sure how we should prevent this. We may not be able to rely on scene tree order because decals may be created with a lower-level API that does not use nodes. Maybe we could have a Render Priority property in the Decal node, so that users can force specific decals to render on top of others.

Steps to reproduce

  • Add 2 Decal nodes partially overlapping each other, with a different appearance (e.g. different Modulate property).
  • Rotate the camera. Moving the camera alone does not seem to cause sorting issues, but rotating the camera will.

Minimal reproduction project

test_decal_sorting.zip

@clayjohn
Copy link
Member

I've noticed this issue as well. It looks like we may need to add some additional sorting to decals, however, any additional sort operation is likely to be quite expensive when you have many decals in a scene.

Does the issue remain if you move each decal slightly up or down on the global Y-axis?

@Calinou
Copy link
Member Author

Calinou commented Jun 16, 2021

Does the issue remain if you move each decal slightly up or down on the global Y-axis?

Changing each decal's height will eventually affect sorting at a given camera angle, but using a slightly different Y axis position for each decal doesn't fix the variable sorting issues depending on camera rotation:

decal_sorting_height.mp4

@Flavelius
Copy link
Contributor

If they were sorted based on the projector's center/origin/position in the projection direction, it would make it an intuitive adjustment for users (optionally with an additional exposed bias parameter).

@mieldepoche
Copy link
Contributor

this still very much happen in 4.1.1 and 4.2

Video
simplescreenrecorder-2023-10-02_19.24.52.mp4

@Calinou
Copy link
Member Author

Calinou commented Oct 2, 2023

@mieldepoche Please open a new issue with a minimal reproduction project attached.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants