Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Let us know your feedback about the Global Illumination changes in the 2023.2 beta.
    Dismiss Notice
  3. Dismiss Notice

Question PhysX Visual Debugger on latest 2021.2 alpha

Discussion in 'Physics Previews' started by rz_0lento, Apr 22, 2021.

  1. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    I noticed this on 2021.2.0a14 release notes:
    I'm curious how do we trigger the PVD connection now from Unity's side and is there specific PVD version we should use for this? I tried this with PVD 3.2021 but I couldn't see any obvious way to connect it to Unity editor.

    @yant any chance you could give some more info on this?
     
  2. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,500
    I was surfing the internet, do not know if it related but found this:

    https://subscription.packtpub.com/b...h10lvl1sec52/physx-visual-debugger-pvd-basics
     
  3. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    @AlanMattano oh I know how to use PVD, I've used it with Unreal and Cryengine in past. But to interface with PVD you have to enable the connection via code and you often need to hook in specific PVD version for it to work well (altho we know Unity has PhysX 4.1 so PVD compatible with it should do). Even if you have supported PVD version, there can be oddities on certain versions and it may be preferred to use some earlier version that works nicer on your combo.

    What I'm asking here now is more like, how to actually connect the PVD from Unity side and what is the recommended PVD version that is known to work with it. Since Unity is handling the PVD connection already, we need to trigger that somehow (or if it's done automatically, would love to know further details on it).
     
    Ruchir likes this.
  4. yant

    yant

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    576
    Hey, I think this was intended to be an internal release note, got to check how it made it to the public ones. PVD requires a specific build of PhysX, and as such is only available with Unity source really. Thanks for bringing this up.
     
  5. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Oh, and I just got my hopes up :/ PVD is priceless for debugging weird physics glitches. You can't playback the whole physics scene with built-in physics debugger frame by frame later..

    Is there some good reason why PVD access isn't even allowed for us developers? I mean you already run special build of PhysX anyway with Unity. If the binary size is a concern, it could even be development build + editor only thing. Other mentioned engines let us hook PVD via simple command.
     
  6. yant

    yant

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    576
    I think this is a historical issue that arises from the fact that for whatever reason PhysX is linked statically on all platforms in Unity. So, in order to have PVD connect to Unity Editor it would mean that we'd have to ship at least two Editor binaries.

    Speaking of capturing, we've actually just increased our physics team now and hope to be able to offer the capture option in the built-in debugger window in fact, a bit later.
     
    Ruchir and rz_0lento like this.
  7. yant

    yant

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    576
    Would also add that PVD itself really needs some love too. Usability could be improved, as well as stability for sure. On top of that, the latest Mac version from the NVidia website doesn't even support PhysX 4 for instance, I have to build it from source locally.
     
    Ruchir likes this.
  8. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Why would you need two? I mean, in editor the extra physx library for PVD isn't that big that it would cause issues for people. Normally you'd just have it included and only use it once user demands it, making it invisible for people who don't need it. Extra size caused by PVD lib is negilible for anything but mobile players.

    I know PVD can sometimes be crash happy (and resource hungry) but when setup properly, it's super handy. I can imagine Mac support being pain, I've only ever used it on Windows. I don't know how Unity has implemented PVD connection but for example in CryPhysX they even synced main camera to it, so when you play back the physics on PVD, it can even follow your game view there.

    I can code all similar functionality in Unity myself but it just takes a long time and feels frankly silly when there's already tool out there that does all this :)
     
    Last edited: Apr 26, 2021
  9. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    I'd love to see this one happen :)
     
  10. yant

    yant

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    576
    That's not just an extra lib, is it? It's another compile-time configuration for PhysX to support PVD (at least Profile). It performs differently from the Release configuration that we use now to start with, and there are extra problems where the PVD code causes issues including extra crashes when it doesn't quite like the sequence things may happen in our integration code. It would have been great if the pvd doodle was enabled by a runtime flag, but in fact actually plenty of code gets ifdef'ed out.
     
  11. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Ah yes, I completely forgot about that, it's not there if you use release build:
    "PVD integration is enabled in the debug, checked and profiling configurations of the SDK", basically on every other option but release conf.