فهرست منبع

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 <[email protected]>
(cherry picked from commit b239c6706e77796f89f79717efbd59cf987061f2)
QbieShay 4 سال پیش
والد
کامیت
f862edd47c
1فایلهای تغییر یافته به همراه2 افزوده شده و 2 حذف شده
  1. 2 2
      servers/visual/visual_server_scene.cpp

+ 2 - 2
servers/visual/visual_server_scene.cpp

@@ -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);
 		}