Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unity Support #36

Closed
nadir500 opened this issue Aug 21, 2019 · 58 comments
Closed

Unity Support #36

nadir500 opened this issue Aug 21, 2019 · 58 comments
Labels
platform:unity MediaPipe Unity issues type:feature Enhancement in the New Functionality or Request for a New Solution

Comments

@nadir500
Copy link

Can we see Unity Engine port of it?
It would so much great of we used it inside the engine

@mgyong
Copy link

mgyong commented Aug 21, 2019

@nadir500 We have gotten several request to support MediaPipe in Unity engine. Can you share with us your use cases? We love to work with some teams to get contribution to MediaPipe for getting MediaPipe into Unity
@mcclanahoochie @chuoling

@LogonDev
Copy link

Some potential use cases:

  • VR Hand tracking (similar to devices like leap motion). Some VR headsets such as the HTC Vive Pro and Valve Index already have RGB cameras built in
  • AR hand tracking
  • Object detection/segmentation using cell phone camera/hololens camera/pc camera

@MahmoudAshraf-CIS
Copy link

MahmoudAshraf-CIS commented Aug 22, 2019

Actually there is an sdk from vive port that supports hand tracking on unity
For both Android and HTC vive
I didn't try it on Android though, but it worked on vive just fine

The sdk is still early access
https://developer.viveport.com/documents/sdk/en/vivehandtracking_index.html

I don't know the difference between the two implementations but I guess it would be great if there is some sort of cooperation between the two teams to poost the process.

And for some use cases, check the videos here
https://developer.vive.com/resources/knowledgebase/vive-hand-tracking-sdk/

@mgyong
Copy link

mgyong commented Aug 22, 2019 via email

@RafaelSPBarbosa
Copy link

I also support this!
We are a Unity VR and AR Advergame studio, our clients would loose their minds over this. Initially, we would like to be able to do normal image tracking or arcore tracking to position the objects on the scene, then, we would use this to track the hands and enable our users to directly interact with the game. This would be fenomenal!

@KDevS
Copy link

KDevS commented Aug 22, 2019

Would love to get a Unity port as well. There aren't any open-source options for hand-tracking in AR, especially for mobile devices. This works perfectly on my phone. There are some like ManoMotion which support hand tracking in 2D but they are paid and in closed beta. If this can be used with Unity then that would help a lot of developers around who are looking to integrate a more natural interaction into their Augmented Reality experiences. The use case for VR is even more obvious.

@iBicha
Copy link

iBicha commented Aug 23, 2019

Maybe this can be in the style of c api from tflite?

And the string containing the definition of the graph can be passed from the .Net runtime to the native API with PInvoke calls.

I would say it can be even possible to create custom calculators in C#, and the managed methods (GetContract(), Open(), and Process()) can be passed to the C API as a function pointer to be invoked from there.

The incentive would be to make it possible to use alongside arcore-unity-sdk (in a fashion where ARCore will be passing the camera image to mediapipe through the CameraImage), and maybe ARFoundation as well (which also has an API for retrieving the camera image), so it would be in the form of a subsystem.
Because this is where most of the AR creations are happening, so this would enable a lot of devs to expand on their existing projects.

These are only ideas as I didn't dive into mediapipe enough to have a solid opinion

@mgyong
Copy link

mgyong commented Aug 23, 2019 via email

@TheBricktop
Copy link

TheBricktop commented Aug 23, 2019

The aristo API from htc currently is much inferior to the Google's approach due to the API that relies on the stereo cameras from vive pro, as tested on original vive mono camera it works really bad, and the Android version is very limited and burns the battery easily thus limiting it's use with other computational heavy tasks like XR.
That's why we look forward to see a port of media pipeline to Unity.

@mcclanahoochie
Copy link

Hi
We definitely welcome contributions to MediaPipe, and Unity support would be great to have.
I like reading about the use cases, and @iBicha has some nice ideas on approaches.

I can add a few more ideas, and would say there is a spectrum (as always in programming) of how to solve this (i.e. adding Unity support):

       quick/easier/faster <--> more-involved/harder/tedious 
less-flexible/less-generic <--> more-flexible/more-generic

On the right side, there is the ARCore approach, where the majority of ARCore API is mapped into C#, including all the C/C++/C# wrappers. This obviously requires a lot of C# code (and C interfaces) to be written, but provides the greatest flexibility on developer use-cases and how tightly you can integrate into the C# application.

On the left side, there is the option of minimizing the amount of C#/C-wrapper that needs to be written, via writing a native class (similar to hello_world.cc, or FrameProcessor.java) to handle all the graph initialization/running. In the simplest case, there could be just a few functions in a custom graph runner exposed C#: InitAndStartGraph, AddPacket, RetrieveResultPacket, ShutdownGraph. This would be more of a black-box approach, treating running a graph like calling a function.

I think depending on the application, one approach may be more fitting than the other (considering amount of effort involved), or some hybrid of the two.
Hopefully this discussion can get people going in the right direction for them.

