Giter Site home page Giter Site logo

Comments (4)

JMLX42 avatar JMLX42 commented on July 19, 2024

Hello and thank you for your feedback,

creating a copy of the array to sort it instead of resort the original array everytime

Creating a copy of such array at every frame is a really bad idea. We try to avoid memory allocation as much as possible.

changing Sort.flashSort(sortValues, calls, numCalls); with calls.sortOn("depth",Array.NUMERIC|Array.DESCENDING)

Array.sortOn must be something like 100x slower than our implementation of the "flash sort". So it's really not an option either.

when you have sorted draw calls due to alpha blending and some calls happen to have the same depth ( lots of triangles in tight space, I guess ) the sorting method in RenderController.render generates random order for the calls woth equal depth, and the result is flickering.

This situation should happen only on very rare occasions. So it would really be a bad fix to simply wast a lot of memory/time at every frame simply to avoid an issue that is not supposed to happen.

The flickering occurs because the flash sort is not stable: items with the same value will not have the same position after every sort. So the fix is to make the flash sort stable (I'm not sure it's doable) or implement a new sort faster than Array.sortOn but stable.

Regards,

from minko.

warrenseine avatar warrenseine commented on July 19, 2024

The z-fight issues cannot be solved this way. You may, indeed, fix some flickering issue by using a stable sort, but you can't be sure which triangle will appear.

Also, using sortOn could have a negative impact on performance.

from minko.

Tortenazor avatar Tortenazor commented on July 19, 2024

I know this is really a bad idea, but I was in a hurry and it fixed the issue for me. I didn't have millions of triangles anyway so I could afford the dirty trick...

from minko.

JMLX42 avatar JMLX42 commented on July 19, 2024

logged internally as feature #1128: "implement stable sort for draw calls"

I know this is really a bad idea, but I was in a hurry and it fixed the issue for me.

Good thing it's open source in this kind of situations :)

from minko.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.