Beginner with simple geometry program problems

[ACCEL] Invalid value (0) for “buildInputs[0].triangleArray.flags”

That’s because you have not set that flags pointer inside your code.
https://raytracing-docs.nvidia.com/optix8/api/struct_optix_build_input_triangle_array.html#a62da71e3d7992526ed1935001e78fb49
It must be a pointer to an array of OptixGeometryFlags, one per SBT record.
Something like this: https://github.com/NVIDIA/OptiX_Apps/blob/master/apps/MDL_renderer/src/Device.cpp#L1376

[PIPELINE] params variable “params” not found in any module. It might have been optimized away.

You told OptiX that the name of your launch parameter block in constant memory is named params with this field inside the OptixPipelineCompile options:
pipelineCompileOptions.pipelineLaunchParamsVariableName = "params";

Then you need to have a declaration for that params variable with your launch parameter structure.
Something like this, just with your structure and variable names:
https://github.com/NVIDIA/OptiX_Apps/blob/master/apps/MDL_renderer/shaders/raygeneration.cu#L40

Please do not set some fixed values for the stack sizes. Do the proper calculation to use the minimal necessary amount.
The OptiX SDK contains helper functions for that inside the optix_stack_size.h header.
I rolled my own before that header existed:
https://github.com/NVIDIA/OptiX_Apps/blob/master/apps/MDL_renderer/src/Device.cpp#L932

You set pipelineCompileOptions.traversableGraphFlags = OPTIX_TRAVERSABLE_GRAPH_FLAG_ALLOW_SINGLE_LEVEL_INSTANCING; which is good because that is the fastest render graph layout on RTX boards, but you’re only calling optixAccelBuild once and build a geometry AS only. There needs to be some optixAccelBuild over OptixInstances for the top-level instance AS as well and the traversable handle of that should be your argument to optixTrace calls.
There was a recent discussion about that here: https://forums.developer.nvidia.com/t/question-about-instance-acceleartion-struction/283898

If you look into the examples inside that github repository, there are some simpler cases where some runtime generated geometries are built (plane, box, sphere, torus). I just added another example to that today.
https://forums.developer.nvidia.com/t/optix-advanced-samples-on-github/48410/4

1 Like