Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Everything vibrating when terrain too large

Discussion in 'General Graphics' started by ATLAS-INTERACTIVE, Jan 28, 2015.

  1. ATLAS-INTERACTIVE

    ATLAS-INTERACTIVE

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    When we use our main level terrain (36000x36000), the UV's on the terrain virbrate slightly and so does the characters weapon, it seems anything graphical being rendered does, what causes this and how can we fix it?
     
  2. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    Possibly the lack of precision in floating point coordinates, especially if you are on a portion of the landscape that is far from the 0,0,0 coordinates. The way floating point works, the more digits are needed for the integer part of the number, the less digits are available for decimal digits, and the decimal point 'floats', so with bigger numbers you get less and less precision in the decimal part. Maybe you're relying on really high uv values and letting the texture wrap around with high uv's? be better off keeping the uv's within a 0..1 range if possible. Any object located at really high floating point coords is going to show the same jumping because of the lack of decimal precision.
     
  3. ATLAS-INTERACTIVE

    ATLAS-INTERACTIVE

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    How can this be fixed while keeping the active terrain this size?
    Is there any way to fix this UV precision problem for both the terrain and the player?
    This is something I really need to fix, as it currently is, we would not be able to use its current state in any kind of tech demo.
     
  4. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    I don't have that answer but other people have dealt with this before. Search.
     
  5. karljj1

    karljj1

    Joined:
    Feb 17, 2011
    Posts:
    440
    If your using a 1 meter to 1 unity unit scale then a terrain that size is going to suffer from floating point precision issues. I find anything over 20,000 is going to have this problem.
    As you move away from the origin you should notice the problem more.
    You could either scale down the whole universe so 1m = 0.1 unity scale etc or try using a floating origin, that's basically where you keep the camera at the centre of the world and move the world around the camera(http://wiki.unity3d.com/index.php?title=Floating_Origin).

    Karl
     
  6. ATLAS-INTERACTIVE

    ATLAS-INTERACTIVE

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    Will this mean something special has to be done with my environments, I have a lot of triggers, or will things like that work fine with the script in the link on the unity wiki?
     
  7. GfK

    GfK

    Joined:
    Aug 15, 2014
    Posts:
    107
    The trouble is the further away you get from 0,0,0, the greater the inaccuracies become.

    The answer (other than scaling everything down by a factor of ten) is normalisation. Do other people call it normalisation? Anyway, basically when your character/camera has moved, say, 1000 units along the x-axis, you shift everything in the game world back along the x-axis by the same distance - so the character ends up back at 0,0,0 but the player doesn't notice because everything else moved with it.

    This is much easier to manage if everything in your world is parented to an empty game object. Then all you have to move, is the parent.
     
  8. ATLAS-INTERACTIVE

    ATLAS-INTERACTIVE

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    Is this computation intensive? I have a VERY large world as you can see, but I am planning to have quite a lot of detail in it as well.
     
  9. ATLAS-INTERACTIVE

    ATLAS-INTERACTIVE

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    Ok, I have tested this script, it stops the player hands from shaking, and everything attached to the character, but the terrain UV's seem to still shake, if I stand perfectly still its fine, but when the camera moves, the UV's shake just like they do without the script, although it fixes the player so its half fixed.
     
  10. cowtrix

    cowtrix

    Joined:
    Oct 23, 2012
    Posts:
    319
    You're going to get a frame stutter if you move a lot of static colliders. Not really any way around that with the current PhysX integration. Kerbal Space Program have created an interesting system in Unity of cascading coordinates, although they use relatively few and simple colliders. But I believe there's a presentation out there by them about it that you might find interesting.

    Edit: I think this is it...
     
  11. ATLAS-INTERACTIVE

    ATLAS-INTERACTIVE

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    @cowtrix
    I am sure there is an easier way around this than to cut the terrain into little pieces and generate the collision accordingly, apart from being very unpredictable, the seams may produce some unwanted physics problems.
     
  12. MrGky93

    MrGky93

    Joined:
    Feb 27, 2014
    Posts:
    281
  13. FerociousIndustries

    FerociousIndustries

    Joined:
    Feb 28, 2018
    Posts:
    6
    I’m sorry if this is resolved or dead but in unity 2018.3 I had this issue and all you need to do is change your near clipping planes, everybody likes them at 0.01 but that’s too low, there are better more optimized ways of getting rid of the near plane proble, such as fading the material as the camera nears, or some games even leave the default “cut inside this object a bit” effect. But change your near clipping plane to 0.1 or higher, and you’ll resolve the terrain flicker, make sure far stays at 1000, with a terrain that size you will need to be careful with your LODs because a great amount of terrain will render
     
  14. hexdecc

    hexdecc

    Joined:
    Oct 24, 2014
    Posts:
    141
    some solution for it?
     
  15. xorblax

    xorblax

    Joined:
    Jul 15, 2018
    Posts:
    25
    It looks like having terrains that are too big causes this. Using terrain toolbox I split my 60000 x 60000 terrain into 4 15000 x 15000 terrains and it got rid of the jitter completely.