mirror of
https://github.com/italicsjenga/slang-shaders.git
synced 2024-11-22 07:41:31 +11:00
fix broken paths and add edge-detect shader; closes #101
This commit is contained in:
parent
e6d6393744
commit
e9dfc8143e
|
@ -1,19 +0,0 @@
|
|||
shaders = 3
|
||||
|
||||
shader0 = shaders/metacrt/bufC.slang
|
||||
scale_type0 = viewport
|
||||
filter_linear0 = true
|
||||
|
||||
shader1 = shaders/metacrt/bufD.slang
|
||||
scale_type1 = viewport
|
||||
filter_linear1 = true
|
||||
|
||||
shader2 = shaders/metacrt/Image.slang
|
||||
scale_type2 = viewport
|
||||
filter_linear2 = true
|
||||
|
||||
textures = "cubeMap;table"
|
||||
cubeMap = shaders/metacrt/basilica.png
|
||||
cubeMap_wrap_mode = repeat
|
||||
table = shaders/metacrt/woodgrain.png
|
||||
table_wrap_mode = repeat
|
|
@ -1,28 +0,0 @@
|
|||
shaders = "2"
|
||||
shader0 = "../motionblur/shaders/response-time.glsl"
|
||||
shader1 = "shaders/lcd-cgwg/lcd-grid-v2.glsl"
|
||||
|
||||
scale_type0 = "source"
|
||||
scale0 = "1.0"
|
||||
|
||||
scale_type1 = "viewport"
|
||||
scale1 = "1.0"
|
||||
|
||||
filter_linear0 = "false"
|
||||
filter_linear1 = "false"
|
||||
|
||||
parameters = "RSUBPIX_R;RSUBPIX_G;RSUBPIX_B;GSUBPIX_R;GSUBPIX_G;GSUBPIX_B;BSUBPIX_R;BSUBPIX_G;BSUBPIX_B;gain;gamma;blacklevel;ambient;BGR"
|
||||
RSUBPIX_R = "0.750000"
|
||||
RSUBPIX_G = "0.000000"
|
||||
RSUBPIX_B = "0.000000"
|
||||
GSUBPIX_R = "0.000000"
|
||||
GSUBPIX_G = "0.750000"
|
||||
GSUBPIX_B = "0.000000"
|
||||
BSUBPIX_R = "0.000000"
|
||||
BSUBPIX_G = "0.000000"
|
||||
BSUBPIX_B = "0.750000"
|
||||
gain = "1.500000"
|
||||
gamma = "2.200000"
|
||||
blacklevel = "0.000000"
|
||||
ambient = "0.000000"
|
||||
BGR = "0.000000"
|
83
misc/edge-detect.slang
Normal file
83
misc/edge-detect.slang
Normal file
|
@ -0,0 +1,83 @@
|
|||
#version 450
|
||||
|
||||
layout(push_constant) uniform Push
|
||||
{
|
||||
vec4 SourceSize;
|
||||
vec4 OriginalSize;
|
||||
vec4 OutputSize;
|
||||
uint FrameCount;
|
||||
float minimum;
|
||||
float maximum;
|
||||
} params;
|
||||
|
||||
#pragma parameter minimum "Edge Thresh Min" 0.05 0.0 1.0 0.01
|
||||
#pragma parameter maximum "Edge Thresh Max" 0.35 0.0 1.0 0.01
|
||||
|
||||
layout(std140, set = 0, binding = 0) uniform UBO
|
||||
{
|
||||
mat4 MVP;
|
||||
} global;
|
||||
|
||||
#pragma stage vertex
|
||||
layout(location = 0) in vec4 Position;
|
||||
layout(location = 1) in vec2 TexCoord;
|
||||
layout(location = 0) out vec2 vTexCoord;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = global.MVP * Position;
|
||||
vTexCoord = TexCoord;
|
||||
}
|
||||
|
||||
#pragma stage fragment
|
||||
layout(location = 0) in vec2 vTexCoord;
|
||||
layout(location = 0) out vec4 FragColor;
|
||||
layout(set = 0, binding = 2) uniform sampler2D Source;
|
||||
|
||||
float threshold(float thr1, float thr2 , float val) {
|
||||
val = (val < thr1) ? 0.0 : val;
|
||||
val = (val > thr2) ? 1.0 : val;
|
||||
return val;
|
||||
}
|
||||
|
||||
// averaged pixel intensity from 3 color channels
|
||||
float avg_intensity(vec4 pix) {
|
||||
return dot(pix.rgb, vec3(0.2126, 0.7152, 0.0722));
|
||||
}
|
||||
|
||||
vec4 get_pixel(sampler2D tex, vec2 coords, float dx, float dy) {
|
||||
return texture(tex, coords + vec2(dx, dy));
|
||||
}
|
||||
|
||||
// returns pixel color
|
||||
float IsEdge(sampler2D tex, vec2 coords){
|
||||
float dxtex = params.SourceSize.z;
|
||||
float dytex = params.SourceSize.w;
|
||||
float pix[9];
|
||||
int k = -1;
|
||||
float delta;
|
||||
|
||||
// read neighboring pixel intensities
|
||||
for (int i=-1; i<2; i++) {
|
||||
for(int j=-1; j<2; j++) {
|
||||
k++;
|
||||
pix[k] = avg_intensity(get_pixel(tex, coords, float(i) * dxtex,
|
||||
float(j) * dytex));
|
||||
}
|
||||
}
|
||||
|
||||
// average color differences around neighboring pixels
|
||||
delta = (abs(pix[1]-pix[7])+
|
||||
abs(pix[5]-pix[3]) +
|
||||
abs(pix[0]-pix[8])+
|
||||
abs(pix[2]-pix[6])
|
||||
)/4.;
|
||||
|
||||
return threshold(params.minimum, params.maximum,clamp(delta,0.0,1.0));
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
float test = IsEdge(Source, vTexCoord);
|
||||
FragColor = vec4(test);
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
shaders = 13
|
||||
|
||||
shader0 = ../crt/shaders/crt-lottes-multipass/old/linearize.slang
|
||||
srgb_framebuffer0 = true
|
||||
alias0 = "REFERENCE"
|
||||
|
||||
shader1 = ../crt/shaders/crt-lottes-multipass/old/horz3minus1.slang
|
||||
srgb_framebuffer1 = true
|
||||
scale_type1 = source
|
||||
filter_linear1 = true
|
||||
alias1 = horz3minus1
|
||||
|
||||
shader2 = ../crt/shaders/crt-lottes-multipass/old/horz3plus1.slang
|
||||
srgb_framebuffer2 = true
|
||||
scale_type2 = source
|
||||
filter_linear2 = true
|
||||
alias2 = horz3plus1
|
||||
|
||||
shader3 = ../crt/shaders/crt-lottes-multipass/old/horz5minus2.slang
|
||||
srgb_framebuffer3 = true
|
||||
scale_type3 = source
|
||||
filter_linear3 = true
|
||||
alias3 = horz5minus2
|
||||
|
||||
shader4 = ../crt/shaders/crt-lottes-multipass/old/horz5.slang
|
||||
srgb_framebuffer4 = true
|
||||
scale_type4 = source
|
||||
filter_linear4 = true
|
||||
alias4 = horz5
|
||||
|
||||
shader5 = ../crt/shaders/crt-lottes-multipass/old/horz5plus2.slang
|
||||
srgb_framebuffer5 = true
|
||||
scale_type5 = source
|
||||
filter_linear5 = true
|
||||
alias5 = horz5plus2
|
||||
|
||||
shader6 = ../crt/shaders/crt-lottes-multipass/old/horz7minus1.slang
|
||||
srgb_framebuffer6 = true
|
||||
scale_type6 = source
|
||||
filter_linear6 = true
|
||||
alias6 = horz7minus1
|
||||
|
||||
shader7 = ../crt/shaders/crt-lottes-multipass/old/horz7.slang
|
||||
srgb_framebuffer7 = true
|
||||
scale_type7 = source
|
||||
filter_linear7 = true
|
||||
alias7 = horz7
|
||||
|
||||
shader8 = ../crt/shaders/crt-lottes-multipass/old/horz7plus1.slang
|
||||
srgb_framebuffer8 = true
|
||||
scale_type8 = source
|
||||
filter_linear8 = true
|
||||
alias8 = horz7plus1
|
||||
|
||||
shader9 = ../crt/shaders/crt-lottes-multipass/old/crt-lottes-multipass.slang
|
||||
scale_type9 = source
|
||||
scale9 = 4.0
|
||||
filter_linear9 = false
|
||||
alias9 = Reference
|
||||
|
||||
shader10 = ../blurs/blur11resize-vertical.slang
|
||||
scale_type10 = source
|
||||
scale10 = 0.5
|
||||
|
||||
shader11 = ../blurs/blur11resize-horizontal.slang
|
||||
scale_type11 = source
|
||||
scale11 = 0.5
|
||||
|
||||
shader12 = ../border/shaders/bigblur.slang
|
Loading…
Reference in a new issue