Skip to content

Instantly share code, notes, and snippets.

@sugi-cho
Last active August 25, 2019 18:58
Show Gist options
  • Save sugi-cho/ba27db81936a3f4e6801 to your computer and use it in GitHub Desktop.
Save sugi-cho/ba27db81936a3f4e6801 to your computer and use it in GitHub Desktop.
しんぷる
using UnityEngine;
using System.Collections;
public class AfterEffect : MonoBehaviour {
public Material m,
public Material[] targetMats;
public string propName = "_Tex";
RenderTexture rt;
void OnRenderImage(RenderTexture src, RenderTexture dst){
if (rt == null) {
rt = new RenderTexture(src.width, src.height, 0, src.format);
foreach(Material targetMat in targetMats)
targetMat.SetTexture(propName, rt);
}
Graphics.Blit(src, rt, m);
Graphics.Blit (rt, dst);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment