Added image 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
16
17 local lights = {V.new{1,-1,1}}
18
19 local plane_normal = V.normalize(V.new{0.0,-1,0.0})
20 local texture_y = V.normalize(V.cross(plane_normal,V.x))
21 local texture_x = V.cross(texture_y,plane_normal)
22
23 local scene = {
24    sdf = P.make_plane(V.new{0,0,0}, plane_normal,
25                       T.make_phong_texture(lights,
26                                            T.map_rectangular(
27                                               T.make_mandelbrot_pigment(
28                                                  make_image_pigment("images/wood1.ppm",1),
29                                                  make_image_pigment("images/wood2.ppm",1),
30                                                  20),
31                                               texture_x, texture_y),
32                                            0.2, 1.0, 0, 1)),
33
34    -- sdf = P.make_plane(V.origin, plane_normal,
35    --                    T.make_phong_texture(
36    --                       lights,
37    --                       T.map_rectangular(
38    --                          -- T.make_solid_pigment({0.5,0.2,1.0}),
39    --                          T.make_checkered_pigment(
40    --                             make_image_pigment("images/wood1.ppm", 1),
41    --                             make_image_pigment("images/wood2.ppm", 1)),
42    --                          texture_x, texture_y), 0.2, 1.0, 0.5, 20)),
43                                
44    camera = {location = V.new{0,-5,0},
45              point_at = V.new{0,0,0},
46              right = V.x,
47              fov = 1}}
48
49 Render.render(scene, 1280, 960, "mandel_wall.ppm")