Search Unity

Planetary Terrain: Quadtree Planets for Unity

Discussion in 'Assets and Asset Store' started by simitro, Nov 10, 2017.

  1. valentinwinkelmann

    valentinwinkelmann

    Joined:
    Nov 3, 2014
    Posts:
    191
    I already mentioned it in my review: I am basically very satisfied with the purchase of the asset, but I think the Node system has to be completely overhauled urgently. for example, after the planet was in play mode, it shoots my NodeCanvas again and again. the connections will then loosen and at the next start the planet won't work.
    or if I change an enum field in the node system and don't explicitly click on the corresponding node before, a previously changed enum is simply changed.


    to represent the planet as a polygon object has now worked with its own shader. basically a super asset. but it needs 1. a better node system and 2. more nodes to be able to work more flexible. e.g.: i would find a grandient node useful so that you can work e.g. speizell on the polar caps.

    i don't know if you know xNode. that would be a very mature and well working node system which might work better.
    I had already worked with xnode several times if you have any questions you can also contact me personally.

    The QuadTree system is really great, I would love to see this asset unfold its full potential.
     
    Siccity likes this.
  2. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    Could you please explain the purpose of ConstantTriArrays class and why we need this structures and why we cant get this data from the plane mesh?
     
  3. simitro

    simitro

    Joined:
    Feb 13, 2015
    Posts:
    123
    Ok, I'll look into xNode. Thanks!
     
  4. simitro

    simitro

    Joined:
    Feb 13, 2015
    Posts:
    123
    ConstantTriArrays is used for quad edge fans. If a quad neigbors another quad whose subdivision level is lower, it loads the correct indices from ConstantTriArrays and applies them to its mesh.
    Using this method, the vertices array doesn't have to change, vertices/triangles can be skipped just by changing the indices.
     
  5. valentinwinkelmann

    valentinwinkelmann

    Joined:
    Nov 3, 2014
    Posts:
    191
    I also have a problem with the Foliage System at the moment, I just don't get any objects spawned on my planet.
    What do I have to set here so that the planet gets simple stones? I have already experimented a lot with the settings around but it does not lead to any result.

    upload_2018-9-28_14-17-29.png
     
  6. simitro

    simitro

    Joined:
    Feb 13, 2015
    Posts:
    123
    Seems like Detail Level is too high, set it to your largest subdivision level. Detail Distance should be larger, maybe a few thousand units. You also need colliders on the levels you want to generate foliage on.

    Did you check the section on foliage in the pdf? You can also take a look at the example scenes, FPS Controller, Earth-sized planet and GPUTerrainGeneration all have the foliage system set up.
     
    Last edited: Sep 28, 2018
  7. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    With setup, such this:

    I am trying to reuse noise with applied transformation to it in two operator nodes. But when I generate compute shader, it will duplicate all this calculations twice which is incorrect.
     
  8. simitro

    simitro

    Joined:
    Feb 13, 2015
    Posts:
    123
    Good catch! One path was unused, so the compiler would've probably optimized it out, but still. Here's the fixed version of SaveComputeShaderNode.cs (Planetary Terrain/Scripts/NodeEditor/Node_Editor/Nodes/Editor/).
     
  9. rmorph

    rmorph

    Joined:
    Apr 3, 2012
    Posts:
    87
    Hi! Thanks for the asset - It looks really exciting. I have a bit of trouble starting it up however - I get the ffollowing Error Message:
    Assets/Planetary Terrain/Scripts/Quad.cs(51,18): error CS0246: The type or namespace name `AsyncGPUReadbackRequest' could not be found. Are you missing an assembly reference?

    I guess its a beginner bug? I'm running the 2017 LTS.
     
  10. simitro

    simitro

    Joined:
    Feb 13, 2015
    Posts:
    123
    Seems like 2017 LTS doesn't support AsyncGPUReadbackRequest and doesn't download the version of the asset without it. I sent you a link to download the 2017.1 version without AsyncGPUReadbackRequest.

    Not having AsyncGPUReadback makes GPU Terrain generation slower. If you planned to use it I would recommend switching to a newer Unity version if possible.
     
  11. rmorph

    rmorph

    Joined:
    Apr 3, 2012
    Posts:
    87
    Thanks for the speedy reply :) I will check that out and confirm the fix when I get home.

    Yeah I wish I could go to 2018 but I have some important assets that are biblically fixed to '17LTS.
     
  12. valentinwinkelmann

    valentinwinkelmann

    Joined:
    Nov 3, 2014
    Posts:
    191
    Is there a minimum size of the planet that is needed to generate foliage on it? My planets are 250-1000m in radius.
    I have tried all the settings through. The only result you can get is an "ArgumentOutOfRangeException: Cannot be negative". error.
    This repeats itself as soon as I move over the planet so it seems to occur whenever the FoliageRenderer.cs tries to spawn a prefab.

    It would be nice if an update would follow which fixes known bugs (e.g. the bugs in the node system) and makes the workflow more comfortable.
     
  13. simitro

    simitro

    Joined:
    Feb 13, 2015
    Posts:
    123
    Just tried myself, the foliage system works with planets of radius 250 or smaller, no matter what you're spawning (grass/mesh/prefab). Can I take a look at your configuration and can you give me the line the exception occurs at?

    I am working on an update to improve the node editor, the xNode author hasn't responded to me yet unfortunately. I'll try contacting him directly. Tell me what I should change for a more comfortable workflow, I'll try to include it.
     
  14. valentinwinkelmann

    valentinwinkelmann

    Joined:
    Nov 3, 2014
    Posts:
    191
    I'm currently dealing with another problem, but I'll send you exact data of my planet setup tomorrow or the day after tomorrow.
    About xnode: there is a discord chanel where the developer(@Siccity
    Siccity) can usually be reached actively (https://discordapp.com/invite/qgPrHv4)

    I have already had a lot of experience with xnode, if you have questions you can also reach me personally then I could be more detailed on your questions.

    i'll send you my contact data in an privat message.
     
  15. simitro

    simitro

    Joined:
    Feb 13, 2015
    Posts:
    123
    Thanks, I already reached him on discord. Seems like the Unity Serializer xNode is based on just doesn't support abstract classes, so I'll continue using NodeEditorFramework but switch to the newest version.
     
    Last edited: Oct 13, 2018
  16. bicarbon8

    bicarbon8

    Joined:
    Sep 2, 2018
    Posts:
    32
    @simitro ,

    any chance you'd be willing to release just the QuadSphere code as it's own asset? I've already implemented the rest of the features, that your asset provides, on my own and am just looking for a QuadSphere supporting LoD like you have
     
  17. valentinwinkelmann

    valentinwinkelmann

    Joined:
    Nov 3, 2014
    Posts:
    191
    i would like to activate the Quads which are in a certain radius to my player, no matter if they are viewed by the camera or not. or is it possible to activate only the collider? the point is that a third person will fade out the terrain they are on under certain circumstances. then the charachter will fall through.

    it would also be useful if we could also apply the fade out of the quads to our own objects, e.g. like this: i instantiate an object on the planet, if i go away and the quads are faded out, the object will be faded out too, i come back, it will be faded in again. of course, it doesn't really help to put the object into the quad as a child because there can be several quads at one position because of the different resolution.
     
  18. bicarbon8

    bicarbon8

    Joined:
    Sep 2, 2018
    Posts:
    32
    @Diego_Graphics,

    could you not simply implement a script that disables any NPC's (and their attached Rigidbody components) that go a certain distance away from the player? You may also need to disable the frustrum culling feature of the above asset, but by disabling the NPC's you would prevent any actions by them when they are beyond the draw distance from the player. Or are you talking about a networked game? If that's the case then each player would have their own view of the quads closest to them and Unity would handle synchronisation of transforms so you wouldn't have any players falling through the terrain.
     
  19. Quarior

    Quarior

    Joined:
    Aug 28, 2017
    Posts:
    23

    In your asset page, the image above is the Moon of Earth (heightmap and textures) or a semi-procedural moon (just textures), ie make the procedural texture adapted to the heightmap ? Also support png (in package preview a see format bytes) ?
    The units you use is kilometers or meters ?
    Supports multiple stars (for a binary system by example) ?
    Thanks for information and have a nice day.
     
  20. simitro

    simitro

    Joined:
    Feb 13, 2015
    Posts:
    123
    Probably not. I don't have enough time to maintain another asset right now and still add new features.

    If you want to enable quads around the player you should take a look at VisibleToCamera() in Quad.cs (returns true if visible), and radiusVisSphere in Planet.cs. radiusVisSphere describes a sphere around the camera, if Quads are in that sphere, VisibleToCamera() returns true (assuming LODModeBehindCam is set to ComputeRender).

    Activating only the collider is easy, just disable the MeshRenderer of the Quads. You can access all quads with planet.quads. But I would also suggest trying to fix the problem another way, as generating only the collider is still just as computationally intensive.

    Are you referring to the fading method used in the GPUTerrainGeneration sample scene? It fades out every object rendered by the two terrain cameras.
     
    Last edited: Oct 19, 2018
  21. simitro

    simitro

    Joined:
    Feb 13, 2015
    Posts:
    123
    The moon you see in the screenshot is based on Earth's actual moon. It uses a heightmap of the actual moon, but the colors were generated by me based on the heightmap.

    The native format for heightmaps is .bytes, but there are converters included. Through Unity you can convert any .png with a max size of 8192x8192 to the PT native format (.bytes), if you have Photoshop you can convert heightmaps of any size to .bytes.

    The units used are whatever you want them to be! In the sample scenes I interpreted one (Unity-) unit as a meter (in non-scaled-space), but you might as well say that its ten meters or even a kilometer. It's all about perspective.

    The asset doesn't implement stars and only has very basic example scripts for orbits. It basically only gives you the planets, moving them and creating solar systems is up to you. Though I imagine implementing binary suns in scaled space is fairly straightforward.
     
    HeadClot88 likes this.
  22. simitro

    simitro

    Joined:
    Feb 13, 2015
    Posts:
    123
    @Diego_Graphics

    I found a way to get xNode working with abstract classes, so I'll use it in future releases. Currently re-implementing all the nodes.
     
  23. bicarbon8

    bicarbon8

    Joined:
    Sep 2, 2018
    Posts:
    32
    no worries... probably for the best as it forces me to make it myself... already making some good headway with QuadTree LoD
     
    simitro likes this.
  24. simitro

    simitro

    Joined:
    Feb 13, 2015
    Posts:
    123
    As I'm working on the node editor right now, any wishes for new node types? I already added blend and subtract.
     
  25. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    May be gradient, remap, invert, min, max. At least last four I implemented by myself and they are pretty usefull.
     
  26. Quarior

    Quarior

    Joined:
    Aug 28, 2017
    Posts:
    23
    Thanks for information. So I can put in meters and don’t necessarily a diffuse map.
    When I talk about stars, is about if the atmosphere (and surface) support multiple source of light (point light for star), I have already stars.
    Have a nice day.
     
    Last edited: Oct 20, 2018
  27. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    Also it would be great, if this asset will provide assembly definition files.
     
  28. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    Any suggestions for how to create a cratered surface, like on the moon? The resolution of the heightmaps doesn't let me do small craters.

    It would be pretty cool to be able to model holes, ridges and craters, maybe with heightmaps, and have them scattered around, deforming the mesh. In addition to the planetary-spanning heightmaps, perhaps you could say that some heightmaps represent stuff at the 1km x 1km scale, and some other heightmaps represent 10m x 10m. Then scatter them like the rocks and sample them when generating the terrain? Maybe something to think about? And if that's hard or impossible, are there any other ways to do it or fake it?
     
    Last edited: Oct 31, 2018
  29. simitro

    simitro

    Joined:
    Feb 13, 2015
    Posts:
    123
    You can modify hybrid mode to add noise-generated craters to your planet. First, rewrite hybrid mode to add the two values instead of blending:
    Code (CSharp):
    1. //return result * (hybridModeNoiseDiv - NoiseAtXYZ(pos)) / hybridModeNoiseDiv; //Blend
    2. return result + noise.GetNoise(-pos.x, pos.y, -pos.z); //Add, not using NoiseAtXYZ() because it scales noise to 0-1, we want negative values.
    3. //Usually height values are clamped between 0 and 1, the code also works with not excessively smaller/bigger values.
    In Planet.cs, HeightAtXYZ().

    Now you need a noise module that returns 0 in most places, and a negative value in some places (craters).

    craters.png

    The curve operator is very powerful for such things. Be careful with the scale though, the values are scaled to 0 to 1 before the curve, and back to -1 to 1 after. (This is the new node editor that I'm currently working on, also works in the old one though.)

    With a constant 1 heightmap:
    craters_flat.PNG
    With desert heightmap and scale=3
    craters_hm.PNG

    You might want to multiply the crater output with some noise to make the craters a bit more interesting:
    noisecrater.PNG

    Editing the height generation logic is generally fairly easy, just edit HeightAtXYZ(). Your heightmap randomized blending idea sounds good, I'll look into it!
     
  30. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    Well, there goes my weekend :)
     
  31. rmorph

    rmorph

    Joined:
    Apr 3, 2012
    Posts:
    87
    I confess Im struggling a bit to get good looking planets and moons - more detail obviously is good but its hard to tell what will render well in game - theres a lot of terrain popping going on. Is there a way to overcome this? Also Is there a possibility to store planet templates? And if so does anyone have a good example that could be used as a decent starting point?
     
  32. simitro

    simitro

    Joined:
    Feb 13, 2015
    Posts:
    123
    You can overcome terrain popping by increasing the detail distances, when no terrain is being generated there can't be any popping. Needless to say this also means there are more quads, so you'll have to find a trade-off between detail and performance.

    I haven't written a template system, but I reckon you could just use prefabs.
     
  33. markashburner

    markashburner

    Joined:
    Aug 14, 2015
    Posts:
    212
    Hey Simitro

    I have already developed a Node Editor for Planetary Terrain

    The List of Nodes I have built are as follow:

    I have a Combiner which has the following:
    Add
    Subtract
    Multiply
    Max
    Min
    Power
    Root

    I have some filter Nodes such as:
    Abs Node
    Clamp Node
    Curves Node
    Invert Node
    And BEST OF ALL the TERRACE NODE!

    It took me a long time to work out the Terrace Node...but finally I have it and it is displaying awesome results!






    The TERRACE node makes a huge difference to the quality of terrains...

    However I can only serialize Noise module with it...and I am desperately hoping you will help me implement it into a Compute Shader?

    If you would like me to send you my Node editor for Planetary Terrain..I will be happy too...I developed it using Xnode!
     
  34. simitro

    simitro

    Joined:
    Feb 13, 2015
    Posts:
    123
    Hi,

    I already finished my node editor (using xNode) a week ago, Unity just seems to take a long time to process it. I can send you the package if you want. I implemented most of the nodes you've named and can implement the others aswell.

    Implementing a normal node to work with compute shaders is quite hard. The nodes in my new node editor can be used to generate a Compute Shader, with the exception of the remap node, as it would behave just like using a second generator, i.e. there wouldn't be a difference in performance. If you send me your Terrace Node implementation I'll look into making it compatible with Compute Shaders.

    Thanks!
     
    valentinwinkelmann likes this.
  35. markashburner

    markashburner

    Joined:
    Aug 14, 2015
    Posts:
    212
    Awesome..just sent you an email with all the scripts attached for the Terrace Node.

    Thanks for getting back to me!

    Cheers
     
  36. simitro

    simitro

    Joined:
    Feb 13, 2015
    Posts:
    123
    Hi, I don't know if all of you got the notification: Version 2.6 with the new node editor and some other optimizations and bug fixes has been out for a while.
     
  37. Chuckalicious

    Chuckalicious

    Joined:
    Jul 28, 2012
    Posts:
    51
    Yes yes yes...its very nice too. One suggestion about the PDF getting started, in the very first paragraph, let users know to double click to open the editor AND THEN RMB to add nodes. (It does say more further down in the doc but having it clearly stated in the "Quick Start" would be helpful.
     
  38. Chuckalicious

    Chuckalicious

    Joined:
    Jul 28, 2012
    Posts:
    51
    WOW...this looks down right awesome. I hope to see this feature in PT some day.
     
  39. Chuckalicious

    Chuckalicious

    Joined:
    Jul 28, 2012
    Posts:
    51
    I wonder how difficult it would be to use an Octahedron rather than a cube. This was a great article https://www.binpress.com/creating-octahedron-sphere-unity/
    I can only imagine the challenge in developing a tree data structure for this.
     
  40. Chuckalicious

    Chuckalicious

    Joined:
    Jul 28, 2012
    Posts:
    51
    Is there any information that explains how to construct noise via the Node editor node types. What each node does, when you might use it, how to combine them for more advanced results *optimally*. I love the preview node btw! This was a great read...now if I can translate this into how you use the node editor. :) https://www.redblobgames.com/maps/terrain-from-noise/
     
    Last edited: Dec 3, 2018
  41. simitro

    simitro

    Joined:
    Feb 13, 2015
    Posts:
    123
    Not really, unfortunately. The included noise graphs are my own, and beyond those I haven't made many. I'd encourage everyone to post their own noise graphs, perhaps I could even include them in an update if they would be ok with that.

    I though about using something other than a cube, but I don't really see the advantages. Yes, when using a cube the vertex resolution differs slightly depending on where you are on the sphere, but that doesn't make a difference, especially after a few divisions. Anyway, you'd probably be better of completely rewriting the system, since so many things are different.

    Concerning mark's terrace node, I already implemented it but I don't think it justifies a whole new version. If anyone wants the terrace node, just send me your invoice number in a pm and I'll send you the download link!
     
    Chuckalicious likes this.
  42. Chuckalicious

    Chuckalicious

    Joined:
    Jul 28, 2012
    Posts:
    51
    Awesome, I'll send that asap. TY!
     
  43. ramofojabuka

    ramofojabuka

    Joined:
    Dec 10, 2018
    Posts:
    3
    Hi!

    I just bought this Asset but I'm having some problems using it.
    I want make "real" terrains with good definitions, just like Desert Planet.
    But Desert Planet uses a heightmap... and I want make it with Noise nodes.

    My planet look like this:
    https://i.imgur.com/0Is9fG1.jpg

    How can I make it bigger and more "realistic"? (just like MapMagic nodes)
     
  44. simitro

    simitro

    Joined:
    Feb 13, 2015
    Posts:
    123
    Bigger is easy - just increase the radius, add more detail distances and make sure your camera is not inside the planet.

    Realistic on the other hand is harder. My best advice would be to play around with the node editor (Curve and Select nodes are your best friends when going for realism), maybe start with something like this:

    Capture.PNG

    Try changing frequencies and the curves so you can get a feel for it.

    The desert planet heightmap was made with a very old version of PT when the node editor didn't exist, so I unfortunately don't have any files. Sorry.
     
  45. Bradybeast128

    Bradybeast128

    Joined:
    Jul 17, 2016
    Posts:
    1
    Hi, I just bought this asset and for some reason, the terrain just doesn't appear, even in the example scenes I don't know what going on. Is there some sort of video tutorial for this? I don't what to do.
     
    SLThompson likes this.
  46. simitro

    simitro

    Joined:
    Feb 13, 2015
    Posts:
    123
    Hi, a video tutorial is available here, but the sample scenes should work without any setup. What unity version are you on, and are any errors being thrown?
     
    Last edited: Jan 2, 2019
  47. owen_proto

    owen_proto

    Joined:
    Mar 18, 2018
    Posts:
    120
    Import into new project in 2018.3 on OSX is causing Unity to crash for me.
     
  48. simitro

    simitro

    Joined:
    Feb 13, 2015
    Posts:
    123
    I tried with Unity 2018.3.0f2 on macOS 10.13.6 and 10.14.2 and it worked in both cases. Does it import on older versions, have you tried reinstalling Unity?
     
  49. owen_proto

    owen_proto

    Joined:
    Mar 18, 2018
    Posts:
    120
    Thanks for checking. It worked in 2017.4 with some import errors, so I reinstalled 2018.3 and it was able to import without crashing, but also with the same import errors I saw in 2017.4. Seems to work fine though with the exception of GPU terrain generation (I assume because of the compute shaders.) The errors were almost all shader related however. Is this because I have to force metal support in the project? I couldn't find the option in project settings and I tried forcing unity to use metal on startup via terminal, but that just caused it to crash when starting a new project. Maybe I have to install iOS build support? Could also be that I'm experiencing these issues on my MacBook which is quite old at this point (2011). None of this is a huge deal as I mainly use a windows machine for dev.
     
  50. simitro

    simitro

    Joined:
    Feb 13, 2015
    Posts:
    123
    You're right, you need Metal for compute shaders, OpenGL is not supported on mac. My Unity (only editor, no iOS build support or anything else installed) automatically uses Metal for new projects and everything works, including compute shaders on the integrated GPU.