Closed EddeDev closed 2 years ago
I gave it a try and it works better than expected. It's available in the current 0.4.16-SNAPSHOT release and in the dev branch.
Here is an example how to use it: PassThroughFilterShaderTest.
I tested the filter shader with 2000 colliding boxes and there is almost no difference in speed comapred to the native default filter shader.
A few notes:
filterShaderData
field in PxSceneDesc
which would be painful from Java. Therefore this is done via PxTopLevelFunctions.setupPassThroughFilterShader(sceneDesc, shader);
instead of sceneDesc.setFilterShader(...);
pairFlags
, which is difficult to emulate in Java. My solution is that the Java filter shader implementation has to call the method setOutputPairFlags(flags);
filterData
parameters as individual ints instead of PxFilterData
objects. This makes the method signature a bit messy but access to the individual words does not require additional JNI interaction and therefore is much faster.Thanks! :D
That would indeed be quite useful. However, I think a Java passthrough of the filter shader will have pretty bad performance (the filter shader can be called an awful lot of times), so I haven't done that until now. It might be useful anyway.