3 ms·
> its not an obvious candidate for offloading the the GPU -- How? Shooting a ray to every vertex comes to my mind. I'm not following your meaning here ;) My b
by willvarfar 10y ago
> its not an obvious candidate for offloading the the GPU -- How? Shooting a ray to every vertex comes to my mind.
I'm not following your meaning here ;)
My blog post describes how to do it in a sweep rather than 'shooting lines', for the performance reasons given in the blog post.
'Shooting lines' is pretty poor for performance because of data locality and cache pressure.
In general, locality is the big performance problem with 'ray tracing' in general. All attempts at speeding up ray tracing are about trying to make 'bundles' of adjacent rays flying in close formation that can be combined or computed together so as to try and give some locality to the problem.
My scanline approach (line as in cache array of adjacent memory, not line as in line-of-sight between eye and obstacle) is good for CPUs and good for GPUs. If you want to offload viewshed computation to the GPU, you ought strive for a scanline approach rather than 'shooting a ray to every vertex' too. My code ought be straightforward to port to a shader.
- legends2k 10y agoMy bad! Of course ray tracing in the GPU would be costly; I dunno where I got that. I think my mind is still stuck on 2D after this, need to go back to 3D :) When I had to do picking on a 3D terrain, I did a scanline approach too (https://bitbucket.org/rmsundaram/tryouts/src/master/CG/Terrain/Picking/ https://bitbucket.org/rmsundaram/tryouts/src/master/CG/Terra...)