You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
778 B
44 lines
778 B
3 years ago
|
// Colorful FX - Unity Asset
|
||
|
// Copyright (c) 2015 - Thomas Hourdel
|
||
|
// http://www.thomashourdel.com
|
||
|
|
||
|
Shader "Hidden/Colorful/Posterize"
|
||
|
{
|
||
|
Properties
|
||
|
{
|
||
|
_MainTex ("Base (RGB)", 2D) = "white" {}
|
||
|
_Params ("Levels (X) Amount (Y)", Vector) = (4, 1, 0, 0)
|
||
|
}
|
||
|
|
||
|
SubShader
|
||
|
{
|
||
|
Pass
|
||
|
{
|
||
|
ZTest Always Cull Off ZWrite Off
|
||
|
Fog { Mode off }
|
||
|
|
||
|
CGPROGRAM
|
||
|
|
||
|
#pragma vertex vert_img
|
||
|
#pragma fragment frag
|
||
|
#pragma fragmentoption ARB_precision_hint_fastest
|
||
|
#include "UnityCG.cginc"
|
||
|
|
||
|
sampler2D _MainTex;
|
||
|
half2 _Params;
|
||
|
|
||
|
half4 frag(v2f_img i) : SV_Target
|
||
|
{
|
||
|
half4 color = tex2D(_MainTex, i.uv);
|
||
|
half4 posterized = floor(color * _Params.x) / _Params.x;
|
||
|
return lerp(color, posterized, _Params.y);
|
||
|
}
|
||
|
|
||
|
ENDCG
|
||
|
}
|
||
|
}
|
||
|
|
||
|
FallBack off
|
||
|
}
|
||
|
|