The Lambda Lab
/
projects
/
raymarcher.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
13e125d
)
Reduced Render.eps.
author
Tim Vaughan
<timv@ughan.xyz>
Fri, 17 Mar 2023 14:45:19 +0000
(15:45 +0100)
committer
Tim Vaughan
<timv@ughan.xyz>
Fri, 17 Mar 2023 14:45:19 +0000
(15:45 +0100)
Render.lua
patch
|
blob
|
history
Textures.lua
patch
|
blob
|
history
diff --git
a/Render.lua
b/Render.lua
index
57cb407
..
f690ab7
100644
(file)
--- a/
Render.lua
+++ b/
Render.lua
@@
-12,12
+12,12
@@
local O = Operations
require "Textures"
local T = Textures
require "Textures"
local T = Textures
-local eps = 0.01
+local eps = 0.0
0
1
local max_dist2 = 30^2
local bg_col = {0.1,0.1,0.1}
local function calculate_normal(sdf, l)
local max_dist2 = 30^2
local bg_col = {0.1,0.1,0.1}
local function calculate_normal(sdf, l)
- local delta =
1e-3;
+ local delta =
eps/10
return V.new{sdf(l+V.x*delta).dist-sdf(l-V.x*delta).dist,
sdf(l+V.y*delta).dist-sdf(l-V.y*delta).dist,
sdf(l+V.z*delta).dist-sdf(l-V.z*delta).dist}/(2*delta)
return V.new{sdf(l+V.x*delta).dist-sdf(l-V.x*delta).dist,
sdf(l+V.y*delta).dist-sdf(l-V.y*delta).dist,
sdf(l+V.z*delta).dist-sdf(l-V.z*delta).dist}/(2*delta)
@@
-54,7
+54,6
@@
local function render(scene, width, height, filename)
local normalize = V.normalize -- optimization
for y=1,height do
local normalize = V.normalize -- optimization
for y=1,height do
-
if y % math.floor(height/10) == 0 then
print(y/math.floor(height/10) * 10 .. "%")
end
if y % math.floor(height/10) == 0 then
print(y/math.floor(height/10) * 10 .. "%")
end
diff --git
a/Textures.lua
b/Textures.lua
index
bfa1262
..
ad805a6
100644
(file)
--- a/
Textures.lua
+++ b/
Textures.lua
@@
-29,6
+29,7
@@
local function make_phong_texture(lights, mapped_pigment, amb, diff, spec, shiny
local light_dir = (light-location)/light_dist
local vis = light_visibility(location + light_dir*eps, light_dir, eps, light_dist, 1, sdf)
local light_dir = (light-location)/light_dist
local vis = light_visibility(location + light_dir*eps, light_dir, eps, light_dist, 1, sdf)
+ -- local vis = 1.0
local Idiff = math.max(normal*light_dir, 0)
local Ispec = math.pow(math.max(light_dir*reflected_ray,0),shiny)
local Idiff = math.max(normal*light_dir, 0)
local Ispec = math.pow(math.max(light_dir*reflected_ray,0),shiny)