x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Double precision support in UE4

Does UE4 support double precision calculations? I'm currently evaluating potential graphics engines to use in a fully realistic solar system and space flight visualization/simulation program, and one of the necessary features for our project is full double precision support so that we can keep our calculations precise even at very large distances. Is this something that UE4 supports or that could be implemented without too much difficulty? Also, I've read about world size limits in UE3. Are there still limits on world size in UE4? Thanks!

Product Version: Not Selected
Tags:
more ▼

asked Jun 13 '14 at 03:38 PM in Using UE4

avatar image

trevorr
6 1 2 3

avatar image TJ V ♦♦ STAFF Jun 13 '14 at 04:07 PM

Hi trevorr,

Currently there is an issue with some of the variables in UE4 not being set to an exact number. For instance, certain values you may enter, lets say 50, may actually be set to something like 49.9998. This isn't happening in the background though, it will change the 50 you entered to 49.9998. Our developers are looking into this and we hope to have a solution soon.

As for the UE3 world size limitations, this isn't an issue with UE4. The world size is only limited to what your hardware can handle.

Below is a link to a forum post that may help with your double precision question. I'm not to familiar with subject, so if I am misunderstand exactly what you are asking about please let me know and I'll rope someone else in who may know more. https://forums.unrealengine.com/showthread.php?111-64-bit-Physics

I hope it helps.

Thanks, TJ

avatar image trevorr Jun 13 '14 at 05:47 PM

To be more specific, are things like object coordinates in UE4 stored as single-precision floats or doubles? And do the underlying math libraries maintain double precision or are calculations reduced to single-precision floats to increase speed?

avatar image trevorr Jun 16 '14 at 12:10 PM

Any more specific details on this?

avatar image Drayan Jun 16 '14 at 12:40 PM

I'm not from the staff, but as far as I can know (correct me if i'm wrong), object coordinate are stored in a FVector, which encode coordinates in float.

Maybe there is a way to pass to double precision, like with Ogre, but if it exist, I don't know where.

Now with your game, why doesn't you use a relative coordinate system ? You don't really need precise PhysX interaction for object that will only take on pixel on the screen (far away stars). Then you could just simulate the physics of far away objects with a simplified math, that could be a little more inaccurate.

And only do accurate computation for near object (thus with single precision).

avatar image FrederickD Feb 24 '16 at 02:08 PM

Quote: "Currently there is an issue with some of the variables in UE4 not being set to an exact number. For instance, certain values you may enter, lets say 50, may actually be set to something like 49.9998. This isn't happening in the background though, it will change the 50 you entered to 49.9998. Our developers are looking into this and we hope to have a solution soon."

This is not resolved yet in 4.11 ... Is this still being looked into ? It is really irritating to have round values messed up like that

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Enabling double's everywhere would be an extremely difficult task. Additionally GPUs don't have universal support for them, so even if all your CPU work was in doubles, at some point everything would need to return to floats to head to the GPU.

Your best bet is to do the high precision simulation in your own code in doubles (or larger) representations. Then treat each loaded region of space as a zone where the float is still a passable representation of distance. In those regions you'd divide out the cell coordinate from the high precision double calculations to transform it into the space of some particular region. It's essentially the same concept as a spatial hash.

So if my zones are lets say 100000 units across, and the actual user location is 362000.4323452343 (along one axis), I would % modulo by the cell size and be left with 62000.4323452343, and you'd do that for each axis for a players position to arrive at their local space location.

Streamable levels would most likely correspond to your zone size.

more ▼

answered Jun 16 '14 at 01:00 PM

avatar image

Nick Darnell ♦♦ STAFF
6k 77 36 148

avatar image Drayan Jun 16 '14 at 01:02 PM

Well, that's what I mean, but much more well explained ^^'.

avatar image Commander Shepard Oct 17 '16 at 01:00 PM

what happens when you are halfway in one of two cells or even collisding at the border? it would make the programmer's life miserable

avatar image Curator23 Oct 22 '16 at 11:32 AM

I would translate your double precision vectors to place camera at 0,0,0 before casting to single precision for rendering. Anything close will have plenty of precision. Anything far away enough to loose precision (and large enough to see) will be too far away to notice the error. Anything far enough away to exceed FLOAT_MAX can be scaled in by a factor derived from it's double precision position and clamped to a sphere of radius FLOAT_MAX.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question