Colours are now Vectors, added rainbow pigment.
[raymarcher.git] / mandel_floor.lua
1 require "Vector"
2 local V = Vector
3
4 require "Primitives"
5 local P = Primitives
6
7 require "Operations"
8 local O = Operations
9
10 require "Textures"
11 local T = Textures
12
13 require "Render"
14
15 local lights = {V.new{3,-3,1}}
16
17 local scene = {
18    sdf =
19       O.union{
20          O.diff{P.make_sphere(V.new{0,0,0}, 1,
21                               T.make_phong_texture(lights,
22                                                    T.map_spherical(
23                                                       T.make_checkered_pigment({0,1,0},{1,1,1}),
24                                                       V.origin, 10, 10),
25                                                    0.2, 0.7, 1.0, 100)),
26                 P.make_sphere(V.new{0,0,0}, 0.8),
27                 P.make_pipe(V.new{0,0,0}, 0.5, V.new{0,1,0}),
28                 P.make_pipe(V.new{0,0,0}, 0.5, V.new{1,0,0})},
29
30          P.make_plane(V.new{0,0,-1}, V.new{0,0,1},
31                       T.make_phong_texture(lights,
32                                            T.map_rectangular(
33                                               T.make_mandelbrot_pigment(
34                                                  T.make_checkered_pigment({0.5,0.2,1.0},{1,1,1}),
35                                                  T.make_checkered_pigment({1,1,1},{0.5,0.2,1.0}),
36                                                  20),
37                                               V.x, V.y),
38                                            0.2, 1.0, 0, 1))},
39                                
40    camera = {location = V.new{2,-5,1},
41              point_at = V.new{0,0,0},
42              right = V.x,
43              fov = 1}}
44
45 Render.render(scene, 1280, 960, "mandel_floor.ppm")
46 -- Render.render(scene, 320, 200, "mandel_floor.ppm")