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

Official Introducing Photo Mode — our new in-game photography demo

Discussion in 'Community Learning & Teaching' started by ashley_unity, Aug 26, 2021.

  1. ashley_unity

    ashley_unity

    Unity Technologies

    Joined:
    Dec 18, 2016
    Posts:
    21
    Our latest sample project brings you a virtual photography system for customizing in-game screenshots. Read on to see where you can get the demo and learn more.





    To help game makers learn how to add photography options to their projects, we’re releasing the Photo Mode demo project. It’s available now for PC and console Unity projects using the Universal Render Pipeline.

    The demo contains a collection of camera, image adjustment, & UI behaviors that enable players to enter a customizable photography mode and prep their game environment for the perfect screenshot. Its primary features include:
    • The ability to change camera rotation, height, roll, & distance
    • Post-processing effects like aperture, exposure, contrast, & saturation
    • Overlays for vignettes and frames
    • A system for applying shader-based photo filter effects
    • Custom sticker system for editing and applying images to your photo
    • Options to reset your changes, use a rule-of-thirds grid, and hide the UI




    To learn more about how Photo Mode works and what Unity features it uses, check out our overview on the Unity Blog. You can find the project, its Unity package, and documentation over on GitHub.

    Feel free to leave any questions or comments you have in the replies below, we’d love to hear your feedback!
     
    Last edited: Aug 26, 2021
  2. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    738
    Why is this not on package manager?
    Would have an easier time with dependencies.
     
  3. ashley_unity

    ashley_unity

    Unity Technologies

    Joined:
    Dec 18, 2016
    Posts:
    21
    Hi, @Gekigengar! Photo Mode is a demo project for reference / education purposes, rather than a full-fledged feature. We are not currently planning for this to be built-in to the editor or added to the Package Manager.
     
  4. blackbird

    blackbird

    Joined:
    Aug 9, 2011
    Posts:
    590
    does it work with HDRP ?
     
  5. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    592
    A wonderful light job for URP studies.
    Photomode is such a powerful marketing tool.

    Well worth the study
     
    ashley_unity likes this.
  6. ashley_unity

    ashley_unity

    Unity Technologies

    Joined:
    Dec 18, 2016
    Posts:
    21
    It only supports URP for now.
     
    blackbird likes this.
  7. DenizCetinalp

    DenizCetinalp

    Joined:
    Feb 8, 2014
    Posts:
    16
    Looks awesome. Please consider support for HDRP.
     
    newguy123 and ashley_unity like this.
  8. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    738
    upload_2021-8-27_2-11-7.png
    Isn't the game foundation package reference/education purpose as well?
     
  9. ashley_unity

    ashley_unity

    Unity Technologies

    Joined:
    Dec 18, 2016
    Posts:
    21
    Game Foundation is a larger system that's being implemented as an official feature. Photo Mode was created to just be an example project, though it's good to know there's interest in an official implementation. Thank you :)
     
    RatherGood, JesOb and Gekigengar like this.
  10. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    738
    Yes, because this is pretty awesome, definitely don't want to see this break away with new Unity versions, and get deprecated like every other project that isn't listed in the package manager.

    For once, Unity pumps out a package that feels like an awesome asset store package that might be useful in almost every game as a starting point to implementing photo mode feature.

    Its almost as weird as seeing the new Starter Asset not included in the package manager.
     
  11. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,178
    Why not? I've been using my own free tool Photo Session for quite some time now and it's actually a lot of fun to pause and fly around and take screenshots. I created it to make better looking screenshots, especially close up ones.

    All the time I've been thinking: Why does Unity not have something like that? It's trivial to code. With such a tool people can make better screenshots than just in-game. Better screenshots would also advertise publisher assets for one and Unity overall for the other.

    Now that I've seen this I'm wondering a few things still:

    * why limit yourself to URP?
    * why can't I just free-fly around with the in-game camera?
    * why is the setup so tedious?

    I really hope Unity improves on this and not just keeps this experimental tool on a shelf where nobody finds nor uses it. I really don't want to put work into this myself, but rather have Unity see to it that the platform's users get the tools they want and need.
     
    cloverme, vertexx and Daftolddad like this.
  12. vertexx

    vertexx

    Joined:
    Mar 18, 2014
    Posts:
    373
    Always nice to get these Unity free gifts! Many thanks, and the same to "Rowlan" for his free gift as well! Wow..Great work.
     
    Rowlan likes this.
  13. cloverme

    cloverme

    Joined:
    Apr 6, 2018
    Posts:
    192
    At every Unite... "HDRP is the future"

    Every native Unity development tool.... "No HDRP support"

    Every Unity youtube video: "Use assets from the asset store to speed up your development"

    Every Asset store developer: "Why doesn't Unity have this?"

    Every indiegame dev: "Why doesn't Unity have this?"
     
  14. cloverme

    cloverme

    Joined:
    Apr 6, 2018
    Posts:
    192
    Ah, there you are! The hero we need showing up in every critical thread :D Nice work!!!
     
    newguy123 and Rowlan like this.
  15. MAN_Schubert

    MAN_Schubert

    Joined:
    Mar 12, 2020
    Posts:
    8
    Anyway possible to port this to Unity 2019?
     
  16. Shashimee

    Shashimee

    Joined:
    Nov 1, 2017
    Posts:
    7
    I just added the Photo Mode in my game and it saved a lot of time. It wasn't tedious to implement at all.
    Are you going to improve this with feedbacks ? Or can I safely modify the code to my needs ?
     
  17. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    592
    Since it's a demonstration and not an actual feature, I'd honestly say have at it. I'd check the terms if there are any just to be sure.
    future tweaks and stuff are sure to come but I'd say right now it's certainly WYSIWYG since it's under the learning and teaching forum.
     
  18. TimDoesDev

    TimDoesDev

    Joined:
    Feb 23, 2018
    Posts:
    35
    It's a great feature but I feel like HDRP is constantly being neglected. We run HDRP for our game Far North and can't utilize this fantastic asset because of that which is such a shame.
     
    cloverme and newguy123 like this.
  19. crr-1206

    crr-1206

    Joined:
    Jun 8, 2022
    Posts:
    1
    Hi, I am trying to implement this mode in my Unity 2021 project, all the functions are correct, but the filters are not working, why is this happening? I tested in Unity 2020 and everything works as expected, so I guess it's something in the 2021 version.
     
  20. Commander_RT

    Commander_RT

    Joined:
    Nov 24, 2021
    Posts:
    2
    Same to me
     
  21. M_MG_S

    M_MG_S

    Joined:
    Aug 11, 2023
    Posts:
    12
    I woould love to see Photo Mode for mobile games as well.
     
  22. alienorbit

    alienorbit

    Joined:
    May 1, 2013
    Posts:
    34
    FYI - after some hair pulling, I finally got this (mostly?) working in Unity 2022.3, URP v14 by sorting out RTHandle errors. Replace the code in BlitRenderPass.cs with the code below.

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.Rendering;
    3. using UnityEngine.Rendering.Universal;
    4. using PhotoMode;
    5.  
    6. namespace PhotoMode
    7. {
    8.  
    9.     public class BlitRenderPass : ScriptableRenderPass
    10.     {
    11.         public Material blitMaterial = null;
    12.         public RenderTargetIdentifier source;
    13.  
    14.         // change to RTHandle
    15.         RTHandle temporaryColorTexture;
    16.         RTHandle destinationTexture;
    17.  
    18.         // add RTHandle to hold the camera source
    19.         RTHandle rtSource;
    20.  
    21.         string profilerTag;
    22.  
    23.         //Default constructor for the Blit Render Pass
    24.         public BlitRenderPass(RenderPassEvent renderPassEvent, Material blitMat, string tag)
    25.         {
    26.             this.renderPassEvent = renderPassEvent;
    27.             blitMaterial = blitMat;
    28.             profilerTag = tag;
    29.             RTHandles.Alloc("_TemporaryColorTexture", name: "_TemporaryColorTexture");
    30.             RTHandles.Alloc("_AfterPostProcessTexture", name: "_AfterPostProcessTexture"));
    31.         }
    32.  
    33.         //Override the Execute function decalared in the scriptable render pass class.
    34.         //Any code in here will execute as part of the rendering process.
    35.         public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
    36.         {
    37.             //Create a command buffer, a list of graphical instructions to execute
    38.             CommandBuffer cmd = CommandBufferPool.Get(profilerTag);
    39.  
    40.             RenderTextureDescriptor opaqueDesc = renderingData.cameraData.cameraTargetDescriptor;
    41.             opaqueDesc.depthBufferBits = 0;
    42.  
    43.             // // Get destination texture
    44.             cmd.GetTemporaryRT(Shader.PropertyToID(destinationTexture.name), opaqueDesc, FilterMode.Point);
    45.  
    46.             // Get a temporary render texture
    47.             cmd.GetTemporaryRT(Shader.PropertyToID(temporaryColorTexture.name), opaqueDesc);
    48.  
    49.             // Set an RTHandle to handle the camera "source"
    50.             // via https://www.cyanilux.com/tutorials/custom-renderer-features/#blit
    51.  
    52.             var renderer = renderingData.cameraData.renderer;
    53.             RTHandle rtSource = renderer.cameraColorTargetHandle;
    54.  
    55.             //Copy what the camera is rendering to the render texture and apply the blit material
    56.  
    57.             Blit(cmd, rtSource, temporaryColorTexture, blitMaterial);
    58.  
    59.             //Copy what the temporary render texture is rendering back to the camera
    60.             Blit(cmd, temporaryColorTexture, rtSource); //
    61.  
    62.  
    63.             //Execute the graphic commands
    64.             context.ExecuteCommandBuffer(cmd);
    65.  
    66.             //Release the command buffer
    67.             CommandBufferPool.Release(cmd);
    68.         }
    69.  
    70.         public override void FrameCleanup(CommandBuffer cmd)
    71.         {
    72.             //Release temporary Render Textures
    73.             //cmd.ReleaseTemporaryRT(destinationTexture.id);
    74.             cmd.ReleaseTemporaryRT(Shader.PropertyToID(destinationTexture.name));
    75.             //cmd.ReleaseTemporaryRT(temporaryColorTexture.id);
    76.             cmd.ReleaseTemporaryRT(Shader.PropertyToID(temporaryColorTexture.name));
    77.         }
    78.     }
    79. }