Page 1 of 1

Batched raycasting wrapper in C

Posted: Wed Aug 12, 2020 4:07 pm
by BluePrintRandom
I have a friend maintaining UPBGE - (a fork of blender game engine running in blender 2.9x)

I was wondering what the name of the batched raycast system was under the hood so we can wrap it / more information about it for upbge

note- we are building using bullet 2.83

Re: Batched raycasting wrapper in C

Posted: Thu Aug 13, 2020 4:23 pm
by drleviathan
By "batched" which one of these do you mean:?

(1) "One raycast against the whole (batched) world of objects"
(2) "A batch of raycasts against the whole world of objects"

Item (1) does exist as a feature of the BulletPhysics API. Item (2) does not.

Item (1) is done through btCollisionWorld::rayTest(). You have to supply a (typically custom) RayResultCallback implementation which "does what you want" whenever the ray hits something.

I downloaded what I think is a more recent copy of UPBGE. All of the "physics" stuff I could find was in python. Under the hood Bullet is truly C++ but there is a python wrapper. You might try asking in the PyBullet Support and Feedback forum.

Re: Batched raycasting wrapper in C

Posted: Sat Aug 15, 2020 5:00 pm
by BluePrintRandom
This seems to indicate otherwise*


Image

viewtopic.php?f=18&t=1907&view=next


viewtopic.php?t=3790
"Interesting, I didn't know about this. Look in the Benchmark and ConcaveRaycast demos for #ifdef BATCH_RAYCASTER

I guess you'll have to define that before you can see how it works. Note that this isn't going to make raycasting threadsafe. It looks like it uses a thread barrier to perform raycasts in a large batch, thus the name.
Top
"

Re: Batched raycasting wrapper in C

Posted: Sun Aug 16, 2020 4:03 pm
by drleviathan
Hrm...

True, there is an #ifdef BATCH_RAYCASTER inside examples/Heightfield/HeightfieldExample.cpp however I don't see any evidence it actually works... in Bullet 2.88 because it relies on a gBatchRaycaster being a valid pointer but there is no code that actually declares or sets it. AFAICT: if you were to define BATCH_RAYCASTER then the example would fail to compile. That code appears to be cruft.

I rolled back to 2.83 to see. The example code there is more complete. In one of the Demos gBatchRaycaster points to an SpuBatchRaycaster instance, however I cannot find the actual implementation of that class. I can only conclude: at the 2.83 release the "batch raycaster" is cruft but has suffered less bitrot.

I'm just trying to be helpful. I certainly don't want to discourage you from finding the information you seek. Unfortunately: I couldn't find the information you are looking for. Good luck.

Re: Batched raycasting wrapper in C

Posted: Tue Aug 18, 2020 11:45 pm
by BluePrintRandom
it appears to be earlier than that even - it's in the release notes for 2.67