Skip to content

Conversation

@mvaligursky
Copy link
Contributor

Improves LOD selection accuracy by calculating distance to the nearest point
on the octree node's bounding box instead of the box center. This prevents
incorrect LOD switching when the camera is inside or near large nodes.

  • Added BoundingBox.closestPoint() method with comprehensive tests
  • Updated calculateNodeLod to use nearest point for all distance calculations
  • Fixed behind-camera penalty to only apply when appropriate

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves LOD (Level of Detail) selection accuracy in GSplat rendering by calculating the distance from the camera to the nearest point on an octree node's bounding box, rather than to the box center. This prevents incorrect LOD switching behavior when the camera is positioned inside or very close to large nodes.

Key Changes:

  • Added BoundingBox.closestPoint() method to find the nearest point on an AABB to a given point
  • Updated LOD calculation in GSplatOctreeInstance to use the nearest point on the bounding box
  • Added comprehensive test coverage for the new closestPoint() method

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/core/shape/bounding-box.js Implements closestPoint() method to find the nearest point on an AABB to a given point
test/core/shape/bounding-box.test.mjs Adds 16 comprehensive test cases covering various scenarios for closestPoint()
src/scene/gsplat-unified/gsplat-octree-instance.js Updates calculateNodeLod() to use closestPoint() for accurate distance calculations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mvaligursky mvaligursky merged commit 9a71ca8 into main Nov 18, 2025
7 checks passed
@mvaligursky mvaligursky deleted the mv-octree-aabb-nearest branch November 18, 2025 14:51
mvaligursky added a commit that referenced this pull request Nov 19, 2025
Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: graphics Graphics related issue enhancement Request for a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants