Skip to content

Instantly share code, notes, and snippets.

@enue
Last active March 1, 2017 23:31
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save enue/c2130a3653871d6f9f42212485311fd1 to your computer and use it in GitHub Desktop.
[Unity]陽炎エフェクト
using System;
using UnityEngine;
using UnityStandardAssets.ImageEffects;
namespace TSKT
{
[AddComponentMenu("TSKT/Image Effects/HeatShimmer")]
[RequireComponent(typeof(Camera))]
public class HeatShimmer : ImageEffectBase
{
void OnRenderImage(RenderTexture source, RenderTexture destination)
{
Graphics.Blit(source, destination, material);
}
}
}
Shader "TSKT/Hidden/HeatShimmer"
{
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader {
Pass {
ZTest Always Cull Off ZWrite Off
CGPROGRAM
#pragma vertex vert_img
#pragma fragment frag
#include "UnityCG.cginc"
#include "ClassicNoise3D.cginc"
uniform sampler2D _MainTex;
fixed4 frag (v2f_img i) : SV_Target
{
float noise = cnoise(float3(i.uv.x * 10, i.uv.y * 10, _Time.y));
fixed2 uv = i.uv;
uv.y += noise * 0.01;
return tex2D(_MainTex, uv);
}
ENDCG
}
}
Fallback off
}
@enue
Copy link
Author

enue commented Mar 1, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment