diff --git a/init.lua b/init.lua index afb5f67..5b2fe9b 100644 --- a/init.lua +++ b/init.lua @@ -63,7 +63,13 @@ local shade = function( origin, target, background_color ) local light = get_light( pointed_thing.above ) local distance = vector.distance ( position, origin ) local fog = get_fog( distance ) - local l_color = base_color * light + -- TODO: proper lighting based on sun position (LOL) + local n = 1 + ( + pointed_thing.intersection_normal.x + + pointed_thing.intersection_normal.y * 3 + + pointed_thing.intersection_normal.z * 1 + ) / 12 + local l_color = math.min( base_color * n * light, 255 ) color = math.floor( l_color * ( 1 - fog ) + background_color * fog