Sail

a path tracer using WebGL for realtime performance. github:https://github.com/Easonzero/Sail

1
scene = new Sail.Scene();
2
//create camera;
3
let camera = new Sail.Camera(
4
    [2.78,2.73,-6],[2.78,2.73,2.79]
5
);
6
//create textures and materials
7
let matte = new Sail.Matte(0.7);
8
let metal = new Sail.Metal(0,0.01,0.1);
9
let mirror = new Sail.Mirror(1.0);
10
let glass = new Sail.Glass(1,1,1.5);
11
let checkerboard = new Sail.Checkerboard();
12
let checkerboard2 = new Sail.Checkerboard2();
13
//add areaLight
14
scene.add(new Sail.AreaLight(
15
new Sail.Rectangle(
16
    [2.13,5.48,2.27],[3.43,5.48,3.32],
17
    matte,Sail.Color.BLACK
18
),[1,1,1]));
19
//add cornellBox    
20
scene.add(new Sail.Cornellbox());
21
//add objects
22
scene.add(new Sail.Sphere(
23
    [1.5,1.25,2.70],1.2,
24
    mirror,Sail.Color.WHITE
25
));
26
scene.add(new Sail.Sphere(
27
    [3.9,1.25,1.70],1.2,
28
    glass,Sail.Color.WHITE
29
));
30
//add camera    
31
scene.add(camera);
32
//declare renderer setting
33
//the format of params' value must be float
34
scene.filter = 'tonemapping';
35
scene.trace = 'path';