Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

AR Foundation. Capture Photo or Video of AR Experience for Sharing

Discussion in 'AR' started by plyrek, Jun 10, 2019.

  1. plyrek

    plyrek

    Joined:
    Mar 2, 2015
    Posts:
    15
    Hello,

    I am preparing a proposal for a client and I thought I better check something before I promise I can deliver it. Can you capture a photo or short video of an AR Foundation experience to save to a device to share with others. If so is it a difficult process? Is it documented somewhere? It must be able to be done somehow as Unity themselves shows a video to demonstrate AR Foundation on their website but I don't see it prominently mentioned anywhere on the forums or the Unity site.

    Thank you in advance for your help. :)
     
  2. tdmowrer

    tdmowrer

    Unity Technologies

    Joined:
    Apr 21, 2017
    Posts:
    605
    This sounds like a general Unity question and not specific to ARFoundation. iOS has a built-in mechanism to capture a screen recording. There are many free and paid apps for Android which do this. If you want to capture a Unity app programmatically (which I think is what you want to do), there are 3rd party solutions on the Asset Store. A quick Google search turned up this one, for example.
     
    plyrek likes this.
  3. shacharoz

    shacharoz

    Joined:
    Jul 11, 2013
    Posts:
    98
    sorry but he is right. i am trying in the past few days to understand how to capture the screen and i cant manage to get it.
    - should i use the ARCameraBackground with a Graphics.Blit()?
    - should i direct the render into a renderTexture?
    - should i create another arsession in parallel?

    i managed to copy all the virtual content into a screenshot, but not the augmented one.

    any direction would help thanks
     
  4. cgtinker

    cgtinker

    Joined:
    May 6, 2019
    Posts:
    8
    Here some references, which might be useful for you:
    You can access the Camera image on CPU
    tdmowrer also added a script for saving an image, but there are also other options. b.e. you can also use a unity method for capturing images.
    Code (CSharp):
    1. ScreenCapture.CaptureScreenshotAsTexture()
    As far as I know you can use on iOS the replay kit to record videos.

    Capturing an image works pretty well, however I failed to record a video on android. I tried NatCorder, but it doesn't work with ArCore. If someone got good recording results with ArCore I'd appreciate some advice.
     
  5. shacharoz

    shacharoz

    Joined:
    Jul 11, 2013
    Posts:
    98
    my friend , you are only proving my point :)
    the unity API of ScreenCapture is the expected API that i dream of having. but since ArFoundation uses different computer vision calculations, I expect them to expose a simpler API call for us.

    actually, i have eventually used ScreenCapture, but i had to remove all the redundant UI, make the snap, and then bring the UI again. this is a hassle. we should have a simpler way to do so.
     
  6. DiogoQueiroz

    DiogoQueiroz

    Joined:
    Feb 19, 2019
    Posts:
    9
    It seems that the owner isn't looking for this topic, but I wanna ask. Based on the same issue. Like Pokemon GO, you can open your camera, place the Pokemon on the ground and take a picture of it. As far as I search for it, I couldn't find anything that could help me at all. My idea wasn't to get a screenshot with all the UI there, was simply to take a photo, like your camera could do and save or share somewhere. And Pokemon GO was built in Unity, I would love to learn how they do it.
     
    Siggytron likes this.
  7. Alexis-Dev

    Alexis-Dev

    Joined:
    Apr 16, 2019
    Posts:
    121
    Hi,

    You can disable the UI when you take the screenshot. And enable it when it's done.

    Best,
    Alexis
     
  8. danUnity

    danUnity

    Joined:
    Apr 28, 2015
    Posts:
    229