In my project, I need to get the brightness of the screen that is being displayed. to do that, I get a snapshot of the screen and make it as a Texture2D
To get the snapshot and convert it I use this:
public void GetScreen(ref Texture2D screenShot){
RenderTexture rt = new RenderTexture(Screen.Width, Screen.Height, 24);
camera.targetTexture = rt;
screenShot = new Texture2D(Screen.Width, Screen.Height, TextureFormat.RGB24, false);
camera.Render();
RenderTexture.active = rt;
screenShot.ReadPixels(new Rect(0, 0, Sreen.Width, Screen.Height), 0, 0);
camera.targetTexture = null;
RenderTexture.active = null;
Destroy(rt);
}
but I still need to get the brightness.
Any suggestions will be accepted (about the brightness and/or about the conversion).
Thanks in advance.