diff --git a/init.lua b/init.lua index f927d3c..a2ed0b2 100644 --- a/init.lua +++ b/init.lua @@ -115,7 +115,11 @@ local create_photo_pixels = function( player_name ) local down = vector.normalize( dir:cross( right ) ) - local corner = eye + dir + ( right + down ) + local fov_factor = 2 + local corner = eye + dir - fov_factor * ( + right * width/2 + + down * height/2 + ) local bg = 127 local pixels = {} for h = 1,height,1 do @@ -129,10 +133,10 @@ local create_photo_pixels = function( player_name ) for sample = 1,samples,1 do local x_offset = x_offset_by_sample[sample] * 0.2 local y_offset = y_offset_by_sample[sample] * 0.2 - local lens = ( + local lens = fov_factor * ( right * ( width/2 - x + x_offset ) + down * ( height/2 - y + y_offset ) - ) * 2 + ) local pos1 = eye local pos2 = eye + lens + ( dir * 128 ) local color, hit_water = shade(