Hi
I have a 3D universe full of spheres and ellipsoids. I fire a laser into this universe and, with depth testing / stencil testing, can see the laser correctly renders until it hits something.
Now I want to do something graphical with the point where the laser hits another object (an explosion for instance).
I can do some nice linear algebra to find intersections of lines in 3D with spheres and ellipsoids which is a bit complex but can be done. However, before I roll out the masses of matrix multiplications required it strikes me (sorry for the pun) that my shaders / GPU may already have the answer as they are correctly depth testing / stencil testing and not rendering the laser beyond any object it hits.
Is there a way to obtain the result of the depth test / stencil test result for my laser hitting an object ? whereby I get the object the laser hit, or the position on the object it or any relevant information about the “collision” which would enable me to identify the object hit and position it was hit ?
Sorry for the long question and hope it makes sense.
Ian