Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions Game.Assets/sdn/shaders/g_bloom_gl460.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#version 460

layout(location = 0) in vec2 vs_TexCoord;

layout(std140, binding = 6) uniform source_ps_constants {
vec4 ps_const[256];
};

out vec4 fragColor;

layout(binding = 0) uniform sampler2D Bloom;

#define LevelR ps_const[0].x
#define LevelG ps_const[1].x
#define LevelB ps_const[2].x
#define ColorMul ps_const[3].x

void main()
{
vec4 color = texture(Bloom, vs_TexCoord);
vec3 level = color.xyz * vec3(LevelR, LevelG, LevelB);

float grey = (level.r + level.g + level.b) * 0.333333343 * (1.0 - ColorMul);

fragColor = vec4(level * ColorMul + grey, 1.0);
}
25 changes: 25 additions & 0 deletions Game.Assets/sdn/shaders/g_blurx_gl460.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#version 460

layout(location = 0) in vec2 vs_TexCoord;

layout(std140, binding = 6) uniform source_ps_constants {
vec4 ps_const[256];
};

out vec4 fragColor;

layout(binding = 0) uniform sampler2D BaseTextureSampler;

#define BlurSizeH ps_const[0].x

const float tapOffsets[13] = float[](-5.0, -6.0, -4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0);
const float tapWeights[13] = float[](0.00876399968, 0.00221600011, 0.0269949995, 0.0647590011, 0.120985001, 0.176033005, 0.199470997, 0.176033005, 0.120985001, 0.0647590011, 0.0269949995, 0.00876399968, 0.00221600011);

void main()
{
vec4 color = vec4(0.0);
for (int i = 0; i < 13; i++)
color += texture(BaseTextureSampler, vs_TexCoord + vec2(BlurSizeH * tapOffsets[i], 0.0)) * tapWeights[i];

fragColor = color;
}
25 changes: 25 additions & 0 deletions Game.Assets/sdn/shaders/g_blury_gl460.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#version 460

layout(location = 0) in vec2 vs_TexCoord;

layout(std140, binding = 6) uniform source_ps_constants {
vec4 ps_const[256];
};

out vec4 fragColor;

layout(binding = 0) uniform sampler2D BaseTextureSampler;

#define BlurSizeV ps_const[0].x

const float tapOffsets[13] = float[](-5.0, -6.0, -4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0);
const float tapWeights[13] = float[](0.00876399968, 0.00221600011, 0.0269949995, 0.0647590011, 0.120985001, 0.176033005, 0.199470997, 0.176033005, 0.120985001, 0.0647590011, 0.0269949995, 0.00876399968, 0.00221600011);

void main()
{
vec4 color = vec4(0.0);
for (int i = 0; i < 13; i++)
color += texture(BaseTextureSampler, vs_TexCoord + vec2(0.0, BlurSizeV * tapOffsets[i])) * tapWeights[i];

fragColor = color;
}
78 changes: 78 additions & 0 deletions Game.Assets/sdn/shaders/g_bokehblur_gl460.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#version 460

layout(location = 0) in vec2 vs_TexCoord;

layout(std140, binding = 6) uniform source_ps_constants {
vec4 ps_const[256];
};

out vec4 fragColor;

layout(binding = 0) uniform sampler2D _Sampler;
layout(binding = 1) uniform sampler2D _Depth;

#define g_TexelSize ps_const[0].xy
#define g_Radius ps_const[1].x
#define g_FocusPoint ps_const[2].x
#define g_FocusRadius ps_const[3].x

const vec3 lumWeights = vec3(0.212599993, 0.715200007, 0.0722000003);

