Search Unity

A better method to generate a planet which can be landed on

Discussion in 'Scripting' started by PandrPi, Feb 17, 2018.

  1. PandrPi

    PandrPi

    Joined:
    Jan 14, 2015
    Posts:
    4
    Hello,
    I want to describe my current method to generate a planet. So, my planet consists of six planes(empty gameObjects) directed along every of axes, including their negative direction, so simply it's a cube. Then I generate a real plane mesh with custom resolution(the script can be found at this url [Procedural Primitives][1]) then I get noise value at every vertex position of the mesh and having a noise value for some vertex I normalize this vertex and multiply it by noise value. I think it's clear. If no i include urls [this][2] and [this one][3] hope it will help. So, the problem, i want planet to be in radius althougt several hundreds km to create some similarity of "full-sized planet". But using my method I have to create plane mesh with resolution about 256x256 as a result only one mesh have about 65k vertices which is almost max for Unity, it also gives me about 2 thousand meters between vertices using radius = 600,000 (600,000/255=2352 m). In addition the generation of such a plane can take about 2 seconds using [CoherentNoise][4] and almost the same using [LibNoise][5]. I'm also using LOD system which divide plane by four planes at approaching.I can change the chunk mesh resolution from 255 to much lower, but doing this I have to increase number of levels for LOD system, if I increase levels count there will be more draw calls which is not good for performance. So it's bad not only for generation but for rendering too. So, I hope you have some ideas for a better method than my or something else. Thanks in advance.


    [1]: http://wiki.unity3d.com/index.php/ProceduralPrimitives
    [2]: https://forum.unity.com/threads/procedural-terrain-on-a-planet.127292/
    [3]: https://answers.unity.com/questions/929567/how-do-you-make-a-sphere-from-6-planes.html
    [4]: https://forum.unity.com/threads/coherentnoise-procedural-generation-library-released.91784/
    [5]: https://forum.unity.com/threads/libnoise-ported-to-unity.68764/
     
  2. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    I do not know anything helpful aside from recent Unity versions are capable of 32 bit mesh index buffers.
     
  3. PandrPi

    PandrPi

    Joined:
    Jan 14, 2015
    Posts:
    4
    If i understood you correctly and you say about 65k vertices limitation, this will not help me, because the the more chunk resolution the more time cpu will generate a mesh for chunk.
     
  4. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    Right, well I wasn't sure it would help you or not, I was merely pointing out that the limitation has changed, in response to what you wrote. :)

    Anyhow, I hope you get some assistance on the actual question.
     
  5. TaleOf4Gamers

    TaleOf4Gamers

    Joined:
    Nov 15, 2013
    Posts:
    825
    Not sure if you have seen this but perhaps you can get some inspiration or guidance from Quill18's Planet tutorial series:
     
  6. PandrPi

    PandrPi

    Joined:
    Jan 14, 2015
    Posts:
    4
    I have not seen it, thank you, hope this will helpful.
    I am also open for other ideas, if you have them)

    It wasn't helpful for me, it's a simulation of planet, and Unity Terrain can only receive heights array, so it can not be rounded to spherical planet.
     
    Last edited: Feb 17, 2018