Using VTK 7.0 I have found that rendering a 20k triangle STL model takes approximately 17ms on my Nvidia GTX970. However, I am only interested in the silhouette of this model (like the image below) and was wondering if: a) such speeds are reasonable for this model size, and b) since I am not really interested in a full render, is there a much faster way to compute just that silhouette? I considered a ray tracing approach where I just compute whether or not each pixel hits the model, but since I am only interested in speed I do not know if this is a good route to pursue. As a side note, these questions need not be specific to VTK - I am really just conerned with the fastest way to utilize a GPU to compute a silhouette (suggestions algorithms, theory, or libraries are all all welcome!) and what reasonable times I can expect for such model sizes.
-
8$\begingroup$ 17 milliseconds sounds more like the synchronisation to screen refresh rate than a actual rendering speed since that would be 1/60 (or well 16.666ms) of a second. So most likely your render is faster than that is just that displaying is restricted to one cycle. You can disable screen sync or render to a offscreen buffer for a more representative rendertime. $\endgroup$– joojaaJun 19, 2016 at 7:57
-
2$\begingroup$ sounds indeed like a vsync, turn it off and try again or render it several times to see when you get any slowdown. $\endgroup$– ratchet freakJun 19, 2016 at 22:48
1 Answer
OpenGL (scanline rendering) is always going to be way faster than ray tracing.
Ray tracing computes pixels one by one using physics (at least a good 90% of the time it's going to be real physics). Although some of it can now be done with a GPU, it is not really helping as much as one would expect. Calculating speculative lightning is not something you can easily do in parallel (ray 1 will bounce from object A to object B, ray 2 will bounce from object A to object C... you can't parallelize the computations on B and C.) The GPU helps with the matrix math, though.
In comparison, OpenGL is a total fake in comparison. It renders triangles really fast with shades coming from textures and fast gradient computations from your various light sources.
-
1$\begingroup$ You can raytrace a silhouette without any kind of shading. No need to involve physics. Also, scanline rendering is not always faster. The algorithmic complexity is different so there are cases where a raytracer will win. $\endgroup$– OlivierApr 20, 2018 at 21:09