meshoptimizer icon indicating copy to clipboard operation
meshoptimizer copied to clipboard

Adds higher precision spatial sorting

Open pm4rtx opened this issue 1 year ago • 1 comments
trafficstars

Hi,

I've been working with some meshes where 10 bits of precision was not sufficient, so I added a version of spatialSortRemap with higher precision, so perhaps it could be helpful in upstream.

pm4rtx avatar Jan 25 '24 12:01 pm4rtx

Any chance you'd be able to share some meshes in question, publicly or privately, as well as the evaluation criteria for the sort order?

There's definitely an expectation that the quantization in spatialSortRemap produces the same values for points that are too close. But that previously has been considered fine as it didn't affect the actual order too greatly - as in, if the points are close enough then the order of points doesn't matter. That said, of course if the extents of the mesh are very large then maybe the quantization threshold becomes unacceptably large as well.

I don't love the idea of adding another API to solve this, however it might be good to solve the issue inside the function itself by automatically switching to a higher precision version under some condition. Additionally I'm curious if you need the full 60 bits of precision here, or if fewer bits suffice - eg if instead of 6 radix passes we could do 4 or 5, this could be good.

zeux avatar Jan 25 '24 18:01 zeux