Skip to content

Instantly share code, notes, and snippets.

@awreece
Created October 31, 2012 01:22
Show Gist options
  • Save awreece/3984245 to your computer and use it in GitHub Desktop.
Save awreece/3984245 to your computer and use it in GitHub Desktop.
RT_PROGRAM void env_camera()
{
size_t2 screen = output_buffer.size();
float2 d = make_float2(launch_index) /
make_float2(screen) *
make_float2(2.0f * M_PIf , M_PIf) +
make_float2(M_PIf, 0);
float3 angle = make_float3( cos(d.x) * sin(d.y),
-cos(d.y),
sin(d.x) * sin(d.y));
float3 ray_origin = eye;
float3 ray_direction = normalize(angle.x*normalize(U) +
angle.y*normalize(V) +
angle.z*normalize(W));
optix::Ray ray(ray_origin, ray_direction, radiance_ray_type, scene_epsilon);
PerRayData_radiance prd;
prd.importance = 1.f;
prd.depth = 0;
rtTrace(top_object, ray, prd);
output_buffer[launch_index] = make_color( prd.result ); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment