A non-transitory computer-readable medium storing instructions that, when executed by a computer processor of a computing device, causes the computing device to perform operations, the operations comprising:
- capturing a first dataset of an environment with a sensor of a first system at a first time, wherein the sensor comprises a red-green-blue (RGB) camera, an infrared camera, a lidar, or a combination thereof, and wherein the first system comprises an augmented reality (AR) system or a mixed reality (MR) system;
- identifying a plurality of features in the first dataset, wherein the plurality of features comprises at least a first feature, a second feature, a third feature, a fourth feature, and a fifth feature;
- determining that the third feature is within the first feature such that the first feature and the third feature have a container-contained relationship;
- generating a hierarchy of features including the first feature, the second feature, the third feature, the fourth feature, and the fifth feature, wherein the hierarchy of features is generated based upon the first feature, the second feature, the third feature, the fourth feature, and the fifth feature in the first dataset, wherein the third feature is a child of the first feature in the hierarchy of features in response to the third feature being within the first feature, and wherein the fourth feature is a child in the hierarchy of features;
- capturing a second dataset of the environment with the sensor of the first system at a second time, wherein the second time is after the first time;
- identifying the first feature, the second feature, the third feature, and the fourth feature in the second dataset, wherein the first feature is in a same location in the first dataset and the second dataset, wherein the second feature is in different locations in the first dataset and the second dataset, wherein the fourth feature is in different locations in the first dataset and the second dataset, and wherein the fifth feature is not present in the second dataset;
- updating the hierarchy of features based upon the first feature, the second feature, the third feature, and the fourth feature in the second dataset, wherein updating the hierarchy comprises:
- moving the second feature to a lower level in the hierarchy of features in response to the second feature being in different locations;
- switching the fourth feature to be a child of a different one of the plurality of features in response to the fourth feature being in different locations;
- and
- removing the fifth feature from the hierarchy of features in response to the fifth feature not being present in the second dataset;
- filtering one or more of the plurality of features to identify resilient spatial anchors that have a higher likelihood of matching the one or more of the plurality of features at the second time;
- generating a first spatial anchor in response to updating the hierarchy of features and in response to the filtering, wherein the first spatial anchor comprises a collection of points in a coordinate system used to render a virtual object, and wherein the first feature having a higher level than the second, third, and fourth features causes the first feature to have a greater weight value than the second, third, and fourth features for matching the first spatial anchor;
- and
- generating the virtual object inside a headset or a screen of the first system based upon the first spatial anchor.