Skip to content

Commit

Permalink
Merge pull request #43506 from QbieShay/fix-depth-sort
Browse files Browse the repository at this point in the history
[3.x] VisualServer now sorts based on AABB position
  • Loading branch information
akien-mga authored May 22, 2021
2 parents 6f31af4 + b239c67 commit 4100a80
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions servers/visual/visual_server_scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2096,8 +2096,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);
}

Expand Down

0 comments on commit 4100a80

Please sign in to comment.