Colours are now Vectors, added rainbow pigment.
[raymarcher.git] / mandel_wall.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{1,-1,1}}
16
17 local plane_normal = V.normalize(V.new{0.0,-1,0.0})
18 local texture_y = V.normalize(V.cross(plane_normal,V.x))
19 local texture_x = V.cross(texture_y,plane_normal)
20
21 local inside_pigment = T.make_image_pigment("textures/parquet2.ppm", 1)
22 local outside_pigment = T.make_image_pigment("textures/parquet1.ppm", 1)
23
24 local scene = {
25    sdf = P.make_plane(V.new{0,0,0}, plane_normal,
26                       T.make_phong_texture(lights,
27                                            T.map_rectangular(
28                                               T.make_mandelbrot_pigment(
29                                                  inside_pigment,
30                                                  outside_pigment,
31                                                  100), -- Iterations
32                                               texture_x, texture_y),
33                                            0.2, 1.0, 0, 1)),
34
35    camera = {location = V.new{-0.5,-5,0},
36              point_at = V.new{-0.5,0,0},
37              right = V.x,
38              fov = 1}}
39
40 -- Render.render(scene, 320, 200, "mandel_wall.ppm")
41 -- Render.render(scene, 1280, 960, "mandel_wall.ppm")
42 Render.render(scene, 2560, 1440, "out/mandel_wall.ppm")