Last active
October 19, 2022 15:03
-
-
Save pixelmager/406b1fdcba02136c836db9663768b871 to your computer and use it in GitHub Desktop.
Unity HDR screenshot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( DoHDRscreenshot ) | |
{ | |
DoHDRscreenshot = false; | |
int w = source.width; | |
int h = source.height; | |
RenderTexture rt_hdr = RenderTexture.GetTemporary( w, h, 0, RenderTextureFormat.ARGBHalf ); | |
Finalpass( source, rt_hdr, bloom_rt, distortion_rt, distparms ); //note: final posteffects pass | |
Texture2D tex_hdr = new Texture2D( rt_hdr.width, rt_hdr.height, TextureFormat.RGBAHalf, false ); | |
Graphics.SetRenderTarget( rt_hdr ); | |
tex_hdr.ReadPixels( new Rect(0,0,rt_hdr.width,rt_hdr.height), 0, 0 ); | |
tex_hdr.Apply(); | |
Color[] cols = tex_hdr.GetPixels(); | |
//note: from http://wiki.unity3d.com/index.php/MiniEXR | |
MiniEXR.MiniEXR.MiniEXRWrite( "hdrshot.exr", (uint)w, (uint)h, cols); | |
RenderTexture.ReleaseTemporary(rt_hdr); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
well that was easy..!