void OnEnable() { m_quad = FrameCapturerUtils.CreateFullscreenQuad(); m_mat_copy = new Material(m_sh_copy); ResetRecordingState(); }
void OnEnable() { System.IO.Directory.CreateDirectory(m_output_directory); m_cam = GetComponent <Camera>(); m_quad = FrameCapturerUtils.CreateFullscreenQuad(); m_mat_copy = new Material(m_sh_copy); if (m_cam.targetTexture != null) { m_mat_copy.EnableKeyword("OFFSCREEN"); } if (m_capture_framebuffer) { int tid = Shader.PropertyToID("_TmpFrameBuffer"); m_cb = new CommandBuffer(); m_cb.name = "ExrCapturer: copy frame buffer"; m_cb.GetTemporaryRT(tid, -1, -1, 0, FilterMode.Point); m_cb.Blit(BuiltinRenderTextureType.CurrentActive, tid); // tid は意図的に開放しない m_cam.AddCommandBuffer(CameraEvent.AfterEverything, m_cb); m_frame_buffer = new RenderTexture(m_cam.pixelWidth, m_cam.pixelHeight, 0, RenderTextureFormat.ARGBHalf); m_frame_buffer.wrapMode = TextureWrapMode.Repeat; m_frame_buffer.Create(); } if (m_capture_gbuffer && m_cam.renderingPath != RenderingPath.DeferredShading && (m_cam.renderingPath == RenderingPath.UsePlayerSettings && PlayerSettings.renderingPath != RenderingPath.DeferredShading)) { Debug.Log("ExrCapturer: Rendering path must be deferred to use capture_gbuffer mode."); m_capture_gbuffer = false; } if (m_capture_gbuffer) { m_gbuffer = new RenderTexture[4]; m_rt_gbuffer = new RenderBuffer[4]; for (int i = 0; i < m_gbuffer.Length; ++i) { m_gbuffer[i] = new RenderTexture(m_cam.pixelWidth, m_cam.pixelHeight, 0, RenderTextureFormat.ARGBHalf); m_gbuffer[i].filterMode = FilterMode.Point; m_gbuffer[i].Create(); m_rt_gbuffer[i] = m_gbuffer[i].colorBuffer; } { RenderTextureFormat format = m_depth_format == DepthFormat.Half ? RenderTextureFormat.RHalf : RenderTextureFormat.RFloat; m_depth = new RenderTexture(m_cam.pixelWidth, m_cam.pixelHeight, 0, format); m_depth.filterMode = FilterMode.Point; m_depth.Create(); } } FrameCapturer.fcExrConfig conf; conf.max_active_tasks = m_max_active_tasks; m_exr = FrameCapturer.fcExrCreateContext(ref conf); }
void OnEnable() { System.IO.Directory.CreateDirectory(m_output_directory); m_quad = FrameCapturerUtils.CreateFullscreenQuad(); m_mat_copy = new Material(m_sh_copy); m_scratch_buffers = new RenderTexture[m_targets.Length]; for (int i = 0; i < m_scratch_buffers.Length; ++i) { var rt = m_targets[i].target; m_scratch_buffers[i] = new RenderTexture(rt.width, rt.height, 0, rt.format); } FrameCapturer.fcExrConfig conf; conf.max_active_tasks = m_max_active_tasks; m_exr = FrameCapturer.fcExrCreateContext(ref conf); }
void OnEnable() { m_cam = GetComponent <Camera>(); m_quad = FrameCapturerUtils.CreateFullscreenQuad(); m_mat_copy = new Material(m_sh_copy); if (m_cam.targetTexture != null) { m_mat_copy.EnableKeyword("OFFSCREEN"); } { int tid = Shader.PropertyToID("_TmpFrameBuffer"); m_cb = new CommandBuffer(); m_cb.name = "GifCapturer: copy frame buffer"; m_cb.GetTemporaryRT(tid, -1, -1, 0, FilterMode.Point); m_cb.Blit(BuiltinRenderTextureType.CurrentActive, tid); // tid は意図的に開放しない m_cam.AddCommandBuffer(CameraEvent.AfterEverything, m_cb); } ResetRecordingState(); }