Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

NVIDIA PhysX plugin - preview

Discussion in 'Physics Previews' started by HerrVR, Mar 15, 2019.

  1. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    839
    @HerrVR Is there an estimated timeline for a beta ? My tests with the early preview did work well, but I am a bit hesitant to move a full project to use this plugin (also considering how e.g. the Flex plugin was not updated anymore since first stable beta release). Also, very interested in PhysX 5.0 features, as it seems to have the Flex capabilities build in already, any plans to switch to 5.0?
     
  2. Roni92pl

    Roni92pl

    Joined:
    Jun 2, 2015
    Posts:
    396
    I also would very much like to move to this Physx implementation, but unfortunately it's not ready for this yet;
    Lack of high lvl components isn't big deal, writing them is easy and pleasant, but it doesn't have any kind of layers handling, which is deal breaker(at least for me) and wheel colliders are also not implemented.
     
  3. segant

    segant

    Joined:
    May 3, 2017
    Posts:
    196
    Hey how is it going? I can't find time to examine. We need URP shaders that supports your gpu physics. If i could find time, i may examine your shader code but i cant. So i just want everything executed in gpu(render and physics). But if needed data should be sent to cpu. I can't imagine it's performance if it'll be done for urp.
     
  4. Florian-Nouviale

    Florian-Nouviale

    Joined:
    Mar 14, 2013
    Posts:
    54
    Hi,
    I'm in the same case as @MicCode in one of my project : We are using a bullet integration we found on github. Our main requirement was high frequency update to control an haptic device (we are talking 400hz here). Would this plugin be able to handle this ? I already have a high frequency threading mechanism in place on top of the bullet integration but we are almost literally one rigidbody away from overloading the bullet thread in our most complex scene
     
  5. Aykutkaraca

    Aykutkaraca

    Joined:
    Jan 4, 2018
    Posts:
    33
    Hi Guys,
    I use 2019.2.0f1 and I havent downloaded any package or enabled anything for PhysX but I see a large peak in my game at physcx.pxscontextCCDAdvance with 14ms. Why is that?? How can I disable PhysX?
     
  6. yant

    yant

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    594
    I'm sorry to be this man, but looks the post is off topic of the thread.

    Anyways, it cannot be the case that you have no physics in the project and PhysX is still reported as taking time in CCD (=Continuous Collision Detection). Please kindly check if you have any Colliders in your scenes, or Rigidbodies. That would hopefully give a few starting pointers.

    Anthony
     
  7. Aykutkaraca

    Aykutkaraca

    Joined:
    Jan 4, 2018
    Posts:
    33
    Hi Antony,

    Thank you and sorry for being lame. I was desperate. I have physics but that error is definitely related to the mesh collider I use as ground. The mesh is created on the run manually by a mesh creator script on a spline (PathCreator free asset from asset store). I marked it as non-convex but it has no rigidbodies attached to the mesh (road as ground in my case). But still it isnt clear to me why Nvidia Physx is involved. Is it the default physics engine in 2019 version?
     
  8. segant

    segant

    Joined:
    May 3, 2017
    Posts:
    196
    Yes, it is. (Aykut unity varsayılan olarak nvidia physx kullanıyor.)
     
    Aykutkaraca likes this.
  9. Aykutkaraca

    Aykutkaraca

    Joined:
    Jan 4, 2018
    Posts:
    33
    Teşekkürler! Thank you.
     
  10. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    @HerrVR is this still being worked at? I ask because I've seen Nvidia integrations come and go, would love to know about the state of this one :)
     
    Roni92pl likes this.
  11. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Additionally, if this is not going further officially, any chance we could get current versions source code access with some usable license so we could use and extend this ourselves?
     
    LooperVFX likes this.
  12. segant

    segant

    Joined:
    May 3, 2017
    Posts:
    196
    I think he gave up on this.
     
  13. yant

    yant

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    594
    I'm of course not the original author here, but wanted to chime in and mention that in my mind it's going to be quite challenging to compete with the builtin-in PhysX integration in terms of platforms coverage, usability and performance.
     
    hippocoder likes this.
  14. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Main reason for me to ask about this is because there are two things built-in physx doesn't expose:
    - physx contact modifications (I'd be fine even if I had only native code access to this, don't necessarily need a full c# wrapper)
    - physx immediate mode
     
  15. yant

    yant

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    594
    Don't tell anyone but contact modifications experimental branch is coming for feedback on the forum, this summer. I had something working late April, will share later. As to immediate mode, it's a bit more tricky as it stands right now.
     
  16. breeannazirkle

    breeannazirkle

    Joined:
    Mar 6, 2020
    Posts:
    2
    @HerrVR The PhysX plugin can handle a maximum of 20,000 game objects. Is there a chance to increase that?
     
  17. flyer19

    flyer19

    Joined:
    Aug 26, 2016
    Posts:
    116
    wheelCollider can use ecs or gpu to parrallel calculate ?
     
  18. MatheusMarkies

    MatheusMarkies

    Joined:
    Apr 16, 2017
    Posts:
    67
    Any stable versions to be used in projects? I need a license from Nvidia for commercial products right?
     
  19. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    933
    Is this plugin still up to date? :)
     
  20. AShim-3D

    AShim-3D

    Joined:
    Jul 13, 2012
    Posts:
    34
  21. Deznom

    Deznom

    Joined:
    Oct 7, 2015
    Posts:
    15
  22. JosephHK

    JosephHK

    Joined:
    Jan 28, 2015
    Posts:
    40
    Hello, @Deznom. Is there any plan for this plugin to support IL2CPP?
     
  23. Deznom

    Deznom

    Joined:
    Oct 7, 2015
    Posts:
    15
    Hi! Unfortunately, I'm not familiar with SWIG enough to say if it is possible to do this in case of this plugin at all. I'll open an issue on GitHub so I don't forget about this feature request.
     
  24. waltran

    waltran

    Joined:
    Feb 23, 2017
    Posts:
    36
  25. Deznom

    Deznom

    Joined:
    Oct 7, 2015
    Posts:
    15
    As far as I know Unity doesn't allow to modify physics scene flags, but with this plugin you can enable this flag through scripting.
    The code should look like this:
    Code (CSharp):
    1. sceneDesc.flags |= PxSceneFlag.ENABLE_FRICTION_EVERY_ITERATION;
     
    waltran and goncalo-vasconcelos like this.
  26. wsinw

    wsinw

    Joined:
    Apr 23, 2017
    Posts:
    14
    Hi folks. I've successfully modified the project to build on macOS, mostly by removing references to CUDA.



    Here's my fork https://github.com/prnthp/UnityPhysXPlugin

    I've uploaded the binaries too. Hope this helps!
     
    Deznom, Ruchir and mgear like this.
  27. wsinw

    wsinw

    Joined:
    Apr 23, 2017
    Posts:
    14
    For my next trick. Android and IL2CPP support!

    Here's an arm64-v8a (which requires IL2CPP) build running on the Oculus Quest 2. Callbacks seem to be working as expected.


    I had to use a custom fork of SWIG and a mix-n-match of the old and new C# wrappers.
    Here's the branch for Android: https://github.com/prnthp/UnityPhysXPlugin/tree/android
    (and some minor fixes for PhysX 4.1 that was needed for building with the latest NDK: https://github.com/prnthp/PhysX)

    macOS and Windows IL2CPP binaries + wrappers (I have not tested these!) can be found here: https://github.com/prnthp/UnityPhysXPlugin/tree/macos-il2cpp or here: https://github.com/prnthp/UnityPhysXPlugin/releases/tag/v0.1-il2cpp
     
    Last edited: Aug 8, 2021
    JosephHK, waltran, Deznom and 2 others like this.
  28. Deznom

    Deznom

    Joined:
    Oct 7, 2015
    Posts:
    15
    Wow! Great job, @wsinw ! I will definitely test all this in the coming week.

    Also I think we should ping @JosephHK , that IL2CPP support is now available :)
     
    JosephHK and wsinw like this.
  29. slimechips

    slimechips

    Joined:
    Oct 18, 2018
    Posts:
    2
    Hi, has anyone managed to build the iOS version of this project? I have tried to adapt @wsinw forks to build the iOS version, but haven't found much luck trying to build the static version of this project. Any help or insights would be appreciated!
     
  30. wsinw

    wsinw

    Joined:
    Apr 23, 2017
    Posts:
    14
    I'm not familiar with iOS development, but are you starting with the android forks (both PhysX 4.1 and the plugin)? You might have better luck swapping out the android toolchain for iOS ones since they are both ARM based.
     
  31. slimechips

    slimechips

    Joined:
    Oct 18, 2018
    Posts:
    2
    Yep I tried your forks and replaced my toolchain with an iOS toolchain, however the complication arises as the generated binary needs to be a static library (.a) for iOS (all other platforms use a dynamic library like .dll or .dylib). In the CMakeLists.txt in the Nvidia.Native.Physx folder, I tried changing the parameter in the swig_add_library command from SHARED to STATIC, but this generates an XCode project that does not seem to have proper linkage to the original PhysX SDK's generated static libraries (though it will still generate a static binary that doesn't really work).

    I have tried manually adding the link flags in the project, but they seem to have no effect. Adding librarian flags to all the intermediate object files in the original PhysX SDK originally seems to link and increase the static binary size, but the binary still doesn't work. More specifically when I include it into my Unity Project's iOS build, the plugin throws an error claiming there is a version mismatch (version built is 4.1.1 instead of 4.1.2), but when I checked the header source files of the original PhysxSDK (PxPhysicsVersion.h), the headers state version 4.1.2, which confuses me. Changing the C++ source code or header files and rebuilding seem to have no impact, which confuses me even more, given that the errors messages were thrown from the C++ source files. Even if I tried changing the target version on the C# files from 4.1.2 to 4.1.1, there are more errors (specifically claiming PxFoundation object already exists when trying to create one).

    I will continue trying to debug the issues and share if I manage to build the iOS version. In the meantime I would appreciate if anyone could provide any possible insights into the aforementioned issues!
     
    wsinw likes this.
  32. unity_44234FBC39E5661FBF5B

    unity_44234FBC39E5661FBF5B

    Joined:
    May 11, 2021
    Posts:
    29
    Just wondering. Does it include PxVehicleSuspensionSweeps?