summaryrefslogtreecommitdiffstats
path: root/engine/shaders/forward.vert
diff options
context:
space:
mode:
authorSerge Bazanski <q3k@q3k.org>2021-04-08 15:32:23 +0000
committerSerge Bazanski <q3k@q3k.org>2021-04-08 15:32:25 +0000
commitd76ccd41f73cfed9df9eb451fd9e8ac81aa0b40e (patch)
tree1ddc718a0a53e379e4218fc1bef182fa96168adf /engine/shaders/forward.vert
parent1c33076401e47294432e8f1f3a6a1e166af22162 (diff)
downloadabrasion-d76ccd41f73cfed9df9eb451fd9e8ac81aa0b40e.tar.gz
abrasion-d76ccd41f73cfed9df9eb451fd9e8ac81aa0b40e.tar.bz2
abrasion-d76ccd41f73cfed9df9eb451fd9e8ac81aa0b40e.tar.xz
abrasion-d76ccd41f73cfed9df9eb451fd9e8ac81aa0b40e.zip
engine: fix normals, rework lighting and scene
Still not sure if this lighting is correct, for that we probably want a more complex scene (and also some indirect lighting, or IBL, to see more than just a handful of dynamic lights).
Diffstat (limited to 'engine/shaders/forward.vert')
-rw-r--r--engine/shaders/forward.vert3
1 files changed, 1 insertions, 2 deletions
diff --git a/engine/shaders/forward.vert b/engine/shaders/forward.vert
index bb38cc74..13bdb7e5 100644
--- a/engine/shaders/forward.vert
+++ b/engine/shaders/forward.vert
@@ -39,10 +39,9 @@ out gl_PerVertex {
void main() {
vec4 world = model * vec4(pos, 1.0);
- vec4 normal4 = model * vec4(normal, 1.0);
fragTexCoord = tex;
- fragNormal = normal4.xyz / normal4.w;
+ fragNormal = mat3(model) * normal;
fragWorldPos = world.xyz / world.w;
gl_Position = pco.view * world;