Face access for ray generation

I’m trying to use Optix-8.0.0 to compute per-face occlusion for a single point of light. I want to generate a single ray per face, directed toward the light source, and check for any hits (excepting the self-intersection at the ray origin). Zero hits and the face is illuminated, one or more and it is illuminated. My problem is how to access the face geometry in __raygen__rg to create the ray at or near each face center. The BVH acceleration structure is not accessible to __raygen__rg, and doesn’t clearly expose the geometric primitives. Do I need to instead put the vertices of the geometry into an attribute that __raygen__rg can somehow see?

This is one of the more often discussed questions on this forum.
The sampling issue of the geometry positions is similar to a direct lighting implementation for arbitrary mesh lights which I have implemented inside my open-source OptiX examples.
The connection to the single point of light is then simply a fast visibilty/shadow ray test and the fastest method for that is also shown inside my examples.

Please read these threads where I described multiple ways to handle that:

This explains the fastest visibility ray implementation:
(Actually there is also another fast method using the Shader Execution Reordering optixTraverse call shown inside the OptiX SDK optixPathTracer example. I would try that only after the above method works.)

Find the example code here:
Look at the newest example rtigo12 for the arbitrary mesh and point light sampling and the fastest shadow ray implementation.

Thank you @droettger for pointing me to those other posts.