const vec3 kernel[60] = vec3[](
vec3(0.216499999, 0.125, 1.0), vec3(0.0, 0.25, 1.0), vec3(-0.216499999, 0.125, 1.0),
vec3(-0.216499999, -0.125, 1.0), vec3(0.0, -0.25, 1.0), vec3(0.216499999, -0.125, 1.0),
vec3(0.432999998, 0.25, 1.0), vec3(0.0, 0.5, 1.0), vec3(-0.432999998, 0.25, 1.0),
vec3(-0.432999998, -0.25, 1.0), vec3(0.0, -0.5, 1.0), vec3(0.432999998, -0.25, 1.0),
vec3(0.649500012, 0.375, 1.0), vec3(0.0, 0.75, 1.0), vec3(-0.649500012, 0.375, 1.0),
vec3(-0.649500012, -0.375, 1.0), vec3(0.0, -0.75, 1.0), vec3(0.649500012, -0.375, 1.0),
vec3(0.865999997, 0.5, 1.0), vec3(0.0, 1.0, 1.0), vec3(-0.865999997, 0.5, 1.0),
vec3(-0.865999997, -0.5, 1.0), vec3(0.0, -1.0, 1.0), vec3(0.865999997, -0.5, 1.0),
vec3(0.216299996, 0.375400007, 0.866999984), vec3(-0.216999993, 0.375, 0.866999984), vec3(-0.433299989, -0.00039999999, 0.866999984),
vec3(-0.216299996, -0.375400007, 0.866999984), vec3(0.216999993, -0.375, 0.866999984), vec3(0.433299989, 0.00039999999, 0.866999984),
vec3(0.432799995, 0.500400007, 0.8847), vec3(-0.216999993, 0.625, 0.8847), vec3(-0.649800003, 0.124600001, 0.8847),
vec3(-0.432799995, -0.500400007, 0.8847), vec3(0.216999993, -0.625, 0.8847), vec3(0.649800003, -0.124600001, 0.8847),
vec3(0.649299979, 0.625400007, 0.906499982), vec3(-0.216999993, 0.875, 0.906499982), vec3(-0.866299987, 0.249599993, 0.906499982),
vec3(-0.649299979, -0.625400007, 0.906499982), vec3(0.216999993, -0.875, 0.906499982), vec3(0.866299987, -0.249599993, 0.906499982),
vec3(0.216000006, 0.625899971, 0.885100007), vec3(-0.433999985, 0.5, 0.885100007), vec3(-0.649999976, -0.1259, 0.885100007),
vec3(-0.216000006, -0.625899971, 0.885100007), vec3(0.433999985, -0.5, 0.885100007), vec3(0.649999976, 0.1259, 0.885100007),
vec3(0.432500005, 0.750899971, 0.866999984), vec3(-0.433999985, 0.75, 0.866999984), vec3(-0.86650002, -0.000899999985, 0.866999984),
vec3(-0.432500005, -0.750899971, 0.866999984), vec3(0.433999985, -0.75, 0.866999984), vec3(0.86650002, 0.000899999985, 0.866999984),
vec3(0.215800002, 0.876299977, 0.907000005), vec3(-0.651000023, 0.625, 0.907000005), vec3(-0.86680001, -0.251300007, 0.907000005),
vec3(-0.215800002, -0.876299977, 0.907000005), vec3(0.651000023, -0.625, 0.907000005), vec3(0.86680001, 0.251300007, 0.907000005)
);

float CircleOfConfusion(vec2 uv)
{
return pow(abs(texture(_Depth, uv).x - g_FocusPoint), g_FocusRadius) * g_Radius;
}

void main()
{
vec4 center = texture(_Sampler, vs_TexCoord);
float centerCoc = CircleOfConfusion(vs_TexCoord);
float maxRadius = centerCoc * 2.0;
vec2 scale = maxRadius * g_TexelSize;

float centerWeight = max(dot(center.xyz + 0.00999999978, lumWeights) / (maxRadius * maxRadius + 1.0), 0.0);
vec3 color = center.xyz * centerWeight;
float totalWeight = centerWeight;

for (int i = 0; i < 60; i++) {
vec2 uv = vs_TexCoord + scale * kernel[i].xy;
vec3 tap = texture(_Sampler, uv).xyz;

float coc = CircleOfConfusion(uv);
if (centerCoc < 0.0)
coc = max(abs(maxRadius), coc);

float edge = coc * kernel[i].z;
float t = clamp((abs(maxRadius) * length(kernel[i].xy) - edge) / (edge * 0.100000001), 0.0, 1.0);
float falloff = clamp(1.0 - t * t * (3.0 - 2.0 * t), 0.0, 1.0);

float weight = max(dot(tap + 0.00999999978, lumWeights) / (coc * coc + 1.0) * falloff, 0.0);
color += tap * weight;
totalWeight += weight;
}

fragColor = vec4(color / totalWeight, 1.0);
}
51 changes: 51 additions & 0 deletions Game.Assets/sdn/shaders/g_colourmodify_gl460.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#version 460

layout(location = 0) in vec2 vs_TexCoord;

layout(std140, binding = 6) uniform source_ps_constants {
vec4 ps_const[256];
};

out vec4 fragColor;

layout(binding = 0) uniform sampler2D FullScreen;

#define LevelR ps_const[0].x
#define LevelG ps_const[1].x
#define LevelB ps_const[2].x
#define Brightness ps_const[3].x
#define Contrast ps_const[4].x
#define Colour ps_const[5].x
#define LevelRmp ps_const[6].x
#define LevelGmp ps_const[7].x
#define LevelBmp ps_const[8].x
#define InvertCol ps_const[9].x

void main()
{
vec4 color = texture(FullScreen, vs_TexCoord);
vec3 level = color.xyz + vec3(LevelR, LevelG, LevelB);

float red = level.g - level.r >= 0.0 ? 0.0 : level.r - level.g;
float green = level.r - level.g >= 0.0 ? 0.0 : level.g - level.r;
float blue = level.r - level.b >= 0.0 ? 0.0 : level.b - level.r;

if (level.b - level.r < 0.0)
red += level.r - level.b;
if (level.b - level.g < 0.0)
green += level.g - level.b;
if (level.g - level.b < 0.0)
blue += level.b - level.g;

float grey = (level.r + level.g + level.b) * 0.333333343 * (1.0 - Colour);

color.xyz = level * Colour + grey;
color.xyz += vec3(red * red * LevelRmp, green * green * LevelGmp, blue * blue * LevelBmp);
color.xyz += Brightness;
color.xyz *= Contrast;

if (-InvertCol < 0.0)
color = InvertCol * (color * -2.0 + 1.0) + color;

fragColor = color;
}
33 changes: 33 additions & 0 deletions Game.Assets/sdn/shaders/g_downsample_gl460.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#version 460

