What is the correct way to capture a screenshot of the game to a Texture so that the captured image has post-processing effects applied?
Most documentation suggests using Texture2D.ReadPixels for capturing screenshots, but when I do this the resulting image does not have any post-processing effects applied that the player would norally see applied on the camera.
I am using Post-Processing Stack v2 with the default rendering pipeline in 2019.1.2f1.
I am just taking some guesses here and have never had the need to try it. But you should probably create a render texture and then use Graphics.Blit in OnRenderImage() to fill it with data after all the post processing is done (the script that does that should be last on the camera in the inspector). Then use the code from here c# - Convert RenderTexture to Texture2D - Stack Overflow to turn a render texture into texture2d.
Hope it helps.
This is great, but is there a way to make this work with supersized screenshots? I need to capture screenshots that are larger than my screen resolution and I need them to contain my post effects
[quote=“Mutimir, post:3, topic: 748620, username:Mutimir”]
I am just taking some guesses here and have never had the need to try it. But you should probably create a render texture and then use Graphics.Blit in OnRenderImage() to fill it with data after all the post processing is done (the script that does that should be last on the camera in the inspector). Then use the code from here stackoverflow.com/questions/44264468/convert-rendertexture-to-texture2d to turn a render texture into texture2d.
Hope it helps.
[/quote]/
Out of curiosity, how would one using Graphics.Blit? Do you happen to have a script that could show this?