Legacy Documentation: Version 4.6(go to latest)
Language: English
  • C#
  • JS
  • Boo

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Camera.OnRenderImage(RenderTexture,RenderTexture)

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual

Description

OnRenderImage is called after all rendering is complete to render image.

Postprocessing effects (Unity Pro only).

It allows you to modify final image by processing it with shader based filters. The incoming image is source render texture. The result should end up in /destination/ render texture. When there are multiple image filters attached to the camera, they process image sequentially, by passing first filter's destination as the source to the next filter.

This message is sent to all scripts attached to the camera.

See Also: The image effects in Unity Pro.

	var mat: Material;

	function OnRenderImage(src: RenderTexture, dest: RenderTexture)
   {
		// Copy the source Render Texture to the destination,
		// applying the material along the way.
		Graphics.Blit(src, dest, mat);
	}
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    public Material mat;
    void OnRenderImage(RenderTexture src, RenderTexture dest) {
        Graphics.Blit(src, dest, mat);
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	public mat as Material

	def OnRenderImage(src as RenderTexture, dest as RenderTexture) as void:
		Graphics.Blit(src, dest, mat)