layout(location = 0) in vec2 vs_TexCoord;

layout(std140, binding = 6) uniform source_ps_constants {
vec4 ps_const[256];
};

out vec4 fragColor;

layout(binding = 0) uniform sampler2D BaseTextureSampler;

#define g_darken ps_const[0].x
#define g_multiply ps_const[1].x
#define g_sizex ps_const[2].x
#define g_sizey ps_const[3].x

void main()
{
vec3 color = texture(BaseTextureSampler, vs_TexCoord).xyz * 2.0;
color += texture(BaseTextureSampler, vs_TexCoord + vec2(g_sizex, -g_sizey)).xyz;
color += texture(BaseTextureSampler, vs_TexCoord + vec2(g_sizex, g_sizey)).xyz;
color += texture(BaseTextureSampler, vs_TexCoord + vec2(-g_sizex, -g_sizey)).xyz;
color += texture(BaseTextureSampler, vs_TexCoord + vec2(-g_sizex, g_sizey)).xyz;
color += texture(BaseTextureSampler, vs_TexCoord + vec2(0.0, -g_sizey)).xyz;
color += texture(BaseTextureSampler, vs_TexCoord + vec2(0.0, g_sizey)).xyz;
color += texture(BaseTextureSampler, vs_TexCoord + vec2(g_sizex, 0.0)).xyz;
color += texture(BaseTextureSampler, vs_TexCoord + vec2(-g_sizex, 0.0)).xyz;

color = max(color * 0.100000001 - g_darken, 0.0) * g_multiply;

fragColor = vec4(color, 1.0);
}
12 changes: 12 additions & 0 deletions Game.Assets/sdn/shaders/g_premultiplied_gl460.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#version 460

layout(location = 0) in vec2 vs_TexCoord;

out vec4 fragColor;

layout(binding = 0) uniform sampler2D RT;

void main()
{
fragColor = texture(RT, vs_TexCoord);
}
27 changes: 27 additions & 0 deletions Game.Assets/sdn/shaders/g_refract_gl460.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#version 460

layout(location = 0) in vec2 vs_TexCoord;

layout(std140, binding = 6) uniform source_ps_constants {
vec4 ps_const[256];
};

out vec4 fragColor;

layout(binding = 0) uniform sampler2D NormBuf;
layout(binding = 1) uniform sampler2D BackBuf;

#define RefractAmount ps_const[0].x

void main()
{
vec2 normal = texture(NormBuf, vs_TexCoord).xy * 2.0;
normal += texture(NormBuf, vs_TexCoord + 0.00100000005).xy;
normal += texture(NormBuf, vs_TexCoord - 0.00100000005).xy;
normal += texture(NormBuf, vs_TexCoord + vec2(0.00100000005, -0.00100000005)).xy;
normal += texture(NormBuf, vs_TexCoord + vec2(-0.00100000005, 0.00100000005)).xy;

normal = normal * 0.166666672 - 0.501960814;

fragColor = texture(BackBuf, vs_TexCoord + normal * (RefractAmount * 0.25));
}
21 changes: 21 additions & 0 deletions Game.Assets/sdn/shaders/g_screenquad_gl460.vs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#version 460

layout(location = 0) in vec3 v_Position;
layout(location = 10) in vec2 v_TexCoord;

layout(std140, binding = 0) uniform source_matrices {
mat4 viewMatrix;
mat4 projectionMatrix;
mat4 modelMatrix;
};

layout(location = 0) out vec2 vs_TexCoord;

#include "common_clipplanes_gl460.vs"

void main()
{
gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(v_Position, 1.0);
WriteUserClipDistances(gl_Position);
vs_TexCoord = vec2(v_TexCoord.x, 1.0 - v_TexCoord.y);
}
23 changes: 23 additions & 0 deletions Game.Assets/sdn/shaders/g_sharpen_gl460.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#version 460

layout(location = 0) in vec2 vs_TexCoord;

layout(std140, binding = 6) uniform source_ps_constants {
vec4 ps_const[256];
};

out vec4 fragColor;

layout(binding = 0) uniform sampler2D FullScreen;

#define Contrast ps_const[0].x
#define Distance ps_const[1].x

void main()
{
vec4 color = texture(FullScreen, vs_TexCoord);
color += texture(FullScreen, vs_TexCoord + Distance) * Contrast;
color -= texture(FullScreen, vs_TexCoord - Distance) * Contrast;

fragColor = color;
}
Loading
Loading