Ray tracing for multiple surface ...

Hi,

I have a 3D humanoid graphics defined by a few million 3D points (I am using CUDA interop for rendering and handeling calculations). I have an arbitrary spotlight source (it is not used for actually illuminating the scene). I also know the vertices that will be illuminated by this source. I want to separate out the points that lie on the surface closest to my light source. e.g. if the light source is on the right side of the graphic and is pointing towards the graphic. it will be illuminating the right arm, the chest/abdomen and the left arm. I know the vertices of the graphic that are illuminated. And i want to separate out the vertices that are on the right arm. I am able to separate the vertices that face the light source. Is there an efficient way to get the indexes of the vertices that lie on the right arm.

Thank you in anticipation.

regards
Vj

If I understand correctly this is essentially a shadow calculation: of the vertices facing the light source, you only want those not in shadow. Since you mention ray tracing in the post’s subject, you could send a “shadow ray” from the vertex towards the light source, if you do not hit anything the vertex is lit, otherwise it is in shadow.

Hey Carsten,
Thanks. I was thinking on the same lines. The way I am trying to implement this algorithm was to shoot a ray from each vertex (V1) towards the light source. Calculate the distance between the ray and any other vertex v2 (loop through all vertices). If this distance is less than the predefined tolerance and the distance between V1 and source is less than the distance between V2 and source, then V1 is illuminated otherwise V2 is illuminated. Now the problem is that that I have a million vertices. I can launch a million gpu threads for comparing each vertex individually. But then each thread will loop through a million iterations (I do not have dynamic parallelism capability at this point). And that really slows down my application. I am looking for a faster implementation of the algorithm. Any idea??

The way ray tracing is usually accelerated is by building a hierarchical data structure over the primitives, these days bounding volume hierarchies (BVH) seem to be popular, kd-trees, bsp-trees and octrees are other alternatives. There are algorithms that can build a BVH on the GPU too.
Please note that a ray tracing forum may be a better place to discuss this topic.