Hello All,
I don’t know if it is possible, but I would like to trace 3 rays from a closest hit program depending on which object the initial ray is hitting. I mean, if the initial ray hits object A I would trace 3 new rays from the hiting point, if the initial ray hits any other object I would trace only one more ray. To avoid inifine tracing, I only allow this to happen two times controlling it with the payload (pay_load).
If I do it directly, the code works… But the payload that is sent in the rtTrace function is shared with the 3 throws, so it is changed after each call to rtTrace. If I try to create a new payload with the information of the original payload before trace each ray I get a crash in the nvidia display driver and when it recovers I caught one exception with this error string:
“Unknown error (Details: Function “_rtContextLaunch2D” caught exception: Encountered a CUDA error: driver().cuEventSynchronize(m_event) returned (702): Launch timeout, [6619195])”
Is it possible to do what I want to do? Maybe I’m doing something wrong…
The current configuration is CUDA 4.1, Optix SDK 2.5.0, Windows 7 64 bits, Visual Studio 2010 with a 32 bits project, and GTX 460 driver version 311.06.
My code looks like this:
rtDeclareVariable(float, t_hit, rtIntersectionDistance, );
rtDeclareVariable(PhotonPRD, hit_record, rtPayload, );
rtDeclareVariable(optix::Ray, ray, rtCurrentRay, );
RT_PROGRAM void ppass_closest_hit()
{
//compute the new ray direction
float3 new_ray_dir = ...
//Compute the energy of the photon after the hit and store it in a optix::buffer connected to a vbo
new_energy = ...
storeInBuffer(new_energy);
//Determine the object hitted
int object_hitted = ...;
//update the number of times that photon has hitten
hit_record.num_deposits++;
//throw new rays
if(object_hitted == A)
{
PhotonPRD prd;
prd.energy = hit_record.energy;
optix::ray new_ray1(hit_point, ray_dir, ppass_ray_type, scene_epsilon, 60.0)
rtTrace(top_object, new_ray1, prd);
PhotonPRD prd2;
prd.energy = hit_record.energy * -1;
optix::ray new_ray2(hit_point, ray_dir, ppass_ray_type, scene_epsilon, 60.0)
rtTrace(top_object, new_ray2, prd2);
PhotonPRD prd3;
prd.energy = new_energy;
optix::ray new_ray3(hit_point, new_ray_dir, ppass_ray_type, scene_epsilon, 60.0)
rtTrace(top_object, new_ray3, prd3);
}
else
{
hit_record.energy = new_energy;
optix::Ray new_ray( hit_point, new_ray_dir, ppass_ray_type, scene_epsilon, 60.0);
rtTrace(top_object, new_ray, hit_record);
}
}
Any idea?
Thanks!!!