Simul Support ExchangeCategory: CloudsCompatibility With World Origin Rebasing (Unreal Engine)
floatingskyzone asked 4 years ago

My game is being developed in Unreal Engine, and I am using world origin rebasing in my game so as to allow players to explore a very large world (including flying many kilometers above the clouds). (World Origin Rebasing: When a player travels a certain distance from 0,0,0 (the world origin), the world origin is reset to the player’s current position. This eliminates floating point precision errors on things like animations that occur at great distances from 0,0,0).
 
Once a player travels a great distance (say 10+ km) from the original world origin, TrueSKY begins to glitch, such as the clouds flickering intermittently, and the rotating sky box skipping forwards and backwards rapidly.

I’m guessing this is probably due to floating point precision errors, as once the world origin has been rebased that far from its original position, the TrueSKY actor’s position ends up being a very far distance from 0,0,0.
 
Is there a way to make TrueSKY work with world origin rebasing in Unreal Engine when using very large worlds (such as Unreal Engine’s default max of 20km x 20km x 20km)?

1 Answers
Chris_Simul Staff answered 4 years ago

Hi floaitngskyzone – I believe that if you set the integration scheme from grid over to fixed this may fix your issue.
This will change generation of the grid away from using a grid which the player moves around underneath a grid that is locked in a position (which is what grid integration is) to using a fixed version, which keeps the grid centralised over the players position. (I mention this briefly at the 3 minute mark if you want an alternate explanation – which can be found here )

A potential other solution would be to increase your “high detail proportion” setting within the interpolation settings of the sequence actors (when using the grid integration), which will make all of the sky render at the highest mip (which is normally only above the actor) as mentioned before. This may be part of some of the trueSKY glitches, as it sounds like you may be travelling far enough away from the origin to be in lower mip map areas.

I dont have a scene set up to test that this will work without issue, this is more of a suggestion in theory. So let me know if it resolves the issues, and if not I will try to set up a scene and give it some further testing to help find a solution

Chris

floatingskyzone replied 4 years ago

Hi Chris,

I’ve tried both of your suggestions, and unfortunately it did not solve the problem.

I actually just did some experiments with turning world origin rebasing off, and traveling to the edge of the world (~20km x, y, z) and there was no glitching present in TrueSKY. I also tried moving TrueSKY far from the world origin to begin with (20 km down in the z axis) and there was no glitching present, so it doesn’t seem to be caused by the TrueSKY sequence actor being a great distance from 0,0,0.

Once world origin rebasing was turned back on, the glitching returned (such as when teleporting a character from the original 0,0,0 origin 10km upwards). The clouds seemed to flicker between their actual position, and a different (incorrect) position very rapidly. If you need a video of this phenomenon I could record one.

I’m fairly certain it has something to do with the world origin being changed. Does TrueSKY’s code ever get the current camera’s position to do any calculations? It’s possible that somewhere in the TrueSKY code some vectors need to be wrapped with the following in order to make it play nice with world origin rebasing:

UGameplayStatics::RebaseZeroOriginOntoLocal(GetWorld(), vector)
UGameplayStatics::RebaseLocalOriginOntoZero(GetWorld(), vector)

Hopefully it’s something simpler, but this is my best guess.

I could create a simple project for reproducing this if you like, just let me know how to send it to you.

Chris_Simul Staff replied 4 years ago

Ahh – that is strange – A video is a good idea. I am not sure on trueSKY’s code grabbing cameras position, but i am going to assume it does for things such as depth calculations at the very least. I’ll get an internal ticket written up and see if there is anything that others could outline as a potential cause.

If after looking at the video we cant find a source of the issue could I get you to send a email to contact@simul.co – and maybe just link to this Q+A question, and I will get it from there, and we will figure out the best way for sending over a simple project for us to carry testing out on.

Chris

floatingskyzone replied 4 years ago

Sounds good.

I have recreated the bug in a blank project with a level that contains only a spectator pawn and a TrueSKY sequence actor. The cloud glitching only occurs after the world origin has been shifted client-side.

Here is a video: https://imgur.com/a/twaYSdV

The spectator is being teleported between three locations: (0, 0, 0), (0, 0, 10km), (18km, 0, 18km)

The glitching disappears at (0, 0, 0), when the world origin is reset to the default location, and is apparent at the other locations.