1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

visual server now sorts based on aabb position

this was causing issues with scenes where the origin of the objects
was set for all objects to the center of the scene, making transparent
objects sort improperly

This work was kindly sponsored by IMVU

Co-authored-by: RevoluPowered <gordon@gordonite.tech>
(cherry picked from commit b239c6706e)
This commit is contained in:
QbieShay
2020-11-13 17:44:41 +01:00
committed by Rémi Verschelde
parent c476459f2b
commit f862edd47c

View File

@@ -2189,8 +2189,8 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca
geom->gi_probes_dirty = false;
}
ins->depth = near_plane.distance_to(ins->transform.origin);
Vector3 aabb_center = ins->transformed_aabb.position + (ins->transformed_aabb.size * 0.5);
ins->depth = near_plane.distance_to(aabb_center);
ins->depth_layer = CLAMP(int(ins->depth * 16 / z_far), 0, 15);
}