Sample scenes
box_cyl_opaque_shadow.ray
box_cyl_reflect.ray
box_cyl_transp_shadow.ray
box_dist_atten.ray
cylinder_refract.ray
cyl_ambient.ray
cyl_diffuse.ray
cyl_diff_spec.ray
cyl_emissive.ray
recurse_depth.ray
sphere_refract.ray
texture_map.ray
Download as a group

cylinder_refract.ray

Purpose: Test the refraction term

Settings:

Recursive depth10

Image:

Code:

SBT-raytracer 1.0

// cyl_cyl_refract.ray
// purpose: Test the refraction term
// depth: 10
// Don't forget to increase the trace depth to >= 2!

// This was rendered with the following attenuation
// settings:
// Distance scale: 0.000        OR   1.87
// Constant term:  0.25         OR   0.25
// Linear term:    0.0033724    OR   0.25
// Quadratic term: 0.00004592   OR   0.25


camera
{
  position = (5, 0, 0);
  viewdir = (-1, 0, 0);
  updir = (0, 0, 1);
}

directional_light
{
  direction = (-1, -1, -0.2);
  color = (1, 1, 1);
}

// Sphere acts as a lens
translate( 0, 0, -0.5,
scale(.2, 1.5, 1.5, cylinder {
  material = {
    diffuse = (0, 0.4, 0);
    transmissive = (0.7, 0.7, 0.7);
    index = 1.5;
  }
} ) )

// Add a couple of crossed cylinders behind the sphere to
// see the refractive effect.
translate( -2, -1, -10,
scale( .2, .2, 20,
  cylinder {
    material = { diffuse = (0.8, 0.4, 0); specular = (0.7, 0.7, 0.7); }
  } ) )


translate( 0, 0.5, 0,
rotate( 1, 0, 0, .6,
translate( -2, -1, -10,
scale( .2, .2, 20,
  cylinder {
    material = { diffuse = (0.8, 0, 0.4); specular = (0.7, 0.7, 0.7); }
  } ) ) ) )