Transparency in Progressive Photon Mapping in cuda

248 views Asked by At

I am working on a project, which is based on optix. I need to use progressive photon mapping, hence I am trying to use the Progressive Photon Mapping from the samples, but the transparency material is not implemented. I've googled a lot and also tried to understand other samples that contains transparency material (e.g. Glass, Tutorial, whitted). At last, I got the solution as follows;

  1. Find the hit point (intersection point) (h below)
  2. Generate another ray from that point
  3. use the color of the new generated points

By following you can also find the code of that part, by I do not understand why I get black color(.0f, .0f, 0.f) for the new generated ray (part 3 above).

optix::Ray ray( h, t, rtpass_ray_type, scene_epsilon );
HitPRD refr_prd;
refr_prd.ray_depth = hit_prd.ray_depth+1;
refr_prd.importance = importance;

rtTrace( top_object, ray, refr_prd );

result += (1.0f - reflection) * refraction_color * refr_prd.attenuation;

Any idea will be appreciated. Please note that refr_prd.attenuation should contains some colors, after using function rtTrace(). I've mentioned reflection and reflaction_color to help you better understand the procedure. You can simply ignore them.

1

There are 1 answers

0
JBigler On

There are a number of methods to diagnose your problem.

  1. Isolate the contribution of the refracted ray, by removing any contribution of the reflection ray.
  2. Make sure you have a miss program. HitPRD::attenuation needs to be written to by all of your closest hit programs and your miss programs. If you suspect the miss program is being called set your miss color to something obviously bad ([1,0,1] is my favorite).
  3. Use rtPrintf in combination with rtContextSetPrintLaunchIndex or setPrintLaunchIndex to print out the individual values of the product to see which term is zero from a given pixel. If you don't restrict the output to a given launch index you will get too much output. You probably also want to print out the depth as well.