Hi,
I am learning OptiX 7. After reading over the documentation and examples, there are things I still do not understand:
1. How to assign programs like CH, AH to custom geometries ?
From optixCutouts example, there are modules for sphere and triangle. I can see OptixProgramGroups are linked with the pipeline, but I can not figure out how the programs are associated with sphere and triangle, and how OptiX trace could find correct programs for different geometries.
2. How to use optixContinuationCall/optixDirectCall ?
Assuming I have only one primitive, one ray type, and two continuation callables in OptiXProgramGroup. My SBT has only one record. Using optixContinuationCall(0) successfully call the first callable, but optixContinuationCall(1) doesn’t call the second callable and produce corrupted result(kind of random noise). In this case, how can I call the second one ?
I also tried 2 records in My SBT, then optixContinuationCall(1) calls the first callable with the second SBT. Which makes sense for me, but optixContinuationCall(2) result in corrupted result.
My callables:
extern "C" float3 __continuation_callable__first()
{
return make_float3(0.1f, 1.0f, 0.2f);
}
extern "C" float3 __continuation_callable__second()
{
return make_float3(1.0f, 0.1f, 0.2f);
}
I created my callables:
OptixProgramGroupDesc callable_prog_group_desc[2]; //
callable_prog_group_desc[0] = {};
callable_prog_group_desc[0].kind = OPTIX_PROGRAM_GROUP_KIND_CALLABLES;
callable_prog_group_desc[0].callables.moduleCC = module;
callable_prog_group_desc[0].callables.entryFunctionNameCC = "__continuation_callable__first";
callable_prog_group_desc[1] = {};
callable_prog_group_desc[1].kind = OPTIX_PROGRAM_GROUP_KIND_CALLABLES;
callable_prog_group_desc[1].callables.moduleCC = module;
callable_prog_group_desc[1].callables.entryFunctionNameCC = "__continuation_callable__second";
optixProgramGroupCreate(
context,
callable_prog_group_desc,
2, // num program groups
&program_group_options,
log.data(),
&sizeof_log,
&callable_prog_group
);
I linked my programs
OptixProgramGroup program_groups[] = { callable_prog_group, raygen_prog_group, miss_prog_group, hitgroup_prog_group };
OptixPipelineLinkOptions pipeline_link_options = {};
pipeline_link_options.maxTraceDepth = 5;
pipeline_link_options.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_FULL;
pipeline_link_options.overrideUsesMotionBlur = false;
OptixPipelineCompileOptions pipeline_compile_options = {};
pipeline_compile_options.usesMotionBlur = false;
pipeline_compile_options.traversableGraphFlags = OPTIX_TRAVERSABLE_GRAPH_FLAG_ALLOW_SINGLE_LEVEL_INSTANCING;
pipeline_compile_options.numPayloadValues = 3;
pipeline_compile_options.numAttributeValues = 3;
pipeline_compile_options.exceptionFlags = OPTIX_EXCEPTION_FLAG_NONE;
pipeline_compile_options.pipelineLaunchParamsVariableName = "params";
optixPipelineCreate(
context,
&pipeline_compile_options,
&pipeline_link_options,
program_groups,
sizeof(program_groups) / sizeof(program_groups[0]),
log.data(),
&sizeof_log,
&pipeline
);
Thanks,