Search Unity

Discussion Interesting problem when using scale to fake distance

Discussion in 'Scripting' started by Shack_Man, Sep 8, 2022.

  1. Shack_Man

    Shack_Man

    Joined:
    Jun 7, 2017
    Posts:
    372
    I'm making a rocket game, and turns out Unity isn't really made for literal world scale/solar system scale....


    So I'm strapping the player/camera to a rocket and launch it by giving it more and more speed, but once it reaches a certain threshold, I don't add the speed directly, instead I just calculate how much height the rocket would have gained through that extra speed.

    To compensate for that, I use a bunch of tricks, including scaling the ground objects and scaling and swapping the ground texture. I take the ratio of the real height and the added fake height to determine the scale of things.

    For the ground textures I use a texture at 2x scale, and scale it down while going up. When it reaches 1x scale, I swap it for another texture at 2x scale (that looks exactly like the previous one at 1x), scale that one down and so on. The effect is like zooming out in google earth (where I get the textures from)

    So if the rocket is at 1000 units in the air, to fake another 1000 units I simply scale the ground by 50%. It feels actually quite good (in VR), and even as the developer I can't tell when exactly the scaling kicks.






    The interesting things is that this clearly doesn't work at all levels. If I am just 10 units above the ground and want to pretend to be 100 units high, I can't just scale the scene around me down to 10%. That would look super weird.

    Same goes for the textures, if I start way too soon to scale and swap them, I quickly run out of textures.

    So the only vague formula I can come up with here is that 'the higher I start doing this the better'.


    I feel like I'm overlooking a super simple piece of the puzzle here?
     
    Last edited: Sep 8, 2022
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,745
    Such as perhaps floating origins? It can help for distances, but perhaps not necessarily scales.
     
    Shack_Man and hippocoder like this.
  3. Shack_Man

    Shack_Man

    Joined:
    Jun 7, 2017
    Posts:
    372
    Interesting concept, hadn't heard about that one. I took a look at it bur for my particular case it doesn't feel like the best solution. I'll definitely keep it in mind though.

    For my scaling issue, I think it's simply that only objects you are looking at in a straight line will appear twice as small when twice as far away. So it just doesn't work when the world is all around you.

    My current solution is to launch a certain altitude and then slowly reduce the actual speed, until you're basically just floating above a shrinking planet.