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

Holographic (HoloLens) support #5915

Open
Noemata opened this issue Sep 1, 2017 · 17 comments
Open

Holographic (HoloLens) support #5915

Noemata opened this issue Sep 1, 2017 · 17 comments

Comments

@Noemata
Copy link

@Noemata Noemata commented Sep 1, 2017

Would be nice to see this integrated:

https://github.com/vladkol/MonoGame

so HoloLens support was built in.

@mrhelmut
Copy link
Contributor

@mrhelmut mrhelmut commented Sep 1, 2017

@vladkol would you mind setuping a pull request to get your work upstream?

@Noemata
Copy link
Author

@Noemata Noemata commented Sep 1, 2017

@vladkol 's repository isn't mine, though he is a Microsoft Dev that has a good rep for this sort of integration. There's no issues section on his repository, so I'm not sure how he might be notified to bring him in on this.

If there's no one on the MonoGame team side to do the HoloLens support, please let me know and I will look into getting the work done.

I think HoloLens support would be a good win for MonoGame!

The @nkast tag appears to be unrelated.

@SimonDarksideJ
Copy link
Contributor

@SimonDarksideJ SimonDarksideJ commented Sep 1, 2017

@vladkol repo seems good but would have been better if they had committed under a new branch to make seeing the changes easier.

Walking through the commits, not sure I agree with creating "another" platform as Holographic is a superset of UWP (so @nkast 's link is right as it's updating uwp). Should really just be a few extensions to enable special mapping and other holographic extensions to UWP.

I completely agree, this should either be in the base or (maybe better) an extension project to MonoGame like MonoGame.Extensions. MonoGame.Hologaphic?

I'm digging more in to the Mixed Reality space which also uses similar extensions so I would be very interested in this,
I'm dinning

@vladkol
Copy link

@vladkol vladkol commented Sep 1, 2017

My fork is not quite done yet. So far, it only establishes non-XAML framework (CoreWindow only) for running the game, which would be helpful to have in MonoGame regardless of HoloLens/Mixed Reality support.
If anyone wants to finish it, you’re welcome. I don’t think I’ll have time for that until November 2017.

@Noemata
Copy link
Author

@Noemata Noemata commented Sep 1, 2017

The changes @vladkol has made to MonoGame are encapsulated within his last 4 commits. The recent SharpDX based HoloLens templates Microsoft put out are reasonably straight forward; the bulk of the Holographic initialization is just a form of preamble.

I think @vladkol is the best person to move the Holographic MonoGame bits forward, but if that doesn't pan out I can look at doing this.

What are your suggestions?

