5 ms·
Clever, but it sounds expensive! Re-rendering the entire scene (especially with that many objects) instead of a single raycast? I'm guessing you had no accelera
by OskarS 8y ago
Clever, but it sounds expensive! Re-rendering the entire scene (especially with that many objects) instead of a single raycast? I'm guessing you had no acceleration structure for any kind of raycasts, and if this was the only thing you needed raycasts for, it wasn't worth making one?
- vvanders 8y agoThat's assuming you have raycasting rendering(most game engines don't) and/or hoping that the way you draw your ray cast scene matches up pixel perfect with the GPU(it won't). Generally rendering Geo + Fill is cheap, it's the complex shaders and post that tend to drag down your GPU. Heck, if you're doing GPU occlusion culling you're basically doing the same idea but for rendering whole objects. You can also do this every 1/10 frames or so to keep overhead low. UE3 and a bunch of game editors use this technique pretty extensively.
- AHTERIX5000 8y agoMost game engines do have acceleration structure that can be used for raycasts such as one provided by physics system though. Of course it is not 1:1 compared to rendering but coarse bboxes are in many cases more useful than really accurate methods. And you can avoid syncing.
- haldean 8y agoMany game render pipelines will draw the scene a dozen times; here's an article about the pipeline from GTA V, for example: http://www.adriancourreges.com/blog/2015/11/02/gta-v-graphics-study/ http://www.adriancourreges.com/blog/2015/11/02/gta-v-graphic... Adding one more draw call for mouse interaction, especially one that requires no shading at all, is a pretty minimal additional cost.
- corysama 8y agoIt's "a lot of work" for the machine, but very little work for the programmer. It is assumed that rendering the scene is already fast enough to be happily interactive for the UI. Mouse picking is a human timeline interaction. And, it's likely that the scene is static during the pick (do you want to pick a tiny, moving atom?). So, if the pick is as fast or faster than a single frame of spinning the model, it should be unnoticeably fast for the user.
- tokyodude 8y agoyou only need to draw one pixel, the one under the mouse. cull to only objects under that pixel, set your frustum, viewport, and scissor for that one pixel and I'm guessing drawing is faster than walking triangles in the gpu