Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Tags in this Discussion

Getting strange black regions with OptiX
  • Hi guys!
    I got stuck with this issue and can't move any further. Any help will be highly appreciated!

    So, I am ray tracing scene with several triangle meshes. When I use ray depth more than one, I get black reflections as you may see on attached screenshot.

    I organize objects into the OptiX hierarchy as follows:

    Group (with updating acceleration structure)
    -> Transform
    --> Geometry Group (with acceleration structure built on initialization)
    ---> GeometryInstance
    -> Transform
    --> Geometry Group
    ---> GeometryInstance
    (two more similar subtrees)

    Thank you in advance. Cheers, Valeria!
    Screenshot-10.png
    690 x 481 - 26K
  • 3 Comments sorted by
  • What is the code you are calling when you do rtTrace for the reflection? Make sure the object you pass in is the root group. Also check that you have set your ray type to radiance for the reflection and have supplied the correct per-ray-data. I remember making that one a few years back which was silly of me.
  • Thank you for your reply! I double checked everything and did not find any bug.
    I have only one ray type, so I pass 0 to optix::make_Ray, which should indicate, that I am calculating radiance.

    I pass my top Group to top_object variable, which I set as follows:
    top_level_group = rt_context->createGroup();
    ..blah-blah..
    rt_context["top_object"]->set(top_level_group);


    In cuda code I declare variable:
    rtDeclareVariable(rtObject, top_object, , );
    and then for reflection, I call
    optix::Ray reflection_ray = optix::make_Ray(hit_point, R, 0, scene_epsilon, RT_DEFAULT_MAX);
    PerRayData_radiance new_prd;
    new_prd.depth = prd.depth + 1;
    rtTrace(top_object, reflection_ray, new_prd);
    result += reflectivity * new_prd.result;
    ...
    // at the end
    prd.result = result;


    My per-ray-data has the following format:
    struct PerRayData_radiance {
    float3 result;
    int depth;
    };
  • I fixed that!!! Should've enabled printing to see that I'm getting stack overflow error and then enlarged stack size. So, three lines that fixed the problem were:

    context->setPrintEnabled(1);
    context->setPrintBufferSize(4096);
    context->setStackSize(3200);