* Adjust lens location
This commit is contained in:
parent
f3506c3544
commit
777f1a969d
10
init.lua
10
init.lua
|
@ -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(
|
||||||
|
|
Loading…
Reference in New Issue