       ray.color *= triangle.material.specular_color;
       ray.direction = ComputeReflectionDirection(normal, ray.direction);
     } else if (random <= threshold[2]) { /* Refraction */
-      // ray.color *= 0.9;
+      ray.color *= 0.9;
       ray.direction = ComputeTransmissionDirection(
           normal, ray.direction, incident_ior, transmitted_ior);
     }

namespace cupt {

namespace {

__device__ inline float3 ComputeReflectionDirection(const float3 normal,
                                                    const float3 incident) {

  return normalize(direction);
}

__global__ void InitializationKernal(size_t* indices, curandState* curand_states,
                                     size_t num_pixels, size_t seed) {
  size_t idx = blockIdx.x * blockDim.x + threadIdx.x;
  if (idx >= num_pixels) return;

  indices[idx] = idx;
  curand_init(hash(idx) * hash(seed), 0, 0, &curand_states[idx]);
}

__global__ void RayCastFromCameraKernel(Ray* rays,
                                        const size_t num_pixels, const unsigned intensity,
                                        curandState* curand_states) {
  size_t idx = blockIdx.x * blockDim.x + threadIdx.x;
  if (idx >= num_pixels) return;

  size_t x = idx % camera.resolution.x;
  size_t y = camera.resolution.y - idx / camera.resolution.x - 1;

  curandState* const curand_state = &curand_states[idx];

  /* compute axis direction */
  float3 x_axis = normalize(cross(camera.view, camera.up));
