metafizzy / zdog

Flat, round, designer-friendly pseudo-3D engine for canvas & SVG

Home Page:https://zzz.dog

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Z sort override per Shape

bendablegears opened this issue · comments

Currently, in order to change the render order of a Shape one has to add it to a Group along with additional invisible Shapes in order to nudge the Z sort to the desired position. It would be nice if one could specify a point that, if set, updateSortValue would use instead of calculating average Z.

Add a 👍 reaction to this issue if you would like to see this feature added.


Wow, this is a good idea. I hadn't thought of adding a per-shape override like you suggest.

So with this feature we would be able to solve this bug, right? https://codepen.io/anon/pen/oryxRJ
Or is that already possible?

This feature would make it easier to implement some of the Z-fighting techniques I propose here. Rather than relying on Group with an addition Shape, you would hard-code in where you want the sorted position to be.

As for that gear icon: that's a tricky tricky issue with figuring out which one of the side shapes is 'in front' of the top gear shape. Zdog is not optimized for those kind of polygonal models. But there are some techniques to possibly resolve it.

For the gear; simply putting the polygons into an updateSorting Group does the right thing; Z sort for Groups works with average Z for all the members in a Group.

https://codepen.io/anon/pen/pXKEKX

The proposed feature is more about getting non-symmetric shapes or groups of shapes to Z sort well without having to use invisible shapes.