Search Unity

[FREE] Photo Session - Ingame Precision Screenshot Utility (Open Source, GitHub)

Discussion in 'Assets and Asset Store' started by Rowlan, Mar 16, 2021.

Thread Status:
Not open for further replies.
  1. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,267
    Photo Session

    Introduction

    Photo Session allows you to pause the game, move around with the camera and capture screenshots. It works in the Editor's Play mode and in the Build.

    Malbers released his awesome Realistic Wolves and I wanted to capture close screenshot of those beautiful furry models. I tried to use NVidia's Ansel for the capturing, but it turned out that Ansel is unsupported for Unity (last update March 2018) and the version on the Unity Asset Store doesn't work for HDRP.

    So I quickly coded this tool.

    Example:

    wolfy-example.jpg

    I know it's not much code, but I needed it and thought some of you guys might have use for it as well, so here it is :)

    Download

    http://bit.ly/PhotoSessionUnity

    Installation and Usage

    Currently the focus is on the Malbers assets, but it should work for other purposes as well. In order to use this, add the PhotoSession script to FreeLookCameraRig (or whatever you use for navigating the main camera).

    add-script.png

    This will provide these settings in the inspector:

    settings.png

    Description of the properties:
    • Toggle Key:
      Is used to toggle between Gameplay and Photo Session mode

    • Photo Camera:
      The camera that's being used for navigating around in the scene in Photo Session mode. This is usually the Main Camera.

    • Other Camera Settings:
      Custom movement sensitivity settings

    • Reuse Previous Camera:
      If enabled, then toggling Game and Photo Session mode will restore the camera transform of the previous session. Otherwise the transform of the current gameplay camera will be used for position and rotation of the Photo Camera

    • Disabled Components:
      In order to have the main camera move around as Photo Camera the gameplay input of that camera needs to be disabled in Photo Session mode. In my case the FreeLookCamera script of the FreeLookCameraRig needs to be disabled.

    Example values:

    settings-example.png

    If you hit play in the Unity Editor or if you start a Build, hit the F12 key (depending on your key setting). The game will be paused. You can capture a screenshot by pressing the left mouse button.

    The captured screenshots will be stored in parallel to the Assets folder in the Editor or in parallel to the data folder in the Build in a dedicated Screenshots folder.

    The size of the screenshots depends on the game window.

    Controls

    The controls are currently minimalistic:
    • press the Toggle Key (in the example case F12) in order to pause the game
    • navigate with the camera using
      • WSAD keys: move vertical and horizontal
      • QE keys: move up/down
      • Mouse: rotate the camera
    • press left mouse button in order to capture and save a screenshot
    • press the Toggle Key to continue the game

    Future Ideas

    This asset was created for personal purposes, but I thought you guys might find use for it, so I made it public. There are a lot of other future possibilities:
    • indicate a camera display using Canvas when in Photo Mode
    • simulate a flash when a screenshot is captured and saved
    • help indicators
    • various settings like fov, view distance
    • various post processing additions like Depth of Field
    • swappable post processing settings
    • use supersize
    • capture stereo
    • capture 360 degree (e. g. using Unity's Frame Recorder)
    • slow down time instead of just pausing
    • ...
    Lots of possibilities. Feel free to fork, enhance and share.

    Limitations

    The functionality currently depends on the Time class and what it provides for pausing a game.

    Credits
     
  2. Swyfft

    Swyfft

    Joined:
    Mar 14, 2019
    Posts:
    55
    I was wondering how you got that wolf closeup :)

    thanks for this!!
     
    Rowlan likes this.
  3. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,267
    I added more features:

    * capture higher than screen resolutions, i. e. you can now render an 8K image even if you don't have an 8K screen
    * simulation of flashlight effect when you capture a screen
    * indicator for photo mode at the bottom right corner

    8K example as attachment to this post.
     

    Attached Files:

    • 8k.jpg
      File size:
      4.3 MB
      Views:
      360
    Last edited: Mar 20, 2021
  4. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,267
    New features:

    * output formats: jpg, png, exr, tga
    * aspect ratio
    * auto setup for the camera
    * auto setup for disabled components
     
  5. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,267
    New features:

    * 10K, 12K and 16K profiles ... because ... why not? :D
    * automatic DoF for HDRP (others will follow, I wanted to see how it looks like)
    * custom time scale (other than 0)
    * extended auto setup blacklist with camera movement scripts from unity hdrp

    Here's an example screenshot with Auto Depth of Field in 4K:

    dragon 4k autodof.jpg
    And attached is the same in 10K.

    In case you'd like to try Auto DoF: You need to provide a HDRP volume with the DoF script in it, the gameobject and/or the script can be hidden. Photo Session finds the DoF script and modifies its visibilities and settings. I've just added it today, so I'm still experimenting. I'm quite happy with it so far. One thing that comes to mind for adding are multiple focus points, currently only the ceter is in focus. Also a focus indicator on the canvas might be nice. And I'll probably also add that you can set a gameobject that'll always be the focus target. And whatever comes to mind while toying around.
     

    Attached Files:

    chelnok and ftejada like this.
  6. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,267
    @YolanOTHER contributed 360 degree capture, thank you very much :)

    New Features:
    * 360 degree capture
    * automatic DoF for URP
    * automatic DoF for Built-In Pipeline

    Some 360 degree examples:

    p1.jpg
    p2.jpg
    p3.jpg
     
    nirvanajie and ftejada like this.
  7. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,267
    I made an extensive video with scene setup and photo session in use. Including some new features like showing a photo frame on the canvas:

     
    dsilverthorn, nirvanajie and ftejada like this.
  8. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,267
    I toyed around with an Auto Focus option, update is already live on GitHub. Many thanks to @bgolus for helping me with with the shader.

    In case anyone wants to try:

    * press F = switch through the focus modes
    * hold M while moving the mouse = set focus point

    The current focus mode options are:

    * off
    * center
    * 4x3 grid
    * 16x9 grid
    * manual



    I'm not sure if I keep the grids, setting the focus manually turned out to be quite handy. I'll probably add near and far focus positions.
     
    nirvanajie and ftejada like this.
  9. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,267
    I updated Photo Session to 0.9.3

    Enhancements:

    * keybinds are now adjustable:

    kb.png

    * specify a layer mask for the autofocus raycast:

    lm.png

    Bugfixes:

    * camera kept on moving forward when photo mode got exited in case the camera got a collider attached
     
    Last edited: Aug 24, 2021
    ftejada likes this.
  10. nankink

    nankink

    Joined:
    May 6, 2017
    Posts:
    15
    I cannot add libraries to the PhotoSession.cs nor any script created inside the PhotoSession folder...
    This is giving me headaches to implement a button in place of a toggle key...
     
  11. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,267
    You need to either make yourself familiar with Assembly Definitions or just copy the github code into your Assets folder and delete the asmdef files.
     
  12. nankink

    nankink

    Joined:
    May 6, 2017
    Posts:
    15
    Copying works like a charm, thanks! I've tried to understand the Assembly Definitons before but couldnt get my head around it.. Probably gonna watch a tutorial or something like that afterwards, I'm in a kinda of hurry right now
     
  13. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,267
    I submitted terrain stamps and needed screenshots for that. In order to make this process more fluent I extended Photo Session to support In-Editor screenshots, i. e. this time directly from within the editor, without hitting play.

    photo session.jpg
    See bottom right. Or to be more precise:

    ps.png

    * 4 slots for saving the camera transform and moving to it
    * textfield for naming the slots
    * popup to select between Scene or Game, i. e. from where the camera transform should be copied
    * Save: save the transform of the game or scene camera
    * Move: move the game camera to the saved transform
    * Capture Screenshot: capture the game window and save the screenshot to disk
    * Reset: resets all camera settings
    * Explorer / Finder: open either last screenshot in explorer / finder or just the screenshots folder

    All of Photo Session directly within the Unity Editor without going into Photo Session mode :)
     
  14. TerraUnity

    TerraUnity

    Joined:
    Aug 3, 2012
    Posts:
    1,251
    Congrats on the release @Rowlan ;)
     
    Rowlan likes this.
  15. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,267
    Photo Session has been submitted to the Asset Store in order to reach a much broader audience and to get more feedback. Thank you very much everyone for using this asset for free and thank you very much for your support!

    I'll ask the moderation to lock the thread and will create a new one once the asset is live.
     
  16. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Asset is now shipped so check out the asset live.
     
    newguy123 and Rowlan like this.
Thread Status:
Not open for further replies.