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
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

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