Access to all vertices in the miss program

Is there a way to get access to all the vertices, which are available in the closest hit program within the miss program?

There would be different ways to access the vertex attributes of geometric primitives of a scene inside the miss program but that would require some specific information.

To state the obvious, if you reach the miss program there is no information available about geometric primitives or their indices per se since you missed all of them.

So the first hurdle would be to know which geometry and which primitive you want to access.

Now let’s assume you’re not using instancing, so no instance acceleration structures (IAS) inside your render graph. That would mean all your geometry is inside a single geometry acceleration structure (GAS) and you can simply store all vertex attributes (position, normal, texcoord, etc.) inside one or multiple buffers and the optional indices for the topology in case the primitives are indexed. That also means there is no transform hierarchy on top of the geometry, so object space equals world space.

The pointer to these buffers can be stored inside the constant launch parameters which makes them accessible in all OptiX program domains when declaring that in each module accessing them.
With that structure you would be able to access the object space vertex attributes in all program domains.
(That would be my recommended solution for single GAS use cases.)

If you used instancing, the access to these would obviously get more difficult because there would need to be information about the instances including the effective transformation and the referenced geometry which could be used to access each of the geometry’s vertex attributes similar to the single GAS case, just with some array of the necessary information inside the launch parameters.

OptiX added some getter functions for the transform hierarchy when you know the traversable handle, like optixGetInstanceTransformFromHandle() to get the transform matrix from one instance.
https://raytracing-docs.nvidia.com/optix7/guide/index.html#device_side_functions#device-side-functions

When using more than a two-level AS hierarchy (IAS->GAS) this would need more information about the transform list along each unique path through the render graph to the instanced GAS.

You could also store a pointer to the necessary buffers of the whole scene inside the shader binding table miss record data and access that via the optixGetSbtDataPointer() function which is available inside all program domains.
Mind that miss programs are per ray type.
I would rather store these pointers to buffers (global memory) inside the launch parameters. Mind that the launch parameter block is in constant memory which is limited to 64kB. Keep it small.

For the vertex positions only, these can also be retrieved from the GAS when using the OPTIX_BUILD_FLAG_ALLOW_RANDOM_VERTEX_ACCESS, but that comes with some caveats described here:
https://raytracing-docs.nvidia.com/optix7/guide/index.html#device_side_functions#vertex-random-access

optixGetTriangleVertexData is available in all program domains according to the device functions table chapter link above, but that requires information about the GAS traversable handle, number of primitives, and sbtGASIndex when using multiple SBT records per GAS.

As you see, this can get a little complicated with instanced geometry.

Now with all that said, what exactly would be the use case for vertex attribute data access inside a miss program?
Maybe there is a better way for what you would want to achieve.