0

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.

Robert Crovella
  • 143,785
  • 11
  • 213
  • 257
csuo
  • 820
  • 3
  • 16
  • 31
  • Where are you getting the ray instance when you call the rtTrace method..? – Sorceror Jan 23 '13 at 09:53
  • @ Sorceror, Thanks for your reply. I do not exactly get your question, would you please make more clear for me? – csuo Jan 24 '13 at 18:03
  • You're calling method `rtTrace( top_object, ray, refr_prd );`, so I would like to know, where the `ray` variable value (some instance) do came from.. – Sorceror Jan 24 '13 at 18:31
  • At the first line: optix::Ray ray( h, t, rtpass_ray_type, scene_epsilon ); we generate a new ray, where h is the hitpoint, t is something like direction, rtpass_ray_type is 1, and scene_epsilon is some epsilon value. – csuo Jan 24 '13 at 18:39
  • Could you post some image of your test scene? Are you sure that the hitpoint and direction (t) have correct values..? So the hitpoint is some exact spot on the material and direction (t) is based on refraction equation? – Sorceror Jan 24 '13 at 18:44

1 Answers1

1

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.
JBigler
  • 21
  • 3