Search Unity

Who do I reach out to about investigating and improving upon Unity's math package?

Discussion in 'General Discussion' started by SoundStormLabs, Jan 23, 2024.

  1. SoundStormLabs


    May 6, 2017
    Just what the title says, my project involves inverting large matrices every frame. Id like to develop a better method of matrix inversion, if it's not already implemented.

    But, how/who do I contact to find out specifically how Unity inverts matrices?
  2. Meltdown


    Oct 13, 2010
    Unity is not open source so your best bet to improve it would to become a Unity employee.
  3. Ryiah


    Oct 11, 2012
    Unity's built-in libraries like Mathf are only somewhat available for public viewing but viewing is all you're allowed to do with them without an enterprise source license so they're only practical for understanding the internals at a very basic level.

    Unity's packages on the other hand are available in their entirety on GitHub, and I think they allow push requests but you're only able to contribute under the Unity Contribution Agreement. You'll want to read through the entire license.
    Last edited: Jan 23, 2024
  4. Spy-Master


    Aug 4, 2022
    A few points of caution about Unity.Mathematics specifically:
    • A lot of it is meant to be optimal with Burst, so it would be good if optimization came from the assembly code level
    • The types in that library are restricted to common fixed sizes (basically up to 4x4 matrices), it seems like writing a layer on top of the math methods with your own independent data structure is the way to go, which then means you’re looking at optimization of the math methods individually or your use of them, which may or may not have overlap with optimal matrix operations on their known set of types
    • That repository states user PRs aren’t accepted, so take that for what it is
    Some packages like entities aren’t hosted by UT proper, but are at least available in unofficial mirror repositories by needle-mirror. Then there’s Burst which is mainly a bunch of binaries and isn’t currently hosted and maintained on github to my knowledge.
    Last edited: Jan 23, 2024
    MadeFromPolygons and Ryiah like this.
  5. Antypodish


    Apr 29, 2014
    If Unity math lib with burst is not sufficient and can not find proper repos with libs, which I suspect does somewhere exists, I suggest you develop own solution.

    You could easily build math lib of your own, tailored for what you need and making it compatible with burst.
    In the end, these are just typically multiplication and additions.

    Don't bother asking Unity, if you consider moving with project in upcoming months. Safest to assume is, your request never will be fulfilled by Unity. That way you avoid unnecessary waiting, and wasting time, on something which may or may never happen.
    Last edited: Jan 24, 2024
    manutoo and Ryiah like this.
  6. MadeFromPolygons


    Oct 5, 2013
    If its specifically matrix inversion you want to handle, and you have an algorithm ready to go - its very trivial to wrap that up as its own library. That would be my suggestion rather than trying to deal with unity which will likely take a long time, may not actually take your feedback / do anything with it, and leave you wanting to pull your hair out.

    Individually the employees are great and want to help, but the organisation as a whole moves at a snails pace and processes like taking feedback and implementing it take a long time and go through many peoples hands before its actually actioned, by which time you will have grown old and retired :p
    Last edited: Jan 29, 2024
  7. angrypenguin


    Dec 29, 2011
    Unless Unity happens to do exactly what you need already, I'd ignore what they're doing and write my own C# solution and see if it meets my needs. Having the solution built into Unity does not magically or automatically make it faster.

    If it's in the C# portion of the engine then anything they can do, you can do, so you don't need them to do it.

    If it's in the C++ portion of the engine then marshalling to and from could easily eat any algorithmic efficiencies you introduce, even if you could get over the various hurdles to somehow get it included (which is pretty unlikely unless it addresses a common use case). I certainly wouldn't assume that something being native in Unity makes it faster. Also, you can write your own C++ plugin without it being built into Unity.

    Just how large, and how many each frame?
    neginfinity, Ryiah and spiney199 like this.
  8. neginfinity


    Jan 27, 2013
    One minor detail.

    Extension methods exist and are useful for those sorts of situations.
    MadeFromPolygons and ippdev like this.