ARFoundation Integration
This package is aimed at Unity developers using the ConjureKit packages with ARFoundation. It provides easy integration with Manna, removing the need to write and keep updated the code for passing frames from the camera feed to Manna.
Note, however, that this package does not depend on Manna as of version 0.6.42. You can also use it with your own calibration algorithms.
There are two frame providers available in this package:
CameraTextureProvider
provides a texture from ARFoundation, via theOnNewTextureReady
event.CameraFrameProvider
is an extended version that also provides additional Frame information, via theOnNewFrameReady
event.
We strongly recommend using CameraFrameProvider
to obtain matrices since on iOS it asks for such information directly at the native level to ARKit (which has been proven to be more correct than via AR Foundation).
Example usage
Import the package:
using Auki.Integration.ARFoundation;
Use with CameraTextureProvider
:
var textureProviderComp = CameraTextureProvider.GetOrCreateComponent();
textureProviderComp.OnNewTextureReady += texture => _manna.ProcessVideoFrameTexture(texture, arCamera.projectionMatrix, arCamera.worldToCameraMatrix);
Use with CameraFrameProvider
:
var textureProviderComp = CameraFrameProvider.GetOrCreateComponent();
textureProviderComp.OnNewFrameReady += frame => _manna.ProcessVideoFrameTexture(frame.Texture, frame.ARProjectionMatrix, frame.ARWorldToCameraMatrix);
When using CameraFrameProvider
you can set your own SessionOriginTransform
as base matrix transform, or set it to null to set it to identity.
The optional TimerMs
property provides a way to limit the frequency of frames being processed by allowing you to set the minimum amount of time (in ms) between two subsequent frames to be processed. The first texture is returned immediately.
textureProviderComp.TimerMs = 1000; // [optional] adds delay: get a new texture minimum every 1 sec
Upgrading from v0.6.34 to v0.6.42
The dependency on Manna has been removed, along with the methods GetOrCreateFrameFeederComponent
and AttachMannaInstance
. FrameFeeder
is now CameraTextureProvider
or CameraFrameProvider
.
v0.6.34
var frameFeeder = _manna.GetOrCreateFrameFeederComponent();
frameFeeder.AttachMannaInstance(_manna);
v0.6.42
var textureProviderComp = CameraFrameProvider.GetOrCreateComponent();
textureProviderComp.OnNewFrameReady += frame => _manna.ProcessVideoFrameTexture(frame.Texture, frame.ARProjectionMatrix, frame.ARWorldToCameraMatrix);