(Thanks @vladkol , your post arrived before I sent this, so I didn't see it when this was written, this being an edit of the post)

@dellis1972
Copy link
Contributor

@dellis1972 dellis1972 commented Sep 4, 2017

This is a great idea. I would love to have Hololense support in the main repo. @tomspilman just to get this on your radar.

@Noemata
Copy link
Author

@Noemata Noemata commented Oct 7, 2017

This thread has gone quiet for a month. Are there any HoloLens devs out there that are looking for Monogame support? Anyone taken another crack at this?

@vpenades
Copy link
Contributor

@vpenades vpenades commented Oct 10, 2017

At home I'm working on a proof of concept experiment with SharpDX and Oculus Rift... when it's mature enough, I want to try integrating it with monogame, trying to keep the changes to monogame core to a minimum, and I was planning to use vladkol's PR as a template.

Sadly, it's going to be that way for a while, until we can settle on a common framework for VR.

What's worse is that almost nobody has all the available helmets to work on a common framework. In my case I own a Rift, so it's the only one I can work with, but looking forward to see a Hololens/Mixed reality inplementation!

@Noemata
Copy link
Author

@Noemata Noemata commented Oct 10, 2017

I have made some progress with HoloLens. The basics are starting to work. There are input modalities that presently have no analog in the existing code, so I really have no clue how to wire in aspects of the HoloLens capabilities. Given where VR is headed, this is something that will have to be resolved soon.

@Scellow
Copy link

@Scellow Scellow commented Oct 10, 2017

Is there a market for HoloLens ? wouldn't it be better to focus on Google/Apple AR solutions ?

@vpenades
Copy link
Contributor

@vpenades vpenades commented Oct 10, 2017

@Scellow The full story is: Microsoft developed the Hololens as a proof of concept to research and understand what's really needed for all aspects of VR, not only gaming. As it is, the hololens it's always been intended for developers only. Now that microsoft has achieved this stage, they've rebranded Hololens SDK to Mixed Reality SDK, which now supports many more VR headsets, and way cheaper than Oculus and VIVE.

You can see the new batch of Hololens compatible headsets here.

What's interesting is that, unlike all other VR platforms, the mixed reality SDK begins to look like some sort of standard... some people even call it DirectVR. And the best thing is that any company can build compatible headsets for it... and there's speculation whether Oculus and VIVE will eventually support it or not.

The bad thing is that, of all existing VR platforms, is the less mature one... but, well, it's microsoft.

Long story short, supporting Hololens means now, not only supporting the hololens itself, but all these new cheaper headsets, because they essentially use the same SDK.

@YTN0
Copy link
Contributor

@YTN0 YTN0 commented Oct 11, 2017

@vpenades @Noemata I have a MS mixed reality headset (the HP one) so if I have some free time (which is the real challenge), I am happy to test out stuff if you guys have anything testable ....

@demonixis
Copy link
Contributor

@demonixis demonixis commented Nov 10, 2017

@vladkol I've forked and updated your branch, you can take a look at my changes here. I made a quick test with your demo project, it's a XamlGame, I changed few things in the XamlGame.cs to force MR but I got a black screen (but it starts, we can see the fancy animation in the MR headset when the application is started).

I don't know if it can help you, but I'll continue to work on that fork if you can't.

@SimonDarksideJ
Copy link
Contributor

@SimonDarksideJ SimonDarksideJ commented Nov 10, 2017

This will probably work better with the recent changes for the MonoGame CoreApplication template, rather than XAML. Although I haven't the time at the mo to dig through it.

I think we also need to expose the "CoreWindow" from the Platform, like what is done in iOS and Android, as it's needed by the HL / MR API's for defining space. See #6038

@SimonDarksideJ
Copy link
Contributor

@SimonDarksideJ SimonDarksideJ commented Nov 15, 2017

Thanks to @nkast s work and the new "CoreApplication" template, I'm revisiting this again now.

Digging in to this further now and although I like what @vladkol has done, it's (imho) a bit overkill. We shouldn't be adding a "Holographic" device with all it's mannerisms.
Rather it's a case of opening up the graphic subsystem to allow for multiple graphic devices / targets.

Issue I'm facing with this atm, is that when you define a "Holographic" workspace, there is no one "graphicsdevice", these are initialised later (likely to allow for extension). So MG trips up because there is no GD to initialise. So I'm investigating options to either:

  • Define your own GraphicsDevice template using the IGraphicsDevice interface
  • Enable MG to be able to accept GD's on startup, rather than just "discovering" the primary.

Slowly getting there.

The "Holographic" example provided by the HL API in C#, uses SharpDX direct. So it's just a case of unpinning that work to implement in MG in a good framework way.

@demonixis
Copy link
Contributor

@demonixis demonixis commented Nov 29, 2017

Hey guys, I made some progress with @vladkol's branch, but I still have some problems because I'm not very good with SharpDX, maybe someone can help me.

We've to create a SharpDX.Direct2D1.Bitmap1 that is used as a target for d2dContext.

IntPtr pSurface = IntPtr.Zero;
Marshal.QueryInterface(pResource, ref WindowsUniversal.DXUtils.IDXGISurface, out pSurface);

var obj = Marshal.GetIUnknownForObject(pSurface);
using (var dxgiBackBuffer = new Surface(obj))
	_bitmapTarget = new SharpDX.Direct2D1.Bitmap1(_d2dContext, dxgiBackBuffer, bitmapProperties);

This code crashes because the interface is unknow. So I tried this

SharpDX.Direct3D11.Resource resource = SharpDX.Direct3D11.Resource.FromPointer<SharpDX.Direct3D11.Resource>(pResource);
Marshal.Release(pResource);
var texture = resource.QueryInterface<SharpDX.Direct3D11.Texture2D>();

I can get a valid Texture2D, but I don't know if it's possible to convert it to Bitmap1. Both are Resource.

The idea behind this code to initialize the Holographic Space into MonoGame. The GraphicDevice is responsible to

  • Initializes resources
  • Updates resources
  • Updates the HolographicSpace
  • Render the backbuffer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
You can’t perform that action at this time.