reactphysics3d
reactphysics3d copied to clipboard
Visualization Example
Not really an issue or bug, just wanted to share some work I did on visualization over the weekend. Here's a video of a path traced animation of spheres falling onto the ground. The rendering was done entirely by using the raycast function built in to this library.
https://user-images.githubusercontent.com/69982525/166345734-0f4074e4-be20-44d7-bcd6-af9363e09167.mp4
I've attached the source code for the project. The plan was to make it a ReactPhysics3D extension for high fidelity visualization. I'm abandoning it because the ray casting function in this library is just a tad bit slow for rendering (which is totally fine, since it was never meant for that).
Feel free to adopt it or use it for bench marking raycast
. I did not put a license in the folder, but you can consider it under the same zlib
license you have now. Cheers and thanks for making this library!
That's nice. Thanks a lot for your feedback. It's very helpful.
Do you have any idea why it was slow? Are you using only SphereShape colliders in your scene? How many spheres do you render? How many rays?
I think that parallelization would help a lot in your case (the library is currently not using multi-threading).
- I didn't investigate why it was slow. I don't think it's unreasonably slow, because it's not really typical to use a physics engine directly for ray tracing. I can look more closely at it next weekend.
- In this scene, it's a thousand spheres falling onto a box shape. This video is at 1000 samples per pixel at 720p. That's about 921,600,000 ray casts per frame. There is a little over 100 frames in this video.
- I remember trying to use OpenMP like I usually do for screen-space parallelization. It was surprisingly slower than no multi-threading. Usually, I'd see a proportional speed increase. I'll take a look into this as well next weekend.
Closing this issue - to clear out the backlog and also because this wasn't really an "issue" to begin with. Cheers