Search Unity

Has Unity Considered a 64 bit floating point upgrade?

Discussion in 'General Discussion' started by Arowx, Feb 2, 2016.

?

Would you like Unity to develope a 64 bit large world API?

  1. No way, 10km 32 bit is big enough for me think of the artwork dude?

    24 vote(s)
    13.4%
  2. Yes please, I want to use procedural techniques to build worlds, planets and entire solar systems?

    130 vote(s)
    72.6%
  3. What just 64 bit hell no think exponential we need 128bit or 256bit, you luddite!

    25 vote(s)
    14.0%
Thread Status:
Not open for further replies.
  1. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,203
    Except that they're already making their move to supporting 64-bit. :p
     
  2. Teravisor

    Teravisor

    Joined:
    Dec 29, 2014
    Posts:
    654
    In fact, I know quite a few good games of times when 3D video chips only started appearing that had never seen popularity just because most hardware didn't support it at that time and manufacturer's driver support was hayware. Are you sure it won't be same with engines?
     
  3. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    I mean unity specific.

    method 1:

    -iterate over all objects
    -set their parent to the player
    -move player to origin
    -iterate over all objects
    -unparent them from player

    method 2:

    -iterate over all objects
    -calculate their position relative to the player
    -move the player to origin
    -iterate over all objects
    -move all objects to the player's position + their relative offset

    How minor is the performance difference between these two "origin shift" approaches?
     
  4. ErisCaffee

    ErisCaffee

    Joined:
    Nov 26, 2014
    Posts:
    127
    Pardon me but I'm new to game development. What is "origin shifting"? Am I correct in assuming that means recalculating the position of every active object in a new reference frame?
     
  5. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,203
    Once you go a reasonable distance away from origin some aspects of the engine start to encounter problems due to the limited precision of floating point numbers. Origin shifting (aka floating origin) basically shifts the world back to origin again centered around the player.

    There is an example script for it on the Unify Wiki.

    http://wiki.unity3d.com/index.php?title=Floating_Origin
     
    Last edited: Feb 6, 2016
  6. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,573
    Either no difference or setting parent will be slower, because in both cases you'll need to iterate through every object, but having a parent means one more object.

    However, setting origin to player position is likely to be a bad idea, because you'll need to maintain some sort of structure to optimize collision queries. And in that case it will be better to have origin that doesn't move.

    Also, IIRC unity encounters problems when physics-controller object is parented to something that can move.
     
  7. Wrymnn

    Wrymnn

    Joined:
    Sep 24, 2014
    Posts:
    384
    Several years I have been using Unity, I can think of at least two projects 32-bit world was a problem...

    So yes, I do support it, will cast my Vote.
     
  8. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Not just for Unity, also for us. There would likely be a lot of people who want to scale their world. But there is no easy switch from 32 bit to 64 bit numbers that doesn't cause a major headache. The possibility to switch between those two is far more complicated in my opinion than a radical cut to only support 64 bit numbers.
     
    Deleted User likes this.
  9. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    Darn, alright

    Well literally everything is moving, so how could the player collide with anything else?
     
  10. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,573
    That's not it. All rigid bodies stored in 3d space will be stored in some sort of optimized structure that allows you to QUICKLY find out if there's something in this or that axis-aligned box without iterating through every body in the system. Also, bodies that do not move, freeze and are no longer processed.

    So, the moment, someone get the idea of moving EVERYTHING in naive fashion, the collision query optimization structure most likely will need massive update, and every rigidbody might unfreeze.

    I think I mentioned that about 5 times in this thread already?

    It depends on physics engine internals, though. Sweep-and-prune would handle massive move fairly well, unless you also decide to ROTATE everything (which is a bad idea. DON'T rotate the world around origin). In case of something else you may get more expensive operation. Basically, you'll want physic system to support moveable origin. Otherwise there may be a lot of workarounds.
     
    Last edited: Feb 6, 2016
  11. Teravisor

    Teravisor

    Joined:
    Dec 29, 2014
    Posts:
    654
    You sure did. Next time you can also mention it's called spatial partitioning or space partitioning. I couldn't find any docs on what methods PhysX uses for that though. Maybe octree?
     
    neginfinity likes this.
  12. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,203
  13. Teravisor

    Teravisor

    Joined:
    Dec 29, 2014
    Posts:
    654
    Um... Nope. That's regions you can manually add/remove. A tool for manual optimizations I'd say. What we, are talking about is how they are made internally. Imagine those regions having 1000 objects each. Will you check each of them against each? Of course that would give you no performance. Also note phrase "The maximum number of regions is currently limited to 256.".
     
  14. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,573
    Bah. I sorta forgot the proper term, probably because sweep and prune doesn't actually partition anything and just maintains sorted lists instead.
     
  15. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,203
    @Teravisor: I'm aware of what you're describing. I just don't keep up to date on the terms. Only one I recognize is oct-tree.
     
  16. darkhog

    darkhog

    Joined:
    Dec 4, 2012
    Posts:
    2,218
    Mostly, yes.
     
  17. darkhog

    darkhog

    Joined:
    Dec 4, 2012
    Posts:
    2,218
    Well, IMO it is best to shift origin whenever user is interacting with the UI, be it pause menu or something different, like inventory screen. I mean, in any reasonably-sized game that would require this and is not a techdemo, player is bound to use UI sooner or later, so I'd do it this way:

    - When user press whatever key is bound to GUI screen (say, map or inventory), shift origin
    - Open menu in question afterwards

    From player's point of view this would be just a slight lag while opening the menu that most likely he won't notice. And in most games, baring outliers like KSP, player will open menu or other GUI well before he'll reach 10km mark (or 5k mark, when starting position is at the center).
     
  18. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    Quick question is a FLOP for single or double precision floating point. It is used a lot to refer to the maths power of CPU's, GPU's and even super computer clusters.

    But I presume we have had 16, 32, 64 and even 128 bit precision floating point operations as technology has progressed.

    So which do we use when we measure a systems FLOP's?
     
  19. Teravisor

    Teravisor

    Joined:
    Dec 29, 2014
    Posts:
    654
    FLOP = floating operation. FLOPS = floating operations per second. Usually, it's float(32 bit) but it can depend on what's measured, what's in head of the one who wrote, etc. In the beginning everyone measured floating(16 bit) point operations per second. Now it's not in fashion. And it depends on architecture: in some it's same as using doubles, in others it's not. Most processor developers like to measure it how it's benefical for them(all want to write more flops than they have in reality) so it doesn't mean a thing usually as it's in perfect conditions (like no if statements, preemptive preprocessor always working, etc).
     
    Last edited: Feb 7, 2016
  20. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
  21. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    Couldn't you just make the rigidbody kinematic or disable it?

    Of course I'm interested, I just don't have the time with work :p
     
  22. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    660
    Large world coordinates (double precision) is now enabled by default in Unreal Engine. Details here: Large World Coordinates in Unreal Engine 5 | Unreal Engine 5.0 Documentation.

    On the CPU position is represented as a vector of native 64-bit floats. On the GPU, they are passing position as two 32-bit Vector3 values. The first is a position within a grid, and the second for a position within the grid.
     
    Deleted User likes this.
  23. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,780
    Why you necroing, offtopic and hijack +6 years old post, just to write about Unreal?
     
  24. bonickhausen

    bonickhausen

    Joined:
    Jan 20, 2014
    Posts:
    115
    It's important to talk about the competition. Unity is clearly not invested in improving things for game developers so SOMEONE has to do it.

    But hey, don't worry! We're gonna get yet another cinematic video in a few months! Hooray!
     
  25. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    660
    Agreed. I think it's easy to say large coordinate support isn't needed today but looking at the kinds of experiences developers want to create now and in the future (contiguous large worlds, sprawling metaverse), it is definitely going to become an integral feature. In other words, it's not a matter of if, but when. We can debate how far into the future that day comes.

    Had other engines not lead by example and shown what is possible, it is highly likely naysayers would still be insisting it isn't possible.
     
  26. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,160
    Except this thread is about 64 bit support, not 32 bit x2 support, it's about Unity, not Unreal, and it's nearly seven years old, and the person who necroed it made their own thread.

    This is a pointless, off-topic necro.
     
    MadeFromPolygons likes this.
  27. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    660
    The thread is clearly about double precision coordinates. Please stop.
     
  28. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,160
    It literally never was.
     
  29. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,052
    Pointless necro, off-topic. Please check dates before responding.
     
    Antypodish likes this.
Thread Status:
Not open for further replies.