Created
December 25, 2017 17:57
-
-
Save KumoKairo/fc1289708dd0fe336027958a39caf996 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Gameboy" | |
{ | |
... | |
sampler2D _MainTex; | |
float4 _Darkest, _Dark, _Ligt, _Ligtest; | |
float4 frag (v2f i) : SV_Target | |
{ | |
float4 originalColor = tex2D(_MainTex, i.uv); | |
float luma = dot(originalColor.rgb, float3(0.2126, 0.7152, 0.0722)); | |
float posterized = floor(luma * 4) / (4 - 1); | |
float lumaTimesThree = posterized * 3.0; | |
float darkest = saturate(lumaTimesThree); | |
float4 color = lerp(_Darkest, _Dark, darkest); | |
float light = saturate(lumaTimesThree - 1.0); | |
color = lerp(color, _Ligt, light); | |
float lightest = saturate(lumaTimesThree - 2.0); | |
color = lerp(color, _Ligtest, lightest); | |
return color; | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment