' '

Difficulty

1

Prerequisites

ray-tracers/v2

Reading material

design/primitives/ray-intersections

def scene_at(now)
{
  var eye_position = Animations.ease(Animations.animate( pos(0, 1, 1), pos(20, 20, 20), seconds(5)), Easing.quintic_inout)
  var camera = Cameras.perspective( [ "eye": eye_position[now],
                                      "look_at": pos(0,0,0) ] )

  var white = Materials.uniform( [ "ambient": Colors.white() * 0.1,
                                   "diffuse": Colors.white() * 0.8 ] )
  var black = Materials.uniform( [ "ambient": Colors.white() * 0.1,
                                   "diffuse": Colors.black() * 0.8 ] )

  var plane_material = Materials.from_pattern(Patterns.checkered(1, 1), black, white )

  var root = decorate(plane_material, xz_plane())

  var lights = [ Lights.omnidirectional( pos(0,5,0), Colors.white() ) ]

  create_scene(camera, root, lights)
}

var raytracer = Raytracers.v6()

var renderer = Renderers.standard( [ "width": 500,
                                     "height": 500,
                                     "sampler": Samplers.multijittered(2),
                                     "ray_tracer": raytracer ] )

pipeline( scene_animation(scene_at, seconds(5)),
          [ Pipeline.animation(30),
            Pipeline.renderer(renderer),
            Pipeline.studio() ] )

1. Implementation

Your starter code comes with an implementation for XY-planes. Your task, should you choose to accept it, is to implement XZ-planes and YZ-planes.

As a first step, we suggest you take a good look at the XY-plane implementation to understand how the ray-plane intersection algorithm works. Then, implement extra classes using XY-plane as a guide.

Implement XZ- and YZ planes.

  • Both planes should contain the point \((0, 0, 0)\). Moving the plane around can be done separately using translations.

  • Make these available as xz_plane() and yz_plane() in the scripting language.

2. Evaluation

Recreate the scene below.