Moved shaders to new directory
This commit is contained in:
parent
0b3f8340e3
commit
99b226237a
1244 changed files with 0 additions and 0 deletions
22
shaders/glsl/vulkanscene/logo.frag
Normal file
22
shaders/glsl/vulkanscene/logo.frag
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#version 450
|
||||
|
||||
layout (location = 0) in vec2 inUV;
|
||||
layout (location = 1) in vec3 inNormal;
|
||||
layout (location = 2) in vec3 inColor;
|
||||
layout (location = 3) in vec3 inEyePos;
|
||||
layout (location = 4) in vec3 inLightVec;
|
||||
|
||||
layout (location = 0) out vec4 outFragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 Eye = normalize(-inEyePos);
|
||||
vec3 Reflected = normalize(reflect(-inLightVec, inNormal));
|
||||
|
||||
vec4 diff = vec4(inColor, 1.0) * max(dot(inNormal, inLightVec), 0.0);
|
||||
float shininess = 0.0;
|
||||
vec4 spec = vec4(1.0, 1.0, 1.0, 1.0) * pow(max(dot(Reflected, Eye), 0.0), 2.5) * shininess;
|
||||
|
||||
outFragColor = diff + spec;
|
||||
outFragColor.a = 1.0;
|
||||
}
|
||||
BIN
shaders/glsl/vulkanscene/logo.frag.spv
Normal file
BIN
shaders/glsl/vulkanscene/logo.frag.spv
Normal file
Binary file not shown.
34
shaders/glsl/vulkanscene/logo.vert
Normal file
34
shaders/glsl/vulkanscene/logo.vert
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#version 450
|
||||
|
||||
layout (location = 0) in vec4 inPos;
|
||||
layout (location = 1) in vec3 inNormal;
|
||||
layout (location = 2) in vec2 inTexCoord;
|
||||
layout (location = 3) in vec3 inColor;
|
||||
|
||||
layout (binding = 0) uniform UBO
|
||||
{
|
||||
mat4 projection;
|
||||
mat4 model;
|
||||
mat4 normal;
|
||||
mat4 view;
|
||||
vec3 lightpos;
|
||||
} ubo;
|
||||
|
||||
layout (location = 0) out vec2 outUV;
|
||||
layout (location = 1) out vec3 outNormal;
|
||||
layout (location = 2) out vec3 outColor;
|
||||
layout (location = 3) out vec3 outEyePos;
|
||||
layout (location = 4) out vec3 outLightVec;
|
||||
|
||||
void main()
|
||||
{
|
||||
mat4 modelView = ubo.view * ubo.model;
|
||||
vec4 pos = modelView * inPos;
|
||||
outUV = inTexCoord.st;
|
||||
outNormal = normalize(mat3(ubo.normal) * inNormal);
|
||||
outColor = inColor;
|
||||
gl_Position = ubo.projection * pos;
|
||||
outEyePos = vec3(modelView * pos);
|
||||
vec4 lightPos = vec4(1.0, 2.0, 0.0, 1.0) * modelView;
|
||||
outLightVec = normalize(lightPos.xyz - outEyePos);
|
||||
}
|
||||
BIN
shaders/glsl/vulkanscene/logo.vert.spv
Normal file
BIN
shaders/glsl/vulkanscene/logo.vert.spv
Normal file
Binary file not shown.
44
shaders/glsl/vulkanscene/mesh.frag
Normal file
44
shaders/glsl/vulkanscene/mesh.frag
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#version 450
|
||||
|
||||
layout (binding = 1) uniform sampler2D tex;
|
||||
|
||||
layout (location = 0) in vec2 inUV;
|
||||
layout (location = 1) in vec3 inNormal;
|
||||
layout (location = 2) in vec3 inColor;
|
||||
layout (location = 3) in vec3 inEyePos;
|
||||
layout (location = 4) in vec3 inLightVec;
|
||||
|
||||
layout (location = 0) out vec4 outFragColor;
|
||||
|
||||
float specpart(vec3 L, vec3 N, vec3 H)
|
||||
{
|
||||
if (dot(N, L) > 0.0)
|
||||
{
|
||||
return pow(clamp(dot(H, N), 0.0, 1.0), 64.0);
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 Eye = normalize(-inEyePos);
|
||||
vec3 Reflected = normalize(reflect(-inLightVec, inNormal));
|
||||
|
||||
vec3 halfVec = normalize(inLightVec + inEyePos);
|
||||
float diff = clamp(dot(inLightVec, inNormal), 0.0, 1.0);
|
||||
float spec = specpart(inLightVec, inNormal, halfVec);
|
||||
float intensity = 0.1 + diff + spec;
|
||||
|
||||
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 shininess = 0.75;
|
||||
vec4 ISpecular = vec4(0.5, 0.5, 0.5, 1.0) * pow(max(dot(Reflected, Eye), 0.0), 2.0) * shininess;
|
||||
|
||||
outFragColor = vec4((IAmbient + IDiffuse) * vec4(inColor, 1.0) + ISpecular);
|
||||
|
||||
// Some manual saturation
|
||||
if (intensity > 0.95)
|
||||
outFragColor *= 2.25;
|
||||
if (intensity < 0.15)
|
||||
outFragColor = vec4(0.1);
|
||||
}
|
||||
BIN
shaders/glsl/vulkanscene/mesh.frag.spv
Normal file
BIN
shaders/glsl/vulkanscene/mesh.frag.spv
Normal file
Binary file not shown.
34
shaders/glsl/vulkanscene/mesh.vert
Normal file
34
shaders/glsl/vulkanscene/mesh.vert
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#version 450
|
||||
|
||||
layout (location = 0) in vec4 inPos;
|
||||
layout (location = 1) in vec3 inNormal;
|
||||
layout (location = 2) in vec2 inTexCoord;
|
||||
layout (location = 3) in vec3 inColor;
|
||||
|
||||
layout (binding = 0) uniform UBO
|
||||
{
|
||||
mat4 projection;
|
||||
mat4 model;
|
||||
mat4 normal;
|
||||
mat4 view;
|
||||
vec3 lightpos;
|
||||
} ubo;
|
||||
|
||||
layout (location = 0) out vec2 outUV;
|
||||
layout (location = 1) out vec3 outNormal;
|
||||
layout (location = 2) out vec3 outColor;
|
||||
layout (location = 3) out vec3 outEyePos;
|
||||
layout (location = 4) out vec3 outLightVec;
|
||||
|
||||
void main()
|
||||
{
|
||||
outUV = inTexCoord.st;
|
||||
outNormal = normalize(mat3(ubo.normal) * inNormal);
|
||||
outColor = inColor;
|
||||
mat4 modelView = ubo.view * ubo.model;
|
||||
vec4 pos = modelView * inPos;
|
||||
gl_Position = ubo.projection * pos;
|
||||
outEyePos = vec3(modelView * pos);
|
||||
vec4 lightPos = vec4(ubo.lightpos, 1.0) * modelView;
|
||||
outLightVec = normalize(lightPos.xyz - outEyePos);
|
||||
}
|
||||
BIN
shaders/glsl/vulkanscene/mesh.vert.spv
Normal file
BIN
shaders/glsl/vulkanscene/mesh.vert.spv
Normal file
Binary file not shown.
12
shaders/glsl/vulkanscene/skybox.frag
Normal file
12
shaders/glsl/vulkanscene/skybox.frag
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#version 450
|
||||
|
||||
layout (binding = 1) uniform samplerCube samplerCubeMap;
|
||||
|
||||
layout (location = 0) in vec3 inUVW;
|
||||
|
||||
layout (location = 0) out vec4 outFragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
outFragColor = texture(samplerCubeMap, inUVW);
|
||||
}
|
||||
BIN
shaders/glsl/vulkanscene/skybox.frag.spv
Normal file
BIN
shaders/glsl/vulkanscene/skybox.frag.spv
Normal file
Binary file not shown.
17
shaders/glsl/vulkanscene/skybox.vert
Normal file
17
shaders/glsl/vulkanscene/skybox.vert
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#version 450
|
||||
|
||||
layout (location = 0) in vec3 inPos;
|
||||
|
||||
layout (binding = 0) uniform UBO
|
||||
{
|
||||
mat4 projection;
|
||||
mat4 model;
|
||||
} ubo;
|
||||
|
||||
layout (location = 0) out vec3 outUVW;
|
||||
|
||||
void main()
|
||||
{
|
||||
outUVW = inPos;
|
||||
gl_Position = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0);
|
||||
}
|
||||
BIN
shaders/glsl/vulkanscene/skybox.vert.spv
Normal file
BIN
shaders/glsl/vulkanscene/skybox.vert.spv
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue