CUDA and/or OpenGL for fast CubeMap Textures computations

Hi, I have a triangulated model with (let’s say) 15 million faces. I want to assign a distinct ID (or maybe color) to each triangle (i.e. 15 million IDs) and after that, I want to generate a few million cubemap textures from regular points within this model. Then, for each cubemap texture I want to scan which distinct colors exist and keep a global (shared) accumulating counter, among all cubemap textures. Or in other words, I want to count how many times each distinct id (i.e. triangle) is found to exist within all cubemaps. For example, the triangle with ID 412345 (or color RGB 240,102,248) is located in half of the cubemaps textures.

With that process I will be able to see which triangle is the most/least visible. I do not care about visuallizing anything. I only want the counts and for that I am searching for the fastest possible approach.

Can I achieve this, fast, by using only CUDA C++ parallelism? Or I’m I going to need other specific tools/frameworks/libraries/etc… for that (e.g. OpenGL)? What would the fastest approach be? By the way I have no experience with either CUDA C++ or OpenGL. I can only speak Java, Python, R and Julia.

Maybe the following will help you even more understand what am I trying to calculate:
My voxel model is 3-dimensional. However, let’s simplify the case study into a square 2-dimensional model, to help you understand what I am trying to calculate.

If you visit the following link you will see a complete (towards all directions in 2D space) raycasting scan from a red point.

Now, let’s assign a distinct color on each square of this 2D model and then convert the entire (360deg) scan into a single (cubemap) texture. Within this image, all visible colors suggest that their corresponding square surfaces are visible from the red point. Contrariwise, all colors that are not shown in this image (although they were assigned somewhere), belong to surfaces (squares) that are not visible from the red point. Now, let’s store which squares are shown from the red point.

Next step, generate more red points (at other places) and repeat the procedure. In the end, I want to calculate which square is in total (among all textures) more “visible” (i.e. being shown the most times) and of course this will also show me the opposite (i.e. which square is the most hidden in total).

This is it. In my real case, I have a 3D voxel model with about 3 million voxels and the “red” points are about 200k.

What would the best approach for such calculation be you suggest? Maybe the idea of using cubemap textures is overkill and something smarter should be done here.

Thank you for your time!