Skip to content

Instantly share code, notes, and snippets.

@sneha-belkhale
Created June 17, 2019 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sneha-belkhale/5a619db96a148c3a7c558de5178d1852 to your computer and use it in GitHub Desktop.
Save sneha-belkhale/5a619db96a148c3a7c558de5178d1852 to your computer and use it in GitHub Desktop.
Camera component that goes with the post-processing outline shader for Unity.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PostEffect : MonoBehaviour
{
Camera AttachedCamera;
public Shader PostOutline;
public Material PostMat;
void Start()
{
AttachedCamera = GetComponent<Camera>();
AttachedCamera.depthTextureMode = DepthTextureMode.Depth;
PostMat = new Material(PostOutline);
}
void OnRenderImage(RenderTexture source, RenderTexture destination)
{
Graphics.Blit(source, destination, PostMat);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment