UnityEngine.Rendering.CommandBuffer.GetTemporaryRT C# (CSharp) Method

GetTemporaryRT() private method

private GetTemporaryRT ( int nameID, int width, int height ) : void
nameID int
width int
height int
return void
        public void GetTemporaryRT(int nameID, int width, int height)
        {
            int antiAliasing = 1;
            RenderTextureReadWrite readWrite = RenderTextureReadWrite.Default;
            RenderTextureFormat format = RenderTextureFormat.Default;
            FilterMode point = FilterMode.Point;
            int depthBuffer = 0;
            this.GetTemporaryRT(nameID, width, height, depthBuffer, point, format, readWrite, antiAliasing);
        }

Same methods

CommandBuffer::GetTemporaryRT ( int nameID, int width, int height, [ depthBuffer, [ filter, [ format, [ readWrite, [ antiAliasing ) : void
CommandBuffer::GetTemporaryRT ( int nameID, int width, int height, int depthBuffer ) : void
CommandBuffer::GetTemporaryRT ( int nameID, int width, int height, int depthBuffer, FilterMode filter ) : void
CommandBuffer::GetTemporaryRT ( int nameID, int width, int height, int depthBuffer, FilterMode filter, RenderTextureFormat format ) : void
CommandBuffer::GetTemporaryRT ( int nameID, int width, int height, int depthBuffer, FilterMode filter, RenderTextureFormat format, RenderTextureReadWrite readWrite ) : void

Usage Example

コード例 #1
3
	// Whenever any camera will render us, add a command buffer to do the work on it
	public void OnWillRenderObject()
	{
		var act = gameObject.activeInHierarchy && enabled;
		if (!act)
		{
			Cleanup();
			return;
		}

		var cam = Camera.current;
		if (!cam)
			return;

		CommandBuffer buf = null;
		// Did we already add the command buffer on this camera? Nothing to do then.
		if (m_Cameras.ContainsKey(cam))
			return;

		if (!m_Material)
		{
			m_Material = new Material(m_BlurShader);
			m_Material.hideFlags = HideFlags.HideAndDontSave;
		}

		buf = new CommandBuffer();
		buf.name = "Grab screen and blur";
		m_Cameras[cam] = buf;

		// copy screen into temporary RT
		int screenCopyID = Shader.PropertyToID("_ScreenCopyTexture");
		buf.GetTemporaryRT (screenCopyID, -1, -1, 0, FilterMode.Bilinear);
		buf.Blit (BuiltinRenderTextureType.CurrentActive, screenCopyID);

		// get two smaller RTs
		int blurredID = Shader.PropertyToID("_Temp1");
		int blurredID2 = Shader.PropertyToID("_Temp2");
		buf.GetTemporaryRT (blurredID, -2, -2, 0, FilterMode.Bilinear);
		buf.GetTemporaryRT (blurredID2, -2, -2, 0, FilterMode.Bilinear);

		// downsample screen copy into smaller RT, release screen RT
		buf.Blit (screenCopyID, blurredID);
		buf.ReleaseTemporaryRT (screenCopyID);

		// horizontal blur
		buf.SetGlobalVector("offsets", new Vector4(2.0f/Screen.width,0,0,0));
		buf.Blit (blurredID, blurredID2, m_Material);
		// vertical blur
		buf.SetGlobalVector("offsets", new Vector4(0,2.0f/Screen.height,0,0));
		buf.Blit (blurredID2, blurredID, m_Material);
		// horizontal blur
		buf.SetGlobalVector("offsets", new Vector4(4.0f/Screen.width,0,0,0));
		buf.Blit (blurredID, blurredID2, m_Material);
		// vertical blur
		buf.SetGlobalVector("offsets", new Vector4(0,4.0f/Screen.height,0,0));
		buf.Blit (blurredID2, blurredID, m_Material);

		buf.SetGlobalTexture("_GrabBlurTexture", blurredID);

		cam.AddCommandBuffer (CameraEvent.AfterSkybox, buf);
	}
All Usage Examples Of UnityEngine.Rendering.CommandBuffer::GetTemporaryRT