kpreid / all-is-cubes

Yet another block/voxel game; in this one the blocks are made out of blocks. Runs in browsers on WebGL+WebAssembly.
https://kpreid.dreamwidth.org/tag/all+is+cubes
Apache License 2.0
164 stars 8 forks source link

Depth sorting doesn't work from some angles #53

Open kpreid opened 3 years ago

kpreid commented 3 years ago

My best guess is that the sorting is correct and the direction-to-sort-order conversion is not, but I haven't investigated yet. A possible next step would be to add debug drawing that indicates what ordering is being used for each nonempty chunk.

kpreid commented 1 year ago

I took a stab at visualizing the conversion of the view angle to sort direction, and it definitely seems suspicious. However, that might just be because of its intrinsic coarseness.

Note that DepthOrdering does have a thorough test for its conversion from a direction vector. Therefore, either something is going wrong after that point, or there is something wrong with the premise of the algorithm.

kpreid commented 7 months ago

Another note on troubleshooting: it's easy to change mesh generation to count all vertices as “transparent” vertices, thus causing depth sorting instead of depth buffer testing to be used. This doesn't enlighten us about what the problem is, but it'll help check when it's fixed. A quick test seems to indicate that things aren't going severely wrong with lots of sorted geometry — just a little bit.