Skip to content

Instantly share code, notes, and snippets.

@midoruton
Last active January 13, 2017 16:41
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 midoruton/1afd1c08072502a67a665229c03ecf77 to your computer and use it in GitHub Desktop.
Save midoruton/1afd1c08072502a67a665229c03ecf77 to your computer and use it in GitHub Desktop.
Shader "Custom/NegaLinear" {
Properties{
_MainTex ("Texture", 2D) = "white" {}
_NegaOffs("NegaOffs",Range(-1,1))=1
}
SubShader {
Pass {
CGPROGRAM
#include "UnityCG.cginc"
#pragma vertex vert_img
#pragma fragment frag
sampler2D _MainTex;
float _NegaOffs;
fixed4 frag(v2f_img i) : COLOR{
fixed4 c = tex2D(_MainTex,i.uv);
float3 tex = float3(_NegaOffs,_NegaOffs,_NegaOffs)*(c.rgb-float3(0.5,0.5,0.5))+float3(0.5,0.5,0.5);
c.rgb = tex;
return c;
}
ENDCG
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment