Added Vulkan examples sources!
This commit is contained in:
parent
367fda186b
commit
c91341813c
868 changed files with 514080 additions and 5584 deletions
13
data/shaders/radialblur/colorpass.frag
Normal file
13
data/shaders/radialblur/colorpass.frag
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#version 450
|
||||
|
||||
#extension GL_ARB_separate_shader_objects : enable
|
||||
#extension GL_ARB_shading_language_420pack : enable
|
||||
|
||||
layout (location = 0) in vec3 inColor;
|
||||
|
||||
layout (location = 0) out vec4 outFragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
outFragColor.rgb = inColor;
|
||||
}
|
||||
BIN
data/shaders/radialblur/colorpass.frag.spv
Normal file
BIN
data/shaders/radialblur/colorpass.frag.spv
Normal file
Binary file not shown.
30
data/shaders/radialblur/colorpass.vert
Normal file
30
data/shaders/radialblur/colorpass.vert
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#version 450
|
||||
|
||||
#extension GL_ARB_separate_shader_objects : enable
|
||||
#extension GL_ARB_shading_language_420pack : enable
|
||||
|
||||
layout (location = 0) in vec4 inPos;
|
||||
layout (location = 2) in vec3 inColor;
|
||||
|
||||
layout (binding = 0) uniform UBO
|
||||
{
|
||||
mat4 projection;
|
||||
mat4 model;
|
||||
vec4 glowColor;
|
||||
} ubo;
|
||||
|
||||
layout (location = 0) out vec3 outColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
/*
|
||||
if (inColor.r >= 0.9)
|
||||
{
|
||||
outColor = ubo.glowColor.rgb;
|
||||
}
|
||||
else*/
|
||||
{
|
||||
outColor = inColor;
|
||||
}
|
||||
gl_Position = ubo.projection * ubo.model * inPos;
|
||||
}
|
||||
BIN
data/shaders/radialblur/colorpass.vert.spv
Normal file
BIN
data/shaders/radialblur/colorpass.vert.spv
Normal file
Binary file not shown.
7
data/shaders/radialblur/generate-spirv.bat
Normal file
7
data/shaders/radialblur/generate-spirv.bat
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
glslangvalidator -V colorpass.vert -o colorpass.vert.spv
|
||||
glslangvalidator -V colorpass.frag -o colorpass.frag.spv
|
||||
glslangvalidator -V phongpass.vert -o phongpass.vert.spv
|
||||
glslangvalidator -V phongpass.frag -o phongpass.frag.spv
|
||||
glslangvalidator -V radialblur.vert -o radialblur.vert.spv
|
||||
glslangvalidator -V radialblur.frag -o radialblur.frag.spv
|
||||
|
||||
33
data/shaders/radialblur/phongpass.frag
Normal file
33
data/shaders/radialblur/phongpass.frag
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#version 450
|
||||
|
||||
#extension GL_ARB_separate_shader_objects : enable
|
||||
#extension GL_ARB_shading_language_420pack : enable
|
||||
|
||||
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 = 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 = inColor;
|
||||
}
|
||||
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
data/shaders/radialblur/phongpass.frag.spv
Normal file
BIN
data/shaders/radialblur/phongpass.frag.spv
Normal file
Binary file not shown.
29
data/shaders/radialblur/phongpass.vert
Normal file
29
data/shaders/radialblur/phongpass.vert
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#version 450
|
||||
|
||||
#extension GL_ARB_separate_shader_objects : enable
|
||||
#extension GL_ARB_shading_language_420pack : enable
|
||||
|
||||
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;
|
||||
} 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;
|
||||
|
||||
void main()
|
||||
{
|
||||
outNormal = inNormal;
|
||||
outColor = inColor;
|
||||
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
data/shaders/radialblur/phongpass.vert.spv
Normal file
BIN
data/shaders/radialblur/phongpass.vert.spv
Normal file
Binary file not shown.
39
data/shaders/radialblur/radialblur.frag
Normal file
39
data/shaders/radialblur/radialblur.frag
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#version 450
|
||||
|
||||
#extension GL_ARB_separate_shader_objects : enable
|
||||
#extension GL_ARB_shading_language_420pack : enable
|
||||
|
||||
layout (binding = 1) uniform sampler2D samplerColor;
|
||||
|
||||
layout (binding = 2) uniform UBO
|
||||
{
|
||||
int texWidth;
|
||||
int texHeight;
|
||||
float radialBlurScale;
|
||||
float radialBlurStrength;
|
||||
vec2 radialOrigin;
|
||||
} ubo;
|
||||
|
||||
layout (location = 0) in vec2 inUV;
|
||||
|
||||
layout (location = 0) out vec4 outFragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 radialSize = vec2(1.0 / ubo.texWidth, 1.0 / ubo.texHeight);
|
||||
|
||||
vec2 UV = inUV;
|
||||
|
||||
vec4 color = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
UV += radialSize * 0.5 - ubo.radialOrigin;
|
||||
|
||||
#define samples 16
|
||||
|
||||
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
data/shaders/radialblur/radialblur.frag.spv
Normal file
BIN
data/shaders/radialblur/radialblur.frag.spv
Normal file
Binary file not shown.
21
data/shaders/radialblur/radialblur.vert
Normal file
21
data/shaders/radialblur/radialblur.vert
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#version 450
|
||||
|
||||
#extension GL_ARB_separate_shader_objects : enable
|
||||
#extension GL_ARB_shading_language_420pack : enable
|
||||
|
||||
layout (location = 0) in vec3 inPos;
|
||||
layout (location = 1) in vec2 inUV;
|
||||
|
||||
layout (binding = 0) uniform UBO
|
||||
{
|
||||
mat4 projection;
|
||||
mat4 model;
|
||||
} ubo;
|
||||
|
||||
layout (location = 0) out vec2 outUV;
|
||||
|
||||
void main()
|
||||
{
|
||||
outUV = inUV;
|
||||
gl_Position = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0);
|
||||
}
|
||||
BIN
data/shaders/radialblur/radialblur.vert.spv
Normal file
BIN
data/shaders/radialblur/radialblur.vert.spv
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue