Skip to content

Commit

Permalink
visual server now sorts based on aabb position
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
QbieShay and RevoluPowered committed Mar 5, 2021
1 parent db5a927 commit b239c67
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 @@ -2025,8 +2025,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 b239c67

Please sign in to comment.