* Adjust lens location

This commit is contained in:
Nils Dagsson Moskopp 2023-11-10 12:38:42 +01:00
parent f3506c3544
commit 777f1a969d
Signed by: erle
GPG Key ID: A3BC671C35191080
1 changed files with 7 additions and 3 deletions

View File

@ -115,7 +115,11 @@ local create_photo_pixels = function( player_name )
local down = vector.normalize( local down = vector.normalize(
dir:cross( right ) 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 bg = 127
local pixels = {} local pixels = {}
for h = 1,height,1 do for h = 1,height,1 do
@ -129,10 +133,10 @@ local create_photo_pixels = function( player_name )
for sample = 1,samples,1 do for sample = 1,samples,1 do
local x_offset = x_offset_by_sample[sample] * 0.2 local x_offset = x_offset_by_sample[sample] * 0.2
local y_offset = y_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 ) + right * ( width/2 - x + x_offset ) +
down * ( height/2 - y + y_offset ) down * ( height/2 - y + y_offset )
) * 2 )
local pos1 = eye local pos1 = eye
local pos2 = eye + lens + ( dir * 128 ) local pos2 = eye + lens + ( dir * 128 )
local color, hit_water = shade( local color, hit_water = shade(