How to get primitive / vertices of mesh that contributed to specific pixel in rendering?


I have a special use case where I need to know the connection between a rendered pixel and its mesh element(s) (primitive etc.). Basically I want to render from different camera positions and annotate each mesh element with a list for camera visibility. E.g. mesh element m1 is visible in camera c1 at pixel location (u,v) and in c2 at pixel location (u,v) and so on.

Obviously, ray tracing in combination with bounding volume hierarchies does exactly what I need. But maybe there is also a good way to get the information from the rasterization process for this purpose.

My question is whether Unreal already has some interface that fits my needs here. So far I only found the “Traces with Raycasts” feature where you can get some face index if the trace hits something. But doing this for all pixels seems ineffective to me. I’m looking for a more low level access.

Because I’m not that deep into the Unreal API I would be grateful if someone with more experience could give me some hints here.