Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

PhotoCapture size

Discussion in 'VR' started by marjan, Oct 28, 2017.

  1. marjan

    marjan

    Joined:
    Jun 6, 2009
    Posts:
    563
    Hi, i am still on unity 5.6 and don´t want to update Close to a release.

    I am in the Need of letting the user capture a Photo of his view. This works fine with this Code:
    Code (CSharp):
    1. public void takePicture()
    2.     {
    3.      
    4.        
    5.  
    6.             PhotoCapture.CreateAsync(true, delegate (PhotoCapture photoCapture)
    7.         {
    8.             if (photoCapture != null)
    9.             {
    10.                
    11.                 Resolution resolution = PhotoCapture.SupportedResolutions.OrderByDescending(res => res.width * res.height).First();
    12.                 CameraParameters c = new CameraParameters(WebCamMode.PhotoMode);
    13.                 c.hologramOpacity = 0.9f;
    14.                 c.cameraResolutionWidth = resolution.width;
    15.                 c.cameraResolutionHeight = resolution.height;
    16.              
    17.                 c.pixelFormat = CapturePixelFormat.BGRA32;
    18.  
    19.                 m_PhotoCapture = photoCapture;
    20.  
    21.                 m_PhotoCapture.StartPhotoModeAsync(c, OnPhotoModeStarted);
    22.             }
    23.             else
    24.             {
    25.                 Debug.LogError("Failed to create PhotoCapture Instance!");
    26.             }
    27.         });
    28.     }

    However the Hologramm area is rather small. Like on the users view of the device anyways. Hologramm area small, rest of the Picture BIIIGGG. If i go really Close to the holgramm to get a bigger Picture, it gets cropped - and is still small.

    Is there a way around it (zoom, PhotcaptureFrame...) ???
    Or do i Need to crop the result myself (with lots of Trial and error)?

    Thank you for sharing your experience!
     
  2. Unity_Wesley

    Unity_Wesley

    Unity Technologies

    Joined:
    Sep 17, 2015
    Posts:
    558
    You could try using photo projection matrices to capture a very large picture or use a shader that will blend the holographic image to what you want.