Is anyone else getting really aweful performance for raycasting?
I created a job where i pass in the collision world and i do 5k raycasts all with a length of 2 and it costs upwards of 70ms. The only active object in the scene is a cube, directional light and camera. Am i doing something wrong?
#Raycast Performance
1 messages · Page 1 of 1 (latest)
You don't seem to have burst on
true, thanks for pointing that out. Is it just putting the [BurstCompile] on top of the method definition? I just put that on there and made sure safety checks were off. No change unfortunately, but from what i've read thats good practice anyway to have burst enabled.
I have also tried doing it in an IJobParallelFor and an IJobEntity and while parallelizing it does reduce the theoretical total cost, it also clogs up the worker threads quite a bit.
It feels like i must be doing something wrong because the standard PhysX is like at least 10x faster than this by default and the Raycast batching is even fast (i think it did 5k in 0.5ms).
on top of your struct definition, not the method
my god
thank you magic man
I cant see where it's being done in the profiler just yet but the player loop went from 70ms down to like 2ms. I cant believe something that simple made such a huge diff
literally 100x faster. goddamn
Magic of burst. Burst is love. Burst is life. For raycasting, it's doing a sequential BVH tree traversal using SIMD quad nodes instead of traditional binary ones. So it's really really fast.
now do it in parallel 😄
yup, 5000 spheres, all with physics bodies, all doing raycasts, and adding force to them...under 1ms. I need to take a min. My legs are getting weak 
much better to batch raycasts
and do it all in one go
will be much faster