A side note for future reference:
To link the OpenGL context between Unity and MediaPipe (where Unity is parent context), you would need to follow something similar to what is done for Android in nativeSetParentGlContext
and connect with Unity

OnGraphicsDeviceEvent(UnityGfxDeviceEventType eventType) {
  switch (eventType) {
    case kUnityGfxDeviceEventInitialize: {
#if HAS_EGL
      external_context = eglGetCurrentContext();
#elif
    ...
    }
  ...

@mgyong mgyong closed this as completed Aug 25, 2019
@mgyong mgyong added the type:feature Enhancement in the New Functionality or Request for a New Solution label Aug 27, 2019
@ahmadpi
Copy link

ahmadpi commented Aug 28, 2019

I have been looking for this solution as well. I fully support this effort!

@jmartinho
Copy link

HTC Vive solution is not good enough compared with this mediapipe handtrak. I tested both, and even Vive solution runs on a desktop, is to not compare with mediapipe runing inside a slow android smartphone. Mediapipe handtracking is stunning good and it will be a gamechanger in UI in the nearfuture.
Hope mediapipe will support very soon Unity.
A good start is looking at TensorFlowSharp, already implemented in Unity:
Using TensorFlowSharp in Unity (Experimental)
https://github.com/Unity-Technologies/ml-agents/blob/develop/docs/Using-TensorFlow-Sharp-in-Unity.md
Here it is as unity package: https://s3.amazonaws.com/unity-ml-agents/0.4/TFSharpPlugin.unitypackage

@Ericbing
Copy link

+other folks

On Wed, Aug 21, 2019 at 6:34 PM Logon13 @.***> wrote: Some potential use cases: - VR Hand tracking (similar to devices like leap motion). Some VR headsets such as the HTC Vive Pro and Valve Index already have RGB cameras built in - AR hand tracking - Object detection/segmentation using cell phone camera/hololens camera/pc camera — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#36?email_source=notifications&email_token=AAQTXUNNQJIGCXLGHGCE7E3QFXUJNA5CNFSM4IOHEEL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD43S7XA#issuecomment-523710428>, or mute the thread https://github.com/notifications/unsubscribe-auth/AAQTXUNPXU6O3CSVNSUSI2LQFXUJNANCNFSM4IOHEELQ .

+other folks

On Wed, Aug 21, 2019 at 6:34 PM Logon13 @.***> wrote: Some potential use cases: - VR Hand tracking (similar to devices like leap motion). Some VR headsets such as the HTC Vive Pro and Valve Index already have RGB cameras built in - AR hand tracking - Object detection/segmentation using cell phone camera/hololens camera/pc camera — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#36?email_source=notifications&email_token=AAQTXUNNQJIGCXLGHGCE7E3QFXUJNA5CNFSM4IOHEEL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD43S7XA#issuecomment-523710428>, or mute the thread https://github.com/notifications/unsubscribe-auth/AAQTXUNPXU6O3CSVNSUSI2LQFXUJNANCNFSM4IOHEELQ .

-VR hand tracking for Oculus Quest/Rift S. It is so important for getting a better user experience with more natural interaction input, finger tracking is definitely on top of the list. Also there will be more and more VR HMD using inside-out tracking meaning they all have camera onboard.

@lqz
Copy link

lqz commented Sep 18, 2019

I hope this feature too. It is very importance for us.

@GilbertoBitt
Copy link

I fully support this. imagining been able to interact with the game/object itself using hand tracking.

@lukamilosevic
Copy link

lukamilosevic commented Oct 16, 2019

A step in the right direction would be headless hand tracking and using UnityPlayer.UnitySendMessage to send the coordinates from Android to Unity Activity. Then just position the hand on the camera viewport according to received coordinates.

First step could be just adding some code to the current "Hand Tracking GPU" app to send data to a server running in Unity Editor during play mode. That itself could become a great development tool. I might try to do this myself but if someone does something like this, please post your results!

@TheBricktop
Copy link

There are other models for hand tracking but probably not so performant as the googles version https://github.com/lmb-freiburg/hand3d

@seberta
Copy link

seberta commented Dec 7, 2019

Hi, just wondering why this issue is closed now? Is the Unity plugin available?

@DBrown12
Copy link

Like Seberta, I'd like to know. Has any headway been made on this endeavor?

@martdob
Copy link

martdob commented Jan 31, 2020

Unity support would be an excellent approach. Especially for variety of Augmented Reality apps and solutions, the Mediapipe Plugin for Unity would be a great help.

@TheBricktop
Copy link

I kinda find this weird that feature request is closed without any answear.
Intel git does that too.

@romaindebraize
Copy link

I also support this. When will it be available ?

@mgyong
Copy link

mgyong commented Feb 22, 2020

We are looking into this and will update the thread when we have something more definite. We welcome contributions from folks in the thread

@asierras
Copy link

asierras commented Apr 29, 2020

I am also looking forward to this. A lot of clients are asking me hand and finger tracking for AR apps on iOS and Android.

Any news about this?

Thank you!

@HooliganLabs
Copy link

Also interested in support of this.

@boehm-e
Copy link

boehm-e commented May 1, 2020

Interested too

@moemenYmoemen
Copy link

Interested in Unity support for it

@vivi90
Copy link

vivi90 commented Dec 14, 2020

@midopooler Nothing until now, like it seems.

@Thaina
Copy link

Thaina commented Mar 4, 2021

Why this issue was closed though? We should have unity integration of this library

@vivi90
Copy link

vivi90 commented Mar 4, 2021

Why this issue was closed though? We should have unity integration of this library

Same opinion.

@ostryhub
Copy link

ostryhub commented Mar 5, 2021

Why this issue was closed though? We should have unity integration of this library

Same here.

@ROBYER1
Copy link

ROBYER1 commented Mar 5, 2021

@nadir500 We have gotten several request to support MediaPipe in Unity engine. Can you share with us your use cases? We love to work with some teams to get contribution to MediaPipe for getting MediaPipe into Unity
@mcclanahoochie @chuoling

It's been 2 years, I could write an essay of use cases if you need. Many current projects would benefit from this

@rtrn1337
Copy link

rtrn1337 commented Mar 5, 2021

Maybe this could help? https://github.com/homuler/MediaPipeUnityPlugin I didnt test it, but got it on my list.

@nadir500
Copy link
Author

nadir500 commented Mar 5, 2021

The main challenge in Unity currently is to make hands tracking with depth perception an option in vr/ar interactions using mobile camera instead of tracking devices such as leap motion which has no android sdk, of course it's all going to be tuned in real-time since the slightest lag would hurt the experience on some cases.
The projects I make on unity often include merging research with vr environments using different tools used to interact. Other features like gestures detection would be useful for different AR concepts.

@KDevS
Copy link

KDevS commented Mar 5, 2021

Unity support for MediaPipe would be really welcome. Anyone who has worked in the AR/VR/MR applications would love a stable hand-tracking option without being dependent on expensive and/or walled-off hardware to pull it off. I have seen some really good work done on hand-tracking done with just a single RGB camera by some university teams a few years back but none of them were opened up to public, and I won't be surprised if most of them ended up in either Facebook or Microsoft's collection of patents.

OpenCV seems to be the only open option available at the moment but the hand-tracking options are not polished enough to be used commercially. Options like ManoMotion are way too expensive for individual developers.

@vivi90
Copy link

vivi90 commented Mar 9, 2021

Yes, we really need this stuff for Unity!

@nadir500
Copy link
Author

nadir500 commented Mar 9, 2021

Support for Unity barracuda would make more benefit for the developers.

@FerLuisxd
Copy link

Just an API would be really neat to have to make really cool 3D applications

@yugosaito4
Copy link

@rtrn1337 have you tried the plugin?

@rtrn1337
Copy link

rtrn1337 commented Apr 6, 2021

@rtrn1337 have you tried the plugin?

yes i did. Some features are working in Unity Editor. But I get an error in Xcode when I want to build on a device. I haven't had time to test it more closely yet.

@sr229 sr229 mentioned this issue Jul 1, 2021
@manwithsteelnerves
Copy link

manwithsteelnerves commented Jan 31, 2022

@ROBYER1

I was following this thread and it started long back where there are not much devices which support AR Core. But, now there are many.

Would be great if you can share the use-case list!

@EigenSpiral
Copy link

Hi,
Does anyone know how the hand tracking performance of Mediapipe & Leap motion compares?

@boehm-e
Copy link

boehm-e commented Feb 21, 2022

@EigenSpiral
I have a leap motion since years now.
I find that Mediapipe is better at guessing partially occluded finger's positions.
I cannot compare the performance (in term of speed), since I run mediapipe on my phone, and leap motion on my laptop. Both run smoothly. Maybe mediapipe is even faster.

@EigenSpiral
Copy link

@boehm-e Thank you for sharing!
How does it compare on depth perception?

@ROBYER1
Copy link

ROBYER1 commented Feb 21, 2022

There isn't really depth with Mediapipe so Leap or any depth sensing camera is better there. I would strongly advise you try the linked sample repo above and compare for yourself in your own project!

@manwithsteelnerves
Copy link

We recently release Easy ML Kit which targets to get google's ML Kit, Media Pipe and Tensorflow in Unity. Currently we released 2 features (Barcode scanning and object detection) and others are in developement.

We have ARFoundation Camera as one of the input sources (along with live cam and image/textures) which will be quite useful for AR Apps.
Would be great if you can share us what features you are expecting so we can prioritize.

@EigenSpiral
Copy link

EigenSpiral commented May 11, 2022 via email

@manwithsteelnerves
Copy link

Sure! Will definitely have a note!
We just released with Text Recognition and current features in development are Face detection and Pose estimation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform:unity MediaPipe Unity issues type:feature Enhancement in the New Functionality or Request for a New Solution
Projects
None yet
Development

No branches or pull requests