diff --git a/examples/bin/resources/shaders/triangle.frag b/examples/bin/resources/shaders/triangle.frag index 58a4eff89..f2ddf7dec 100644 --- a/examples/bin/resources/shaders/triangle.frag +++ b/examples/bin/resources/shaders/triangle.frag @@ -5,12 +5,16 @@ layout(binding = 1) uniform sampler2D texSampler; -layout (location = 0) in vec3 inColor; -layout (location = 1) in vec2 outTexCoords; +layout (location = 0) in vec3 inNormal; +layout (location = 1) in vec2 inUV; layout (location = 0) out vec4 outFragColor; void main() { - outFragColor = texture(texSampler, outTexCoords); + vec3 lightDir = vec3(0.0, -0.707, 0.707); + float lightFactor = dot(inNormal, lightDir); + + float gamma = 2.2; + outFragColor = lightFactor * vec4(pow(texture(texSampler, inUV).xyz, vec3(1.0/gamma)), 1.0); } diff --git a/examples/bin/resources/shaders/triangle.frag.spv b/examples/bin/resources/shaders/triangle.frag.spv index c163dc05a..31ec5000f 100644 Binary files a/examples/bin/resources/shaders/triangle.frag.spv and b/examples/bin/resources/shaders/triangle.frag.spv differ diff --git a/examples/bin/resources/shaders/triangle.vert b/examples/bin/resources/shaders/triangle.vert index 8884074ee..b967590b8 100644 --- a/examples/bin/resources/shaders/triangle.vert +++ b/examples/bin/resources/shaders/triangle.vert @@ -4,7 +4,7 @@ #extension GL_ARB_shading_language_420pack : enable layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inColor; +layout (location = 1) in vec3 inNormals; layout (location = 2) in vec2 inTexCoord; layout (binding = 0) uniform UBO @@ -14,7 +14,7 @@ layout (binding = 0) uniform UBO mat4 viewMatrix; } ubo; -layout (location = 0) out vec3 outColor; +layout (location = 0) out vec3 outNormal; layout (location = 1) out vec2 outTexCoords; out gl_PerVertex @@ -25,7 +25,7 @@ out gl_PerVertex void main() { - outColor = inColor; + outNormal = inNormals; outTexCoords = inTexCoord; gl_Position = ubo.projectionMatrix * ubo.viewMatrix * ubo.modelMatrix * vec4(inPos, 1.0); } diff --git a/examples/bin/resources/shaders/triangle.vert.spv b/examples/bin/resources/shaders/triangle.vert.spv index d7f5cd1ff..a9b99027f 100644 Binary files a/examples/bin/resources/shaders/triangle.vert.spv and b/examples/bin/resources/shaders/triangle.vert.spv differ