0
在我的項目中,我需要獲取正在顯示的屏幕的亮度。要做到這一點,我得到的屏幕快照,並使其作爲一個Texture2D獲取顯示屏幕或Texture2D的亮度 - Unity3D
要獲取快照,並將其轉換我用這個:
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);
}
,但我仍然需要得到亮度。
任何建議將被接受(關於亮度和/或關於轉換)。
在此先感謝。