Legacy Documentation: Version 2018.2 (Go to current version)
LanguageEnglish
  • C#

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

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> 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.

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. You must always issue a Graphics.Blit() or render a fullscreen quad if your override this method.

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: Writing Post-Processing Effects.

using UnityEngine;

public class Example : MonoBehaviour { Material material;

void OnRenderImage(RenderTexture source, RenderTexture destination) { // Copy the source Render Texture to the destination, // applying the material along the way. Graphics.Blit(source, destination, material); } }
对文档有任何疑问,请移步至开发者社区提问,我们将尽快为您解答