batch processing raycasts?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

batch processing raycasts?

Postby JernejL » Thu Jan 04, 2018 9:55 am

I've been reading the source code comments regarding raycast function, that "the cost of calling 1000 ray cast is 1000 times the cost of calling one ray cast", but i would gladly - on my side organize code, that i could do multiple raycasts in batches (for example for AI).

Could something like this be implemented, and would the performance of raycasts improve as a result?
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: batch processing raycasts?

Postby Julio Jerez » Thu Jan 04, 2018 10:21 am

it sounds like a good idea but is practice, is does not really work because two rays will probably have different begin or end point, so they will diverge on the broad cast. and will end up casting different shapes.
one way would be to make the ray a spatial partition like a compound collision, but since ray are too unpredictable, then there will be lot of work maintaining the structure.

you can do the multithreaded is two ways.
1- you can do you one thread pool system and launch task to different threads.
2- you can use a listener and call the ray cast form an update, however this requires the engine to run multithreaded.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: batch processing raycasts?

Postby JoeJ » Thu Jan 04, 2018 1:36 pm

I thought about that problem for graphics purposes on GPU, this idea seems interesting:
Instead traversing the tree for each ray, traverse it just once and maintain propagate rays that intersect the bounding volume to children. But that makes less sense on CPU if at all.

For AI you could simply time slice the workload?
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: batch processing raycasts?

Postby JernejL » Fri Jan 05, 2018 3:43 am

rays would have different points, but they would be potentially nearby, maybe some data from raycasts in proximity could be reused, to speed up multiple raycasts?

If not, then how is a good way to do ai checks, i'm using some raycasts currently to see like where players and / or cars are free to travel.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: batch processing raycasts?

Postby Julio Jerez » Fri Jan 05, 2018 10:33 am

has you looked at the parallel ray cast demo (which BTW I just test an they a primitive that has a bug, I will fix it)
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 15 guests