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

Allow sorting front-to-back #5168

Open
JCash opened this issue Sep 5, 2020 · 4 comments
Open

Allow sorting front-to-back #5168

JCash opened this issue Sep 5, 2020 · 4 comments
Labels
editor Issues related to the Defold editor engine Issues related to the Defold engine render task A task that needs to be performed

Comments

@JCash
Copy link
Contributor

JCash commented Sep 5, 2020

It's currently not possible to render meshes front-to-back.

  • it is also be beneficial to skip sorting (fair performance boost) for e.g. alpha blended particles.
    See exploration-particle-no-sort

  • Another useful sort is the y-sort, allowing for objects hiding behind other objects the higher the Y value is.

I think that a material property is the most frequent use case, but I wonder if it's also useful to have it as a render script override as well? We need to find a use case for that before adding it to the render script api.

@JCash JCash added task A task that needs to be performed editor Issues related to the Defold editor engine Issues related to the Defold engine labels Sep 5, 2020
@britzl britzl added the render label Sep 6, 2020
@britzl
Copy link
Contributor

britzl commented Aug 3, 2022

but I wonder if it's also useful to have it as a render script override as well? We need to find a use case for that before adding it to the render script api.

There are scenarios where you have sprites with several different materials, but all of them should be y-sorted. Possibly also mixed with labels and maybe particle effects. Setting the sort order on each material might be ok though? It's not like the sort order will be changed all the time.

Having it as a render script override is not an MVP I think.

@JCash
Copy link
Contributor Author

JCash commented Sep 12, 2022

Since a render.draw(predicate) will produce batches with different types of renderables, I no longer think the sorting should be set on the material(s).
Instead, it feels more like it should be an option to the render.draw(predicate, options={...}) function.

@JCash
Copy link
Contributor Author

JCash commented Sep 14, 2022

But then again, I don't think it's relevent to "not sort" e.g. a mix of sprites, models and particles 🤔

@swajj
Copy link

swajj commented May 8, 2024

Having the ability to Y-sort a given predicate (ignoring Z) would be great to solve some otherwise difficult quirks for my card game. Or even sort based on a custom property I can set myself. (I'm working in perspective, so I can't just use Z for this)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor Issues related to the Defold editor engine Issues related to the Defold engine render task A task that needs to be performed
Projects
None yet
Development

No branches or pull requests

3 participants