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

360° Screenshot Capture [Open Source]

Discussion in 'Assets and Asset Store' started by yasirkula, Oct 22, 2017.

  1. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,783
    Hello there!

    Here's a simple script that captures a 360° photo with your Unity camera and injects the necessary XMP metadata to it; so the output image supports 360° viewers on the web out-of-the-box (like Facebook and Flickr). Both JPEG and PNG formats are supported.

    Asset Store: https://assetstore.unity.com/packages/tools/camera/360-screenshot-capture-112864
    Also available at: https://github.com/yasirkula/Unity360ScreenshotCapture
    Discord: https://discord.gg/UJJt549AaV
    GitHub Sponsors ☕

    The raw image is in equirectangular form. Here is an example screenshot (it looks like this when uploaded to Flickr):

    360render.jpeg

    The details are available at the repo (with example code).

    FAQ
    • Objects are rendered inside out in the 360° screenshot
    This is usually caused by 3rd-party plugins that change the value of
    GL.invertCulling
    (e.g. mirrors). See the solution: https://forum.unity.com/threads/360-screenshot-capture-open-source.501310/#post-7078093

    Enjoy!
     
    Last edited: May 31, 2023
    tcmeric likes this.
  2. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,783
    Now available on Asset Store!
     
    cybersoft and chelnok like this.
  3. tcmeric

    tcmeric

    Joined:
    Dec 21, 2016
    Posts:
    190
    yasirkula likes this.
  4. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,783
    That's really cool! Thank you for creating this extension :)
     
    tcmeric likes this.
  5. V4vent

    V4vent

    Joined:
    Oct 15, 2016
    Posts:
    3
    I installed this plugin yesterday. It 's very cool and it works fine.
     
    yasirkula likes this.
  6. twitchfactor

    twitchfactor

    Joined:
    Mar 8, 2009
    Posts:
    356
    Installed and tried it out. After turning off motion blur (which messes up your screen capture), unfortunately the shot has taken every single polygon and turned them inside out. :(
     

    Attached Files:

  7. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,783
  8. twitchfactor

    twitchfactor

    Joined:
    Mar 8, 2009
    Posts:
    356
    Tried that. Only slightly better.
     
  9. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,783
    I'm simply calling Unity's RenderToCubemap function to render the 360 image. I'm afraid I've no control over the internal rendering process.
     
  10. renderbydavid

    renderbydavid

    Joined:
    May 18, 2017
    Posts:
    2
    hey where does the 360 screenshot get saved to?
     
  11. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,783
  12. shubh143

    shubh143

    Joined:
    Jun 1, 2017
    Posts:
    7
    Can you please tell me how should i render the image in a sphere properly
     
  13. shubh143

    shubh143

    Joined:
    Jun 1, 2017
    Posts:
    7
    Here's the image that i captured from my android phone i tried to render it in 360 but it's not coming properly
     

    Attached Files:

  14. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,783
  15. sam_cygnops

    sam_cygnops

    Joined:
    Dec 16, 2019
    Posts:
    4
    I did that but images is
    I captured this image using ARFoundation Camera from my mobile device i think that's the problem is there any way i can capture the panorama image from my mobile camera
     
    Last edited: Apr 27, 2020
  16. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,783
    I have no experience with 360 image capture using device's camera, so I can't help with that. My plugin captures in-game 360 image using in-game Camera.
     
  17. sam_cygnops

    sam_cygnops

    Joined:
    Dec 16, 2019
    Posts:
    4
    Can we capture a panorama image from your native camera plugin?
     
  18. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,783
    If the native camera app supports panorama capture, you should be but there is no parameter to force the camera to capture a panorama image. So users would probably have to switch to panorama mode manually once the camera is opened.
     
  19. matiasup

    matiasup

    Joined:
    Feb 22, 2013
    Posts:
    5
    Hello, great asset thanks! I'm having an issue when taking many screenshots one after the other. What i'm doing is that i'm moving the camera and taking screenshots, let's say 1000 pictures. The problem is that my RAM memory explodes and I can't see why this is happening. Do you have any suggestion? Thanks
     
  20. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,783
    Plugin destroys the temporary textures after capturing a screenshot, so AFAIK, it shouldn't leak any memory. Are you keeping a reference to the returned byte[] objects or maybe converting them to textures but not destroying these textures?
     
  21. lbutler0000107

    lbutler0000107

    Joined:
    Aug 18, 2020
    Posts:
    2
    Hello, your asset is working great except for one issue: you say I can have a screenshot up to (width) 8192px, however, if I select a size bigger than 4096px, the image that is produced is just black. Is there a setting I am missing? Thanks!
     
  22. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,783
    Not that I know of. Probably Unity's RenderToCubemap function itself is failing which I have no control over.

    P.S. I'm guessing that no error messages are logged.
     
  23. lbutler0000107

    lbutler0000107

    Joined:
    Aug 18, 2020
    Posts:
    2
    Yes, there are no error messages; it just outputs a completely black image. Thanks for the quick reply.
     
  24. mgolino3

    mgolino3

    Joined:
    Mar 15, 2019
    Posts:
    9
    @yasirkula I'm experiencing something strange with your plugin and was wondering if you had any thoughts. When I first used the plugin in my project a few months ago it produced images exactly like in your sample photo, however now it outputs images like this:

    upload_2021-2-3_20-0-39.png

    Upside down, repeated, scattered, and not rendering the terrain...any idea in the world what may be going on?

    Unity version: 2019.4.3f1
     
  25. mgolino3

    mgolino3

    Joined:
    Mar 15, 2019
    Posts:
    9
    For the sake of anyone that comes after me...I got it to work although I don't exactly understand what was wrong.
    Unity told me I had the latest version of the plugin, but on a hunch I just deleted it from my project and redownloaded it and it worked again...so basically something got broke somewhere in there and a redownload fixed it.

    @yasirkula thanks for the great and simple and free plugin - you rock!
     
    yasirkula likes this.
  26. akash437

    akash437

    Joined:
    Jun 28, 2013
    Posts:
    6
    when I set the image width to 4000 it crashes on some devices even though the device's maxcubemap size is 16k, 2000 works on every device but the quality is not good. Is there a way to find out what devices are compatible with 4k image width, before calling the capture function ?
     
  27. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,783
    Camera.RenderToCubemap must be the culprit here. I didn't research about this topic but I find it likely to find such a function for Camera.RenderToCubemap.
     
  28. Alaadel

    Alaadel

    Joined:
    Apr 6, 2013
    Posts:
    25
    Thank you for the asset.

    I am using this shader for Reflections. (drag&drop the script to the object you want. Explanation here)
    When the reflections script is Off, I get correct results.
    When the reflections script is On, normal objects turn black, and the floor (which I attached the shader to) is not visible. The floor is supposed to be under the sphere, but it doesn't show in the output image:
    img.png


    Everything renders fine to the main camera on the game window.
     
  29. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,783
  30. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,783
    FYI, making the following change recommended here has worked for me while using a simple mirror shader:
    Code (CSharp):
    1. bool prevInvertCulling = GL.invertCulling;
    2. GL.invertCulling = true;
    3. ...
    4. GL.invertCulling = prevInvertCulling; // <- Changed it from "GL.invertCulling = false;" or "GL.SetRevertBackfacing(false);"
     
    Last edited: Apr 26, 2021
  31. K_Kuriyama

    K_Kuriyama

    Joined:
    Jul 4, 2020
    Posts:
    65
    @yasirkula

    I am using it in the environment of Unity2021.3.4 + WebGL + iOS15.5, but Safari crashes when I execute "I360Render.Capture ()".
    It works fine on Android and Windows.

    Is it possible to solve this problem?
     
  32. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,783
    I honestly haven't tested the plugin on mobile browsers. Browser might be running out of memory, so I'd recommend increasing the game's memory size from Player Settings, if there is such setting.
     
  33. artofmining

    artofmining

    Joined:
    May 1, 2016
    Posts:
    60
    Hello there, I have been using your i360 render script for some time and has been a GREAT asset to have! So thank you !!
    I have one question about a scaling issues IF possible I would like to solve.
    I use the 360 render to generate equirectangular images for virtual tours that are viewed in a 2D screen environment or via facebook. They work great and look to correct scale!

    I want to view them using a VR headset which I am able to do so however the WORLD SCALE is incorrect when I view a 360. Everything looks much bigger!

    Is there a way to compensate the scaling such that when the images are viewed using a headset they will look in correct proportion and scale?

    I have tried using a sphere encompassing the VR camera and adjusting the 360 image by scaling the sphere but its not consistent nor accurate.

    Glad to pay for such a solution !

    Cheers
    AOM
     
  34. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,783
    Hi! Are you able to reproduce this problem with other 360 images online or does it consistently only occur for I360 screenshots? The plugin uses Camera.RenderToCubemap and a cubemap-to-equirectangular converter and to my knowledge, both of these are FOV independent. I can't think of anything that could cause a problem for the time being.
     
    artofmining likes this.
  35. artofmining

    artofmining

    Joined:
    May 1, 2016
    Posts:
    60
    I think it's more a global problem but research says its the "lens" used when the shot is taken. Its mix with other 360 images sometimes they scale sometimes not. Once again that maybe due the camera. I was hoping since I360 is a virtual camera there could be a way of tweaking such. Maybe the FOV ?
     
  36. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,783
    artofmining likes this.
  37. artofmining

    artofmining

    Joined:
    May 1, 2016
    Posts:
    60
  38. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,783
    I don't know exactly what 75f represents :p I've copied the XMP metadata from existing 360 images but I don't know what some of the fields represent. I'm unsure how FOV (75f) is represented in XMP metadata.
     
    Last edited: Jan 19, 2023