I woould love to see Photo Mode for mobile games as well.
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.
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
using PhotoMode;
namespace PhotoMode
{
public class BlitRenderPass : ScriptableRenderPass
{
public Material blitMaterial = null;
public RenderTargetIdentifier source;
// change to RTHandle
RTHandle temporaryColorTexture;
RTHandle destinationTexture;
// add RTHandle to hold the camera source
RTHandle rtSource;
string profilerTag;
//Default constructor for the Blit Render Pass
public BlitRenderPass(RenderPassEvent renderPassEvent, Material blitMat, string tag)
{
this.renderPassEvent = renderPassEvent;
blitMaterial = blitMat;
profilerTag = tag;
RTHandles.Alloc("_TemporaryColorTexture", name: "_TemporaryColorTexture");
RTHandles.Alloc("_AfterPostProcessTexture", name: "_AfterPostProcessTexture"));
}
//Override the Execute function decalared in the scriptable render pass class.
//Any code in here will execute as part of the rendering process.
public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
{
//Create a command buffer, a list of graphical instructions to execute
CommandBuffer cmd = CommandBufferPool.Get(profilerTag);
RenderTextureDescriptor opaqueDesc = renderingData.cameraData.cameraTargetDescriptor;
opaqueDesc.depthBufferBits = 0;
// // Get destination texture
cmd.GetTemporaryRT(Shader.PropertyToID(destinationTexture.name), opaqueDesc, FilterMode.Point);
// Get a temporary render texture
cmd.GetTemporaryRT(Shader.PropertyToID(temporaryColorTexture.name), opaqueDesc);
// Set an RTHandle to handle the camera "source"
// via https://www.cyanilux.com/tutorials/custom-renderer-features/#blit
var renderer = renderingData.cameraData.renderer;
RTHandle rtSource = renderer.cameraColorTargetHandle;
//Copy what the camera is rendering to the render texture and apply the blit material
Blit(cmd, rtSource, temporaryColorTexture, blitMaterial);
//Copy what the temporary render texture is rendering back to the camera
Blit(cmd, temporaryColorTexture, rtSource); //
//Execute the graphic commands
context.ExecuteCommandBuffer(cmd);
//Release the command buffer
CommandBufferPool.Release(cmd);
}
public override void FrameCleanup(CommandBuffer cmd)
{
//Release temporary Render Textures
//cmd.ReleaseTemporaryRT(destinationTexture.id);
cmd.ReleaseTemporaryRT(Shader.PropertyToID(destinationTexture.name));
//cmd.ReleaseTemporaryRT(temporaryColorTexture.id);
cmd.ReleaseTemporaryRT(Shader.PropertyToID(temporaryColorTexture.name));
}
}
}
hdrp???
https://assetstore.unity.com/packages/tools/camera/photo-session-227393#description
Rowlan made something cross pipeline and platform.
No thanks, boasting as an open source asset then removing all source code is not something I’ll support
It was free for more than a year, but keeping on updating for free in my spare time just isn’t feasible.
Which is okay, but removing all open source code is not
Nothing prevents you from taking Unity’s Photo Mode code, spending your spare time with improving it and updating it and providing the work you did in your spare time for free for the community. The additional benefit is that you can teach yourself all kinds of things, including Shader programming.
Photo Mode could certainly benefit from an update, current status:
I suggest you first change the core to make the code Render Pipeline agnostic, then plug in Built-In and HDRP 14, HDRP 15, HDRP 16, HDRP 17 and what else comes around. The information about the specifics of each major/minor release is available on the internet. But do keep in mind that Unity 6 is also available, so your code should work with that as well.
Oh, and I also suggest to support CineMachine 3 since Photo Mode uses CineMachine 2. CineMachine 3 is awesome, it’s the future. But keep in mind to stay backwards compatible and also support CineMachine 2. You should create an abstraction for that as well, because those 2 versions aren’t compatible with each other.