-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Description
What problem does this solve or what need does it fill?
The current algorithm can lead to missing transparency effects when using custom cameras.
Describe the solution would you like?
Changing
DepthCalculation::ZDifference => camera_position.z() - position.z()
to
DepthCalculation::ZDifference => (camera_position.z() - position.z()).abs()
would fix the error.
Describe the alternative(s) you've considered?
Using DepthCalculation::Distance resolves the issue, but leads to weird artifacts when entities are closely together.
Additional context
I use a custom pseudo-3d camera projection. As it increases the Y-coordinate with increasing Z-coordinates, it needs the camera to be at or close to the origin. This means that entities with positive Z-coordinates get assigned a negative ZDifference and thus are sorted incorrectly.