Fix formatting on shaders
This commit is contained in:
@@ -1,21 +1,25 @@
|
|||||||
Shader "Oxysoft/Dither" {
|
Shader "Oxysoft/Dither"
|
||||||
Properties {
|
{
|
||||||
_Threshold ("Threshold", Float) = 0.45
|
Properties
|
||||||
_Strength ("Strength", Float) = 0.45
|
{
|
||||||
_Width ("Width", Int) = 0.45
|
_Threshold("Threshold", Float) = 0.45
|
||||||
_Height ("Height", Int) = 0.45
|
_Strength("Strength", Float) = 0.45
|
||||||
_Dither ("Dither", 2D) = "white" {}
|
_Width("Width", Int) = 0.45
|
||||||
_MainTex ("", 2D) = "white" {}
|
_Height("Height", Int) = 0.45
|
||||||
|
_Dither("Dither", 2D) = "white" {}
|
||||||
|
_MainTex("", 2D) = "white" {}
|
||||||
}
|
}
|
||||||
|
|
||||||
SubShader {
|
SubShader
|
||||||
|
{
|
||||||
Lighting Off
|
Lighting Off
|
||||||
ZTest Always
|
ZTest Always
|
||||||
Cull Off
|
Cull Off
|
||||||
ZWrite Off
|
ZWrite Off
|
||||||
Fog { Mode Off }
|
Fog { Mode Off }
|
||||||
|
|
||||||
Pass {
|
Pass
|
||||||
|
{
|
||||||
CGPROGRAM
|
CGPROGRAM
|
||||||
// Upgrade NOTE: excluded shader from DX11, Xbox360, OpenGL ES 2.0 because it uses unsized arrays
|
// Upgrade NOTE: excluded shader from DX11, Xbox360, OpenGL ES 2.0 because it uses unsized arrays
|
||||||
#pragma exclude_renderers flash
|
#pragma exclude_renderers flash
|
||||||
@@ -32,15 +36,18 @@ Shader "Oxysoft/Dither" {
|
|||||||
uniform sampler2D _Dither;
|
uniform sampler2D _Dither;
|
||||||
uniform sampler2D _MainTex;
|
uniform sampler2D _MainTex;
|
||||||
|
|
||||||
float luma(fixed3 color) {
|
float luma(fixed3 color)
|
||||||
|
{
|
||||||
return dot(color, fixed3(0.299, 0.587, 0.114));
|
return dot(color, fixed3(0.299, 0.587, 0.114));
|
||||||
}
|
}
|
||||||
|
|
||||||
float luma(fixed4 color) {
|
float luma(fixed4 color)
|
||||||
|
{
|
||||||
return dot(color.rgb, fixed3(0.299, 0.587, 0.114));
|
return dot(color.rgb, fixed3(0.299, 0.587, 0.114));
|
||||||
}
|
}
|
||||||
|
|
||||||
fixed4 ditherBayer2(fixed2 position, float brightness) {
|
fixed4 ditherBayer2(fixed2 position, float brightness)
|
||||||
|
{
|
||||||
int x = fmod(position.x, 4.0);
|
int x = fmod(position.x, 4.0);
|
||||||
int y = fmod(position.y, 4.0);
|
int y = fmod(position.y, 4.0);
|
||||||
|
|
||||||
@@ -72,7 +79,8 @@ Shader "Oxysoft/Dither" {
|
|||||||
return 1.0;
|
return 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
fixed3 ditherPattern2(fixed2 position, float brightness) {
|
fixed3 ditherPattern2(fixed2 position, float brightness)
|
||||||
|
{
|
||||||
int x = fmod(position.x, _Width);
|
int x = fmod(position.x, _Width);
|
||||||
int y = fmod(position.y, _Height);
|
int y = fmod(position.y, _Height);
|
||||||
|
|
||||||
@@ -86,17 +94,19 @@ Shader "Oxysoft/Dither" {
|
|||||||
return 1.0;
|
return 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
fixed3 ditherBayer(fixed2 position, fixed3 col) {
|
fixed3 ditherBayer(fixed2 position, fixed3 col)
|
||||||
|
{
|
||||||
return col * ditherBayer2(position, luma(col));
|
return col * ditherBayer2(position, luma(col));
|
||||||
}
|
}
|
||||||
|
|
||||||
fixed3 ditherPattern(fixed2 position, fixed3 col) {
|
fixed3 ditherPattern(fixed2 position, fixed3 col)
|
||||||
|
{
|
||||||
return col * ditherPattern2(position, luma(col));
|
return col * ditherPattern2(position, luma(col));
|
||||||
}
|
}
|
||||||
|
|
||||||
fixed4 frag (v2f_img i) : COLOR
|
fixed4 frag(v2f_img i) : COLOR
|
||||||
{
|
{
|
||||||
fixed3 col = tex2D (_MainTex, i.uv).rgb;
|
fixed3 col = tex2D(_MainTex, i.uv).rgb;
|
||||||
return fixed4(ditherPattern(i.pos.xy, col), 1.0);
|
return fixed4(ditherPattern(i.pos.xy, col), 1.0);
|
||||||
}
|
}
|
||||||
ENDCG
|
ENDCG
|
||||||
|
|||||||
@@ -1,19 +1,23 @@
|
|||||||
Shader "Oxysoft/Posterize" {
|
Shader "Oxysoft/Posterize"
|
||||||
Properties {
|
{
|
||||||
_Red ("Red", Int) = 8
|
Properties
|
||||||
_Green ("Green", Int) = 8
|
{
|
||||||
_Blue ("Blue", Int) = 8
|
_Red("Red", Int) = 8
|
||||||
_MainTex ("", 2D) = "white" {}
|
_Green("Green", Int) = 8
|
||||||
|
_Blue("Blue", Int) = 8
|
||||||
|
_MainTex("", 2D) = "white" {}
|
||||||
}
|
}
|
||||||
|
|
||||||
SubShader {
|
SubShader
|
||||||
|
{
|
||||||
Lighting Off
|
Lighting Off
|
||||||
ZTest Always
|
ZTest Always
|
||||||
Cull Off
|
Cull Off
|
||||||
ZWrite Off
|
ZWrite Off
|
||||||
Fog { Mode Off }
|
Fog { Mode Off }
|
||||||
|
|
||||||
Pass {
|
Pass
|
||||||
|
{
|
||||||
CGPROGRAM
|
CGPROGRAM
|
||||||
// Upgrade NOTE: excluded shader from DX11, Xbox360, OpenGL ES 2.0 because it uses unsized arrays
|
// Upgrade NOTE: excluded shader from DX11, Xbox360, OpenGL ES 2.0 because it uses unsized arrays
|
||||||
#pragma exclude_renderers flash
|
#pragma exclude_renderers flash
|
||||||
@@ -27,9 +31,9 @@ Shader "Oxysoft/Posterize" {
|
|||||||
uniform int _Blue;
|
uniform int _Blue;
|
||||||
uniform sampler2D _MainTex;
|
uniform sampler2D _MainTex;
|
||||||
|
|
||||||
fixed4 frag (v2f_img i) : COLOR
|
fixed4 frag(v2f_img i) : COLOR
|
||||||
{
|
{
|
||||||
fixed3 col = tex2D (_MainTex, i.uv).rgb;
|
fixed3 col = tex2D(_MainTex, i.uv).rgb;
|
||||||
fixed4 c = fixed4(0.0, 0.0, 0.0, 1.0);
|
fixed4 c = fixed4(0.0, 0.0, 0.0, 1.0);
|
||||||
c.r = floor(col.r * _Red) / _Red;
|
c.r = floor(col.r * _Red) / _Red;
|
||||||
c.g = floor(col.g * _Green) / _Green;
|
c.g = floor(col.g * _Green) / _Green;
|
||||||
|
|||||||
@@ -1,17 +1,21 @@
|
|||||||
Shader "Oxysoft/RetroPixelMax" {
|
Shader "Oxysoft/RetroPixelMax"
|
||||||
Properties {
|
{
|
||||||
_ColorCount ("Color Count", Int) = 8
|
Properties
|
||||||
_MainTex ("", 2D) = "white" {}
|
{
|
||||||
|
_ColorCount("Color Count", Int) = 8
|
||||||
|
_MainTex("", 2D) = "white" {}
|
||||||
}
|
}
|
||||||
|
|
||||||
SubShader {
|
SubShader
|
||||||
|
{
|
||||||
Lighting Off
|
Lighting Off
|
||||||
ZTest Always
|
ZTest Always
|
||||||
Cull Off
|
Cull Off
|
||||||
ZWrite Off
|
ZWrite Off
|
||||||
Fog { Mode Off }
|
Fog { Mode Off }
|
||||||
|
|
||||||
Pass {
|
Pass
|
||||||
|
{
|
||||||
CGPROGRAM
|
CGPROGRAM
|
||||||
// Upgrade NOTE: excluded shader from DX11, Xbox360, OpenGL ES 2.0 because it uses unsized arrays
|
// Upgrade NOTE: excluded shader from DX11, Xbox360, OpenGL ES 2.0 because it uses unsized arrays
|
||||||
#pragma exclude_renderers flash
|
#pragma exclude_renderers flash
|
||||||
@@ -24,18 +28,20 @@ Shader "Oxysoft/RetroPixelMax" {
|
|||||||
uniform fixed4 _Colors[256];
|
uniform fixed4 _Colors[256];
|
||||||
uniform sampler2D _MainTex;
|
uniform sampler2D _MainTex;
|
||||||
|
|
||||||
fixed4 frag (v2f_img i) : COLOR
|
fixed4 frag(v2f_img i) : COLOR
|
||||||
{
|
{
|
||||||
fixed3 original = tex2D (_MainTex, i.uv).rgb;
|
fixed3 original = tex2D(_MainTex, i.uv).rgb;
|
||||||
|
|
||||||
fixed4 col = fixed4 (0,0,0,0);
|
fixed4 col = fixed4(0,0,0,0);
|
||||||
fixed dist = 10000000.0;
|
fixed dist = 10000000.0;
|
||||||
|
|
||||||
for (int i = 0; i < _ColorCount; i++) {
|
for (int i = 0; i < _ColorCount; i++)
|
||||||
|
{
|
||||||
fixed4 c = _Colors[i];
|
fixed4 c = _Colors[i];
|
||||||
fixed d = distance(original, c);
|
fixed d = distance(original, c);
|
||||||
|
|
||||||
if (d < dist) {
|
if (d < dist)
|
||||||
|
{
|
||||||
dist = d;
|
dist = d;
|
||||||
col = c;
|
col = c;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user