From ffdaa93edf5eeaf9db7dc17e51554a77dd9d596d Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 19 Nov 2022 15:04:30 +0000 Subject: Separate out the illumation of the scene --- gfx/gl/shaders/directionalLight.fs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 gfx/gl/shaders/directionalLight.fs (limited to 'gfx/gl/shaders/directionalLight.fs') diff --git a/gfx/gl/shaders/directionalLight.fs b/gfx/gl/shaders/directionalLight.fs new file mode 100644 index 0000000..7562f96 --- /dev/null +++ b/gfx/gl/shaders/directionalLight.fs @@ -0,0 +1,18 @@ +#version 330 core +#extension GL_ARB_shading_language_420pack : enable + +out vec3 FragColor; + +in vec2 TexCoords; + +layout(binding = 1) uniform sampler2D gNormal; + +uniform vec3 lightDirection; +uniform vec3 lightColour; + +void +main() +{ + const vec3 Normal = texture(gNormal, TexCoords).rgb; + FragColor = dot(-lightDirection, Normal) * lightColour; +} -- cgit v1.2.3