From b2928b5ed7707fa1d2de1bdfd60c904b41f689d6 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 5 May 2022 19:58:37 +0900 Subject: [PATCH] [client] Reverse the direction of sunlight Maps specify sunlight as shining in a specific direction, but the lighting system wants the direction to the sun as it's used directly in shading calculations. Direction correctness confirmed by disabling other lights and checking marcher's outside scene (ensuring the flat ground was lit). As a bonus, I've finally confirmed I actually have the skybox in the correct orientation (sunlight vector more or less matched the position of the sun in marcher's sky). --- libs/client/cl_light.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/client/cl_light.c b/libs/client/cl_light.c index 6cfa2a9ca..e06e921f5 100644 --- a/libs/client/cl_light.c +++ b/libs/client/cl_light.c @@ -120,7 +120,7 @@ parse_sun (lightingdata_t *ldata, plitem_t *entity) } VectorSet (1, 1, 1, light.color); light.color[3] = sunlight; - light.position = sun_vector (sunangle); + light.position = -sun_vector (sunangle); light.direction = light.position; light.direction[3] = 1; light.attenuation = (vec4f_t) { 0, 0, 1, 0 };