Moved shaders to new directory

This commit is contained in:
Sascha Willems 2023-05-09 21:03:02 +02:00
parent 0b3f8340e3
commit 99b226237a
1244 changed files with 0 additions and 0 deletions

View 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;
}

Binary file not shown.

View 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);
}

Binary file not shown.

View 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);
}

Binary file not shown.

View 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);
}

Binary file not shown.

View 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);
}

Binary file not shown.

View 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);
}

Binary file not shown.