Search Unity

Unity PhotoCapture.CreateAsync() not capturing holograms?

Discussion in 'VR' started by AndrewCzarnietzki, Apr 12, 2017.

  1. AndrewCzarnietzki

    AndrewCzarnietzki

    Joined:
    Jul 23, 2013
    Posts:
    189
    Hey,

    I am using a variant of the https://developer.microsoft.com/en-us/windows/holographic/locatable_camera_in_unity tutorial, and Unity 5.6.0f1.

    I have PhotoCapture.CreateAsync(true, OnPhotoCaptureCreated) and set the camera parameter's hologramOpacity value to 1.0f.

    I have WebCam and Mic enabled in the publishing settings.

    The hololens headset itself is set to capture holograms under the MRC panel in the developer portal. When I use the developer portal photo capture button, it captures a photo with the hologram overlay. When I use the PhotoCapture.CreateAsync() path in Unity, in creates a photo that is visible in the MRC portal, but there are no holograms visible.

    I'm really not doing anything different than https://forums.hololens.com/discuss...hologram-photo-capture-will-be-enabled#latest and the other searches.

    My understanding is the docs, which say this functionality is disabled, are out of date?

    All I would like to do is capture a photo with the hologram visible.

    Thanks!
     
  2. Unity_Wesley

    Unity_Wesley

    Unity Technologies

    Joined:
    Sep 17, 2015
    Posts:
    558
    You are on the right path, you need to also enable holograms by setting the bool to true when you call PhotoCapture.CreateAsync();

    Here is a snapshot of some of my test code
    upload_2017-4-12_14-6-7.png

    Let me know if you have questions
     
  3. AndrewCzarnietzki

    AndrewCzarnietzki

    Joined:
    Jul 23, 2013
    Posts:
    189
    Thank you for the reply!

    Unfortunately I have that set and still no holograms.

    Here is the relevant parts of my code:

    Code (CSharp):
    1.  
    2.         public void Capture()
    3.         {
    4.             getFolderPath();
    5.             while (!haveFolderPath)
    6.             {
    7.                 Debug.Log("Waiting for folder path...");
    8.             }
    9.  
    10.             Debug.Log("About to call CreateAsync");
    11.             PhotoCapture.CreateAsync(true, OnPhotoCaptureCreated);
    12.             Debug.Log("Called CreateAsync");
    13.         }
    14.  
    15.         async void getFolderPath()
    16.         {
    17.             StorageLibrary myPictures = await Windows.Storage.StorageLibrary.GetLibraryAsync(Windows.Storage.KnownLibraryId.Pictures);
    18.             picturesFolder = myPictures.SaveFolder;
    19.  
    20.             foreach(StorageFolder folder in myPictures.Folders)
    21.             {
    22.                 Debug.Log(folder.Name);
    23.             }
    24.  
    25.             Debug.Log("savePicturesFolder.Path is " + picturesFolder.Path);
    26.             haveFolderPath = true;
    27.         }
    28.  
    29.         void OnPhotoCaptureCreated(PhotoCapture captureObject)
    30.         {
    31.             photoCaptureObject = captureObject;
    32.  
    33.             Resolution cameraResolution = PhotoCapture.SupportedResolutions.OrderByDescending((res) => res.width * res.height).First();
    34.  
    35.             CameraParameters c = new CameraParameters();
    36.             c.hologramOpacity = 1.0f;
    37.             c.cameraResolutionWidth = cameraResolution.width;
    38.             c.cameraResolutionHeight = cameraResolution.height;
    39.             c.pixelFormat = CapturePixelFormat.BGRA32;
    40.  
    41.             captureObject.StartPhotoModeAsync(c, OnPhotoModeStarted);
    42.         }
    43.  
     
  4. Unity_Wesley

    Unity_Wesley

    Unity Technologies

    Joined:
    Sep 17, 2015
    Posts:
    558