Exemple #1
0
        private void GenerateCubemap()
        {
            var camera  = _camera ? _camera : SceneView.lastActiveSceneView.camera;
            var cubemap = _cubemap ? _cubemap : new Cubemap(128, TextureFormat.RGBAHalf, false);

            camera.RenderToCubemap(cubemap);

            var tex = TextureHelper.ConvertCubemap2Texture2D(cubemap);

            // File.WriteAllBytes(EditorUtility.SaveFilePanelInProject("保存 Cubemap", "Cubemap.exr", "exr", ""), tex.EncodeToEXR());
            File.WriteAllBytes(EditorUtility.SaveFilePanelInProject("保存 Cubemap", "Cubemap.png", "png", ""), tex.EncodeToPNG());
        }