Skip to content

Commit afcbeec

Browse files
authored
Merge pull request #12 from jbienzms/Dev
Updating 1.0.0 with docs, recording fixes and packaging
2 parents 9621521 + bf62684 commit afcbeec

File tree

18 files changed

+366
-85
lines changed

18 files changed

+366
-85
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
REM @ECHO OFF
2+
ECHO.
3+
4+
pushd .
5+
cd ..
6+
cd ..
7+
8+
REM Set Paths
9+
SET UnityExe="%ProgramFiles%\Unity\Hub\Editor\2018.3.0b11\Editor\Unity.exe"
10+
SET ProjectDir=%cd%\SpatialAlignment-Unity
11+
SET AssetDir=%ProjectDir%\Assets
12+
SET PackageDir=%cd%\External\UnityPackages
13+
14+
REM Set Package Info
15+
SET PackageName=SpatialAlignment
16+
SET PackageVersion=1.0.0
17+
SET PackageFileName=%PackageName%-%PackageVersion%.unitypackage
18+
19+
ECHO Packaging %PackageName% %PackageVersion%
20+
21+
ECHO Defining Asset List
22+
SET Assets=%Assets% Assets\SpatialAlignment
23+
SET Assets=%Assets% Assets\SpatialAlignment-Examples
24+
25+
ECHO Generating %PackageFileName% ...
26+
%UnityExe% -batchmode -projectPath %ProjectDir%\ -exportPackage %Assets% %PackageDir%\%PackageFileName% -quit
27+
28+
IF ERRORLEVEL 1 GOTO PACKAGINGERROR
29+
30+
:SUCCESS
31+
ECHO "Package Success!"
32+
GOTO END
33+
34+
:PACKAGINGERROR
35+
ECHO "Packaging Error"
36+
PAUSE
37+
GOTO END
38+
39+
:END
40+
popd
93.8 KB
Loading
297 KB
Loading
106 KB
Loading
134 KB
Loading
70 KB
Loading
3.83 MB
Loading
145 KB
Loading
25.8 MB
Binary file not shown.

README.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Spatial Alignment for Unity
2+
3+
This reference architecture includes many helpful components for aligning and keeping virtual objects aligned with the physical world.
4+
5+
6+
### Release 1.0
7+
8+
Release 1.0 contains the following capabilities:
9+
10+
11+
#### Spatial Frames
12+
13+
*Spatial Frames* represent "islands" in the real world. They have a position and a rotation and are designed to hold objects. They also have unique IDs and are available from the moment the application loads (even before they're found in the real world). This simplifies application logic because objects can be loaded up front and automatically aligned when the frame is found.
14+
15+
![](External/ReadMeImages/Align-FramesAndStrategies.png)
16+
17+
18+
##### Alignment Strategies
19+
20+
Each *Spatial Frame* has an *Alignment Strategy*. The strategy is what moves the frame and keeps it aligned in the physical world. Alignment Strategies are "plugins", and developers can easily create their own strategies. Developers are also free to mix and match various strategies in the same application.
21+
22+
![](External/ReadMeImages/Align-MixStrategies.png)
23+
24+
Alignment Strategies provide information about their state (e.g. whether they've been found) and their accuracy (maximum drift in meters). Applications can use this information to make intelligent decisions about which frames are best to contain which objects. In fact, one of the included alignment strategies is a *Multi-Parent* strategy that allows objects to automatically "hop" parent frames based on their state and accuracy.
25+
26+
![](External/ReadMeImages/Align-ParentHopping.png)
27+
28+
29+
#### Refinement
30+
31+
Two of the biggest challenges that accompany spatial alignment are:
32+
33+
1. Initial placement (and rotation) of objects to match up with the physical world
34+
2. Accounting for drift that accumulates over distance (a challenge that is present in all large-scale tracking systems)
35+
36+
This reference architecture includes components to help address both. To help with accurate alignment, an extensible system of *Refinement Controllers* is provided. Version 1.0 includes one refinement controller called **RayRefinement**. **RayRefinement** aligns a virtual model to a physical place by selecting corresponding origin points and directions.
37+
38+
![](External/ReadMeImages/Align-RayRefine.gif)
39+
40+
To help compensate for drift, *Multi-Parent* alignment offers the ability to apply different positional and rotational offsets at each parent.
41+
42+
![](External/ReadMeImages/Align-Refine.png)
43+
44+
The offset ability can be used together with a *Refinement Controller* to bring large-scale models back into alignment when viewed from different locations.
45+
46+
The video below demonstrates using **RayRefinement** to align a [Matterport 3D](https://matterport.com/) scan of a building with the actual building and keep that scan in alignment from different locations.
47+
48+
[![](External/ReadMeImages/Align-MPScanVideo.jpg)](https://youtu.be/IINWbBeIRL0)
49+
50+
51+
#### Persistence
52+
53+
Applications that leverage spatial alignment generate a notable amount of configuration data:
54+
55+
- All of the Frames and their IDs
56+
- All of the configuration settings for each Alignment Strategy
57+
- Relationships between Frames (e.g. Multi-Parent alignment)
58+
- Position, Rotation and Scale offsets
59+
- State requirements (e.g. Resolved, Tracking)
60+
- Accuracy requirements
61+
- etc.
62+
63+
To help applications save all of this data, every component in the architecture is serializable. In fact, the included class **JsonStore** can be used to serialize an entire alignment "graph" into json, which can then be loaded back the next time the application runs.
64+
65+
![](External/ReadMeImages/Align-Persistence.png)
66+
67+
68+
#### Examples
69+
70+
Release 1.0 includes the following example scenes:
71+
72+
- **SA-MultiParent** - Demonstrates "hopping" between multiple parent spheres in the scene.
73+
- **SA-Persistence** - Demonstrates saving an entire "graph" of frames and their strategies into memory then loading them back into the scene.
74+
- **SA-Refinement** - Demonstrates using **RayRefinement** to place a multi-colored cube in a room.
75+
- **SA-RefinementBuilding** - Demonstrates using **RayRefinement** to align a Matterport 3D scan to room. (This example is shown in the video above).
76+
77+
78+
### Contributing
79+
80+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
81+
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.

0 commit comments

Comments
 (0)