Jump to content

Entire Terrain Just Disappears When I Move Big Distances


namusanga
Go to solution Solved by Peter,

Recommended Posts

I have set the terrain loader onto a camera that follow the player and/or any vehicle he is using around, I've also added a floating point fix component to the camera. However, when I move big distances away from the starting position of the player, the whole world disappears, what could the possible cause for this be? 🤔  Here's a video of what's happening.

 

Link to comment
Share on other sites

Hi, how exactly did you add the floating point fix to the scene? It sounds like you put the floating point fix component on the camera yourself - this is something you can do, but you would then also need to manually put a floating point fix member component to each terrain (and anything else you want to be shifted around as well.) 
What the floating point fix does is: As soon as the camera / player moves away too far from the world origin, it shifts the player/camera around to be re-centered at 0,0,0 again. It also does this for all game objects in the scene that have a "Floating Point Fix Member" component on them - in this way, the player normally can't tell that this shift is happening. I think what might be your issue is that you have only the floating point fix component on the camera, but the terrains do not have the floating point fix member components on them. This then leads to only the player / camera shifting away, but the terrain still stays in the old spot.
You could try to confirm this by removing the floating point fix component from the camera to test if this issue does not happen then anymore. If that turns out to be true, you could activate the floating point fix from the terrain loader manager instead:

image.png

This will automatically set it up for your camera but will also offer you to put the floating point fix member components on each terrain in the scene - in this way floating point fix should be working & the issue should also not appear anymore.

Link to comment
Share on other sites

I disabled the floating point fix and it fixes the issue, so with out floating point fix it works fine but when I switch back on it adds the floating point terrain member component to all terrains but the error still ends up occurring when I run the test, at some distance all terrains just disappear. I'm considering just switching off the floating point fix completely, will that have any bad side effects to my game in the short or long run. 

Link to comment
Share on other sites

Hmm... I've tried what you said @Peter and now it keeps giving me the error that it's looking for Floating Point Fix on the main camera, can I just disable floating point fix functionality all together?

 

Link to comment
Share on other sites

Yes, you can switch it off for now, if you did not run into any issues with floating point precision yet, it probably causes more pain / trouble for you to have it active than it brings benefit at the moment. The reason it exists is because the further you get away from the origin in unity, the less precise calculations for shadows, physics, etc. become - it can happen at larger distances that you see things like shadows or animations flickering, or physics acting weird, shaking objects etc.
The floating point fix is a common workaround for that that works by shifting everything in the world including the camera back to the origin - the player does not notice this usually, but it prevents the distances from becoming too large.
I would run it without to see if you encounter any of those issues, if you do, you could still consider activating it and then we need to analyze deeper what is going on in your scene.

Link to comment
Share on other sites

19 hours ago, Peter said:

Yes, you can switch it off for now, if you did not run into any issues with floating point precision yet, it probably causes more pain / trouble for you to have it active than it brings benefit at the moment. The reason it exists is because the further you get away from the origin in unity, the less precise calculations for shadows, physics, etc. become - it can happen at larger distances that you see things like shadows or animations flickering, or physics acting weird, shaking objects etc.
The floating point fix is a common workaround for that that works by shifting everything in the world including the camera back to the origin - the player does not notice this usually, but it prevents the distances from becoming too large.
I would run it without to see if you encounter any of those issues, if you do, you could still consider activating it and then we need to analyze deeper what is going on in your scene.

Alright, I've decided to deactivate the floating point fix I did this using the terrain loader manager, and it went through all my terrains and removed the floating pint fix member from all of them, however whenever a new terrain loads as I'm playing my game I get this error (I've put the exact contents of the error below"image.thumb.png.cb6f06f65c22448d97abbc5dda956f8c.png

This is what the error reads
NullReferenceException: Object reference not set to an instance of an object
Gaia.TerrainScene.SceneLoadCompletedHandling () (at Assets/Procedural Worlds/Gaia/Scripts/MultiTerrainSystem/TerrainScene.cs:800)
Gaia.TerrainScene.SceneLoadCompletedRegular (UnityEngine.AsyncOperation obj) (at Assets/Procedural Worlds/Gaia/Scripts/MultiTerrainSystem/TerrainScene.cs:774)
UnityEngine.AsyncOperation.InvokeCompletionEvent () (at <88f69663e9a64d00b2091dd8dfd4d38f>:0)

Is there something I might have forgot to disable?

Edited by namusanga
Link to comment
Share on other sites

@Peter I just noticed canopy probably doesn't update people when a update to a topic is made unless they follow the topic, like yesterday when I had to post a request in Discord for my question response which had been up for 2 days to be seen, so I'm just posting this message to tag you Peter so that you actually end up seeing my response to the question, sorry about the inconvenience, but I don't think you would the see the response otherwise.

Link to comment
Share on other sites

@namusanga Hi, I had an issue which makes terrains dissepears. There was 2 main cameras in my hierarchy (one was inactive) and deleting the inactive main camera solved the situation. Maybe your problem is from the same reason.

Link to comment
Share on other sites

  • Solution

@namusanga It looks like there are two error messages alternating, it looks to me like when loading the scenes it still tries to do something related to the floating point fix, even though you switched it off.....could you please check the following:

In the terrain loader manager, double click on the Terrain Scene Storage:

image.png


Inside the terrain scene storage file, can you please check if the checkbox for floating point fix is disabled there as well? (Normally it should do this when switching it off in the UI of the terrain loader manager, but the error messages you were seeing indicate otherwise). There is also one per terrain scene entry, but that should be reset with what is set up with the "main" checkbox (the one circled in my screenshot) during runtime.

image.png

Feel free to tag me whenever you reply, I do see replies in the activity stream as well, but the extra notification does not hurt.
 

Link to comment
Share on other sites

20 hours ago, Peter said:

@namusanga It looks like there are two error messages alternating, it looks to me like when loading the scenes it still tries to do something related to the floating point fix, even though you switched it off.....could you please check the following:

In the terrain loader manager, double click on the Terrain Scene Storage:

image.png


Inside the terrain scene storage file, can you please check if the checkbox for floating point fix is disabled there as well? (Normally it should do this when switching it off in the UI of the terrain loader manager, but the error messages you were seeing indicate otherwise). There is also one per terrain scene entry, but that should be reset with what is set up with the "main" checkbox (the one circled in my screenshot) during runtime.

image.png

Feel free to tag me whenever you reply, I do see replies in the activity stream as well, but the extra notification does not hurt.
 

Thanks, yeah, I disabled it from the storage asset and that got rid of the error

Link to comment
Share on other sites

  • 1 month later...
On 12/28/2021 at 5:00 PM, Peter said:

Hi, how exactly did you add the floating point fix to the scene? It sounds like you put the floating point fix component on the camera yourself - this is something you can do, but you would then also need to manually put a floating point fix member component to each terrain (and anything else you want to be shifted around as well.) 
What the floating point fix does is: As soon as the camera / player moves away too far from the world origin, it shifts the player/camera around to be re-centered at 0,0,0 again. It also does this for all game objects in the scene that have a "Floating Point Fix Member" component on them - in this way, the player normally can't tell that this shift is happening. I think what might be your issue is that you have only the floating point fix component on the camera, but the terrains do not have the floating point fix member components on them. This then leads to only the player / camera shifting away, but the terrain still stays in the old spot.
You could try to confirm this by removing the floating point fix component from the camera to test if this issue does not happen then anymore. If that turns out to be true, you could activate the floating point fix from the terrain loader manager instead:

image.png

This will automatically set it up for your camera but will also offer you to put the floating point fix member components on each terrain in the scene - in this way floating point fix should be working & the issue should also not appear anymore.

Is this right the way I made it ? -the player itself has the floating point fix component, the camera have the floating point fix member component ? And a car you can drive have the floating point fix member component? And all my terrains have it enabled in the checkbox ? 

 

The question

Weapon pickups and ammo pickups seems they need the floating point fix member or they fall thrue the ground ?- Is that right ? 

Anything I put in my scene also need the member component? 

AI I spawn ? 

Reason I ask this is because everything I put in the scene is gone at runtime and appears to work after floating point fix member component is added 🤷🏼‍♂️

 

And what is the largest number Unity can handle without floating point fix? My terrain is only 4km x 4km ...

 

 

 

Link to comment
Share on other sites

On 2/20/2022 at 5:31 AM, Mattis89 said:

Is this right the way I made it ? -the player itself has the floating point fix component, the camera have the floating point fix member component ? And a car you can drive have the floating point fix member component? And all my terrains have it enabled in the checkbox ? 

 

The question

Weapon pickups and ammo pickups seems they need the floating point fix member or they fall thrue the ground ?- Is that right ? 

Anything I put in my scene also need the member component? 

AI I spawn ? 

Reason I ask this is because everything I put in the scene is gone at runtime and appears to work after floating point fix member component is added 🤷🏼‍♂️

 

And what is the largest number Unity can handle without floating point fix? My terrain is only 4km x 4km ...

 

 

 

Floating point fix is only added to the character. 
If your pickup items are falling through the floors you may need to add a collider. 

If you are using the world streaming than make sure that the objects are added to the correct terrain parent, and scene. 

 

  • Like 1
Link to comment
Share on other sites

On 2/20/2022 at 5:31 AM, Mattis89 said:

Is this right the way I made it ? -the player itself has the floating point fix component, the camera have the floating point fix member component ? And a car you can drive have the floating point fix member component? And all my terrains have it enabled in the checkbox ? 

 

The question

Weapon pickups and ammo pickups seems they need the floating point fix member or they fall thrue the ground ?- Is that right ? 

Anything I put in my scene also need the member component? 

AI I spawn ? 

Reason I ask this is because everything I put in the scene is gone at runtime and appears to work after floating point fix member component is added 🤷🏼‍♂️

 

And what is the largest number Unity can handle without floating point fix? My terrain is only 4km x 4km ...

 

 

 

Also I would make a new thread and not post in a market thread or your question might get lost. 

 

  • Like 1
Link to comment
Share on other sites

6 hours ago, Bryan said:

Also I would make a new thread and not post in a market thread or your question might get lost. 

 

Thanks ! Yes okay , I didn't parent the objects at all to the terrain..  I could start a new thread yes , but for now I leave it, my map is so small so I think I don't need floating point fix.

  • Like 1
Link to comment
Share on other sites

14 hours ago, Mattis89 said:

Thanks ! Yes okay , I didn't parent the objects at all to the terrain..  I could start a new thread yes , but for now I leave it, my map is so small so I think I don't need floating point fix.

You only need a floating point fix really when your character goes past 5000 meters or so. 
The reason is because you could experience texture tearing etc. You could run a test to see if its actually needed or not just by running around and seeing what the farther point away from world origin is. 

Link to comment
Share on other sites

15 hours ago, Bryan said:

You only need a floating point fix really when your character goes past 5000 meters or so. 
The reason is because you could experience texture tearing etc. You could run a test to see if its actually needed or not just by running around and seeing what the farther point away from world origin is. 

Yes I did that, didnt see any shadow artifacts or lightning issues... textures fine ..

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Tell a friend

    Love Canopy - Procedural Worlds? Tell a friend!
  • Need help?

    We work with some of the biggest brands in global gaming, automotive, technology, and government to create environments, games, simulations, and product launches for desktop, mobile, and VR.

    Our unique expertise and technology enable us to deliver solutions that look and run better at a fraction of the time and cost of a typical project.

    Check out some of our non-NDA work in the Gallery, and then Contact Us to accelerate your next project!

×
×
  • Create New...