Moved shaders to new directory
This commit is contained in:
parent
0b3f8340e3
commit
99b226237a
1244 changed files with 0 additions and 0 deletions
21
shaders/glsl/radialblur/colorpass.frag
Normal file
21
shaders/glsl/radialblur/colorpass.frag
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#version 450
|
||||
|
||||
layout (binding = 1) uniform sampler2D samplerGradientRamp;
|
||||
|
||||
layout (location = 0) in vec3 inColor;
|
||||
layout (location = 1) in vec2 inUV;
|
||||
|
||||
layout (location = 0) out vec4 outFragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
// Use max. color channel value to detect bright glow emitters
|
||||
if ((inColor.r >= 0.9) || (inColor.g >= 0.9) || (inColor.b >= 0.9))
|
||||
{
|
||||
outFragColor.rgb = texture(samplerGradientRamp, inUV).rgb;
|
||||
}
|
||||
else
|
||||
{
|
||||
outFragColor.rgb = inColor;
|
||||
}
|
||||
}
|
||||
BIN
shaders/glsl/radialblur/colorpass.frag.spv
Normal file
BIN
shaders/glsl/radialblur/colorpass.frag.spv
Normal file
Binary file not shown.
26
shaders/glsl/radialblur/colorpass.vert
Normal file
26
shaders/glsl/radialblur/colorpass.vert
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#version 450
|
||||
|
||||
layout (location = 0) in vec3 inPos;
|
||||
layout (location = 2) in vec3 inColor;
|
||||
|
||||
layout (binding = 0) uniform UBO
|
||||
{
|
||||
mat4 projection;
|
||||
mat4 model;
|
||||
float gradientPos;
|
||||
} ubo;
|
||||
|
||||
layout (location = 0) out vec3 outColor;
|
||||
layout (location = 1) out vec2 outUV;
|
||||
|
||||
out gl_PerVertex
|
||||
{
|
||||
vec4 gl_Position;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
outColor = inColor;
|
||||
outUV = vec2(ubo.gradientPos, 0.0f);
|
||||
gl_Position = ubo.projection * ubo.model * vec4(inPos, 1.0);
|
||||
}
|
||||
BIN
shaders/glsl/radialblur/colorpass.vert.spv
Normal file
BIN
shaders/glsl/radialblur/colorpass.vert.spv
Normal file
Binary file not shown.
33
shaders/glsl/radialblur/phongpass.frag
Normal file
33
shaders/glsl/radialblur/phongpass.frag
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#version 450
|
||||
|
||||
layout (binding = 1) uniform sampler2D samplerGradientRamp;
|
||||
|
||||
layout (location = 0) in vec3 inNormal;
|
||||
layout (location = 1) in vec3 inColor;
|
||||
layout (location = 2) in vec3 inEyePos;
|
||||
layout (location = 3) in vec3 inLightVec;
|
||||
layout (location = 4) in vec2 inUV;
|
||||
|
||||
layout (location = 0) out vec4 outFragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
// No light calculations for glow color
|
||||
// Use max. color channel value
|
||||
// to detect bright glow emitters
|
||||
if ((inColor.r >= 0.9) || (inColor.g >= 0.9) || (inColor.b >= 0.9))
|
||||
{
|
||||
outFragColor.rgb = texture(samplerGradientRamp, inUV).rgb;
|
||||
}
|
||||
else
|
||||
{
|
||||
vec3 Eye = normalize(-inEyePos);
|
||||
vec3 Reflected = normalize(reflect(-inLightVec, inNormal));
|
||||
|
||||
vec4 IAmbient = vec4(0.2, 0.2, 0.2, 1.0);
|
||||
vec4 IDiffuse = vec4(0.5, 0.5, 0.5, 0.5) * max(dot(inNormal, inLightVec), 0.0);
|
||||
float specular = 0.25;
|
||||
vec4 ISpecular = vec4(0.5, 0.5, 0.5, 1.0) * pow(max(dot(Reflected, Eye), 0.0), 4.0) * specular;
|
||||
outFragColor = vec4((IAmbient + IDiffuse) * vec4(inColor, 1.0) + ISpecular);
|
||||
}
|
||||
}
|
||||
BIN
shaders/glsl/radialblur/phongpass.frag.spv
Normal file
BIN
shaders/glsl/radialblur/phongpass.frag.spv
Normal file
Binary file not shown.
34
shaders/glsl/radialblur/phongpass.vert
Normal file
34
shaders/glsl/radialblur/phongpass.vert
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#version 450
|
||||
|
||||
layout (location = 0) in vec4 pos;
|
||||
layout (location = 2) in vec3 inColor;
|
||||
layout (location = 3) in vec3 inNormal;
|
||||
|
||||
layout (binding = 0) uniform UBO
|
||||
{
|
||||
mat4 projection;
|
||||
mat4 model;
|
||||
float gradientPos;
|
||||
} ubo;
|
||||
|
||||
layout (location = 0) out vec3 outNormal;
|
||||
layout (location = 1) out vec3 outColor;
|
||||
layout (location = 2) out vec3 outEyePos;
|
||||
layout (location = 3) out vec3 outLightVec;
|
||||
layout (location = 4) out vec2 outUV;
|
||||
|
||||
out gl_PerVertex
|
||||
{
|
||||
vec4 gl_Position;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
outNormal = inNormal;
|
||||
outColor = inColor;
|
||||
outUV = vec2(ubo.gradientPos, 0.0);
|
||||
gl_Position = ubo.projection * ubo.model * pos;
|
||||
outEyePos = vec3(ubo.model * pos);
|
||||
vec4 lightPos = vec4(0.0, 0.0, -5.0, 1.0);// * ubo.model;
|
||||
outLightVec = normalize(lightPos.xyz - pos.xyz);
|
||||
}
|
||||
BIN
shaders/glsl/radialblur/phongpass.vert.spv
Normal file
BIN
shaders/glsl/radialblur/phongpass.vert.spv
Normal file
Binary file not shown.
35
shaders/glsl/radialblur/radialblur.frag
Normal file
35
shaders/glsl/radialblur/radialblur.frag
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#version 450
|
||||
|
||||
layout (binding = 1) uniform sampler2D samplerColor;
|
||||
|
||||
layout (binding = 0) uniform UBO
|
||||
{
|
||||
float radialBlurScale;
|
||||
float radialBlurStrength;
|
||||
vec2 radialOrigin;
|
||||
} ubo;
|
||||
|
||||
layout (location = 0) in vec2 inUV;
|
||||
|
||||
layout (location = 0) out vec4 outFragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
ivec2 texDim = textureSize(samplerColor, 0);
|
||||
vec2 radialSize = vec2(1.0 / texDim.s, 1.0 / texDim.t);
|
||||
|
||||
vec2 UV = inUV;
|
||||
|
||||
vec4 color = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
UV += radialSize * 0.5 - ubo.radialOrigin;
|
||||
|
||||
#define samples 32
|
||||
|
||||
for (int i = 0; i < samples; i++)
|
||||
{
|
||||
float scale = 1.0 - ubo.radialBlurScale * (float(i) / float(samples-1));
|
||||
color += texture(samplerColor, UV * scale + ubo.radialOrigin);
|
||||
}
|
||||
|
||||
outFragColor = (color / samples) * ubo.radialBlurStrength;
|
||||
}
|
||||
BIN
shaders/glsl/radialblur/radialblur.frag.spv
Normal file
BIN
shaders/glsl/radialblur/radialblur.frag.spv
Normal file
Binary file not shown.
14
shaders/glsl/radialblur/radialblur.vert
Normal file
14
shaders/glsl/radialblur/radialblur.vert
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#version 450
|
||||
|
||||
layout (location = 0) out vec2 outUV;
|
||||
|
||||
out gl_PerVertex
|
||||
{
|
||||
vec4 gl_Position;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2);
|
||||
gl_Position = vec4(outUV * 2.0f - 1.0f, 0.0f, 1.0f);
|
||||
}
|
||||
BIN
shaders/glsl/radialblur/radialblur.vert.spv
Normal file
BIN
shaders/glsl/radialblur/radialblur.vert.spv
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue