-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5651ecd
commit 08c2f14
Showing
1 changed file
with
49 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,51 @@ | ||
camera.pos = {-2.0, 2.0, 1.0} | ||
camera.center = {0.0, 0.0, -1.0} | ||
math.randomseed(os.time()) | ||
|
||
camera.pos = {13.0, 2.0, 3.0} | ||
camera.center = {0.0, 0.0, 0.0} | ||
camera.up = {0.0, 1.0, 0.0} | ||
camera.fov = math.rad(20.0) | ||
camera.focus_dist = 3.4 | ||
camera.lens_angle = math.rad(10.0) | ||
|
||
material_ground = Lambertian.new({0.8, 0.8, 0.0}) | ||
material_center = Lambertian.new({0.1, 0.2, 0.5}) | ||
material_left = Dielectric.new(1.5) | ||
material_bubble = Dielectric.new(1.0 / 1.5) | ||
material_right = Metal.new({0.8, 0.6, 0.2}, 1.0) | ||
|
||
scene:add(Sphere.new({0.0, -100.5, -1.0}, 100.0, material_ground)) | ||
scene:add(Sphere.new({0.0, 0.0, -1.2}, 0.5, material_center)) | ||
scene:add(Sphere.new({-1.0, 0.0, -1.0}, 0.5, material_left)) | ||
scene:add(Sphere.new({-1.0, 0.0, -1.0}, 0.4, material_bubble)) | ||
scene:add(Sphere.new({1.0, 0.0, -1.0}, 0.5, material_right)) | ||
camera.focus_dist = 10.0 | ||
camera.lens_angle = math.rad(0.6) | ||
|
||
material_ground = Lambertian.new({0.5, 0.5, 0.5}) | ||
scene:add(Sphere.new({0.0, -1000.0, 0.0}, 1000.0, material_ground)) | ||
|
||
for a = -11, 11 do | ||
for b = -11, 11 do | ||
local choose_mat = math.random() | ||
local center = {} | ||
center[1] = a + 0.9 * math.random() | ||
center[2] = 0.2 | ||
center[3] = b + 0.9 * math.random() | ||
|
||
if choose_mat < 0.8 then | ||
local albedo = {} | ||
albedo[1] = math.random() * math.random() | ||
albedo[2] = math.random() * math.random() | ||
albedo[3] = math.random() * math.random() | ||
local material = Lambertian.new(albedo) | ||
scene:add(Sphere.new(center, 0.2, material)) | ||
elseif choose_mat < 0.95 then | ||
local albedo = {} | ||
albedo[1] = 0.5 * math.random() + 0.5 | ||
albedo[2] = 0.5 * math.random() + 0.5 | ||
albedo[3] = 0.5 * math.random() + 0.5 | ||
local fuzz = 0.5 * math.random() | ||
local material = Metal.new(albedo, fuzz) | ||
scene:add(Sphere.new(center, 0.2, material)) | ||
else | ||
local material = Dielectric.new(1.5) | ||
scene:add(Sphere.new(center, 0.2, material)) | ||
end | ||
end | ||
end | ||
|
||
material1 = Dielectric.new(1.5) | ||
scene:add(Sphere.new({0.0, 1.0, 0.0}, 1.0, material1)) | ||
|
||
material2 = Lambertian.new({0.4, 0.2, 0.1}) | ||
scene:add(Sphere.new({-4.0, 1.0, 0.0}, 1.0, material2)) | ||
|
||
material3 = Metal.new({0.7, 0.6, 0.5}, 0.0) | ||
scene:add(Sphere.new({4.0, 1.0, 0.0}, 1.0, material3)) | ||
|