Announcement

Collapse
No announcement yet.

Simple Procedural Planets - BP only.

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Simple Procedural Planets - BP only.

    UPDATE - not BP only - includes Custom C++ Blueprint Function Library

    Allright. As I can see there's a different project doing exactly the same with BP. No reason to continue working on this kind of thing I guess. You can get a BP procedural planets free there, so I'm out with this one.

    ...

    I mean, I done with BP only approach. Started to work with C++ this week so I can use different noise functions, and run generation process on different CPU thread.

    What I have done so far:
    Full C++ grid generation and Noise implementation for Fractal Value, Gradient, Cellular, Simplex.
    Custom made (still WIP) normal calculation which is much faster than the one from Procedural Mesh.

    Next step is moving all the functions to different CPU thread so there is absolutely no FPS drop during planet generation.

    Basically, a segment of 256x256 poly is generated in about 800 ms.

    Screenies:

    Click image for larger version

Name:	Planet0.jpg
Views:	2
Size:	120.1 KB
ID:	1192137

    Click image for larger version

Name:	Planet1.jpg
Views:	2
Size:	87.9 KB
ID:	1192138

    Click image for larger version

Name:	Planet2.jpg
Views:	2
Size:	114.8 KB
ID:	1192139

    Yep.

    ===========================================================================
    Old version.
    ===========================================================================

    Well, not really BP only as I'm using a plugin, but about that - later.

    So many people and games are using procedural generation now, specially space games, Dual Universe, Star Citizen, No Man's Sky, so on, so forth.

    And I though, if they can do it, so can I! (ofc "do it" not that complicated as the titles above "do it").



    So, started from a grid of points, and then moved it, copied it per side (6 sides, as a cube) and normalized it. Then added Simplex Noise combinations (HUGE thanks to DevDad for that plugin Simplex Noise

    Every noise layer also creates a vertex color, 3 layers for 3 colors so far. It takes more less 3 seconds to create a 128x128 quad, there are like 96 quads per planet (values can be changed) biggest I did was 256x256 polys per quad and 8x8 quads per planet's side.
    So, that's roughly... 256x256x64x6 = 25 165 824 polygons. Performence was, well, not bad. But it took ages to generate. So, I decided I'd SAVE that planet to a game save. Worked. Now after a first run the planet is saved and I can load it inside the editor or on the beginning of a game. Works pretty nice. Problem is a saved planet that size is 720 MB. The one you see in the video is 320 MB. No LOD yet, but the performance is amazingly good here.

    Still, it would be AWESOME to have that load or generate on a different thread. Or something.

    Anyways, This is how I'm killing time waiting for No Man's Sky here. Might even consider putting that Blueprint to Marketplace later, when I finish the atmosphere shader and some other things, like rocks placement, forests and water... And such... And LOD... And gotta ask DevDad for a permission to include his plugin... Or something.

    God, how I love Unreal!

    What do you think?
    Last edited by Z-enzyme; 08-21-2016, 05:50 PM. Reason: The project's type is evolving. Also, an update.

  • #2
    Wow, looks awesome! Great results! I cant wait to see what else you do with it.
    lucasgovatos.net | Twitter | Epitasis - A Colorful Exploration Puzzle Game

    Comment


    • #3
      Well done, looks real nice

      Comment


      • #4
        This looks really nice.

        I have some questions though.

        1. How big is this planet?
        2. Would it be possible to show a Wireframe of the Quads? I am curious to how dense the meshes are.
        3. Look into using the Run time Mesh Component It should load your Quads Faster.
        4. What are your plans for this? Do you plan on open sourcing it or selling it?
        5. Is this compatible with the BP to C++ toolset? If so you should get a performance boost from that.

        Comment


        • #5
          Originally posted by HeadClot View Post
          This looks really nice.

          I have some questions though.

          1. How big is this planet?
          2. Would it be possible to show a Wireframe of the Quads? I am curious to how dense the meshes are.
          3. Look into using the Run time Mesh Component It should load your Quads Faster.
          4. What are your plans for this? Do you plan on open sourcing it or selling it?
          5. Is this compatible with the BP to C++ toolset? If so you should get a performance boost from that.
          1: You can scale it freely any way you want, there's also a radius variable which defines the... Radius.
          2: Sure. The density is actually a matter of setup, you can make it as dense as you want really. For safety measures (as first generation process is quite heavy and slow) I set the MAX amount of quads to 8x8 per side (6 sides total) and max quad squares to 256x256. But that's a limit that can be easily changed.

          Click image for larger version

Name:	Planet01.jpg
Views:	1
Size:	971.5 KB
ID:	1112429
          - simple mesh, on the right you can see how many quads (squared) it generates and how many faces (squared) per quad.

          Click image for larger version

Name:	planet004.jpg
Views:	1
Size:	953.8 KB
ID:	1112431
          - the planet from the video - 4x4 quads per side, 128x128 polys per quad. (6 sides x 4x4 x 128x128 = amount of faces * 2 = amount of triangles)

          Click image for larger version

Name:	Planet02.jpg
Views:	1
Size:	814.7 KB
ID:	1112432
          - biggest I saved so far - 8x8 quads and each 96x96 faces. 720 MB save.

          Click image for larger version

Name:	Planet03.jpg
Views:	1
Size:	965.9 KB
ID:	1112433
          - this is a single quad I made it possible to build - 8x8 quads, 256x256 faces. Tried to generate once a planet like that, well, can't remember the save size but was way too big.

          3: Sure will do! Thanks a bunch mate!

          4: Well, probably will try creating a simple game for Android with this, like, a space exploration, mining and trading game, maybe something bigger for PC as well but that - meh, dreams XD
          Sourcing / selling. That depends how this goes. If the script ends up really good I might consider just giving it free. Or through the Marketplace. Bit gotta speed things up and optimize it a lot.

          5: If I'm able to do the basic math (vector grid generation) through C++ (which I can't for now) then this might be something worthwhile.
          It IS BP wise only. But uses a plugin made by DevDad, I have no idea how C++ conversion from BP to C++ with that toolset works.
          Heaviest here is calculating Tangents and Normals for quads in the Generation pass...

          Okay, how that works: First you gotta generate a planet - that is amount of quads and faces, set up everything in the noise, and such.
          Then you checkbox SaveToFile box.
          When you hit PlayInEditor the game generates quads. It's about 3 seconds for a 128x128 polygon quad to 20 seconds for 256x256 quad. So, if you have 64 quads 256 size, it's 21 minutes per planet's side. And there are 6 planet sides. 2 hours straight for full res planet.
          But!
          When the first generation pass is over it saves the result to a file. A simple SaveGame file. The load process is fast and easy, but the files are big. You can also load the planet in the editor through Construct Script.

          Anyways, gonna check this Run Time Mesh Component, see how that goes. Thanks a bunch!
          Attached Files

          Comment


          • #6
            This looks promising, very cool.

            Comment


            • #7
              Hey [MENTION=8503]Z-enzyme[/MENTION],

              This may also be of interest to you - It was posted in the runtime mesh component thread. The Runtime Mesh Component is also free if I recall correctly.

              Originally posted by Koderz View Post
              As a heads up to everyone currently using the RMC or thinking about using it!

              First, the RMC is now on the Marketplace, and is now also downloading correctly for those of you who attempted to download it when it first went up and were unable to. The marketplace version is the same as the current released version on github (not the master branch source).

              Version 2 should be out in about 2-3 weeks if all goes to plan, with some of the following either already in github, or showing up incrementally over the next couple weeks. Version 2 will, hopefully, bring the remaining tools from the PMC over including normal/tangent calculation, RMC <-> StaticMeshComponent conversions, and hopefully tessellation support. There's also a decent chance that it will have the initial round of improvements for collision cooking. Unfortunately though as those have taken multiple engine changes, it will require a source build of the engine at least until Epic hopefully merges part/all of it back into mainline UE. So far the collision cooker can be operated in its current game thread only mode but allow for some control over the quality of the cook cycle. There's a trade off between quality and speed of cooking, with lower quality cooked meshes being a little slower in the actual collision detection but this alone allows it to run up to ~6x faster. It should also support nearly full multithreaded cooking to move most of the work off the game thread.
              That should help you out allot

              More Questions -

              1. Are there any Plans for a Solar System Generator with this included?
              2. Are you doing collisions at all with BP procedural planets?
              Last edited by HeadClot; 07-22-2016, 08:58 PM.

              Comment


              • #8
                Already downloaded the RMC, tried it, the mesh generation speed isn't noticeably faster. Most time takes the calculation of tangents and normals (and that RMC will have in it's next release) so I will wait patiently for that.

                Also, tessellation? That should help a lot! Thanks [MENTION=260]HeadClot[/MENTION].

                As for questions:

                1: Nope, the generation is way too slow, well, maybe, for not very detailed planets that can work. Actually, not a bad idea. Yea. I think that at some point I'll try...

                2: Yep. Each quad is separate procedural mesh with collision. No idea how that really works but never flew "inside" the planet. So, guess it works.
                Last edited by Z-enzyme; 07-22-2016, 09:07 PM.

                Comment


                • #9
                  This looks excellent, [MENTION=8503]Z-enzyme[/MENTION]! I hope you do decide to put it on the Marketplace; I for one would be interested in tinkering with it. I attempted a similar thing in Unity aeons ago with my rudimentary C# skills. Needless to say, the performance was abysmal but this already looks considerably more efficient, and with better results than my own experiments.
                  Currently working on Wastes of Nought.

                  Comment


                  • #10
                    A little update.

                    Created a crater system, it's slow but works, seed driven. Here's a screenie of 2 planets with a single crater, but big.

                    Click image for larger version

Name:	Craters.jpg
Views:	2
Size:	492.4 KB
ID:	1112505

                    Comment


                    • #11
                      Looks great! keep it up, I'm always interested seeing what people can do with procedural geometry.

                      Have you looked into quad trees? that could work pretty well for this.


                      I have a quad tree implementation in the works, meant for an infinite ocean plane but the same logic can be applied for dynamic terrain and pretty much everything of that nature, it's pretty cool.

                      4.10 Update! -> [Community Project] WIP Weather & Ocean Water Shader
                      WIP Interactive Water Shader, WIP 2D Water Sim
                      WIP FFT Ocean w/ Foam, Quad-tree Infinite Ocean LOD

                      Comment


                      • #12
                        [MENTION=1127]TK-Master[/MENTION] Wow, oh my. I'd totally would love to use that. Problem is I'm using procedural mesh component. I'm making my own grid of vectors, spherify them and offset them though simplex noise. No idea how to implement this kind of thing there. I'd have to take the high res grid I've got made with vectors and make lower res quads with that info to keep the noise persistent.

                        I'm doing everything in Blueprints so it's kind'a slow.

                        Comment


                        • #13
                          It might not be that fast if implemented via blueprints but I can't think of a reason why it would not be possible.

                          You can find multiple articles and guides about quadtrees in google if you want to research this further.

                          I would start by creating 6 quadtree grids, spherify them, offset them via noise etc. It's the same thing as you are currently doing really, it's just how you generate the initial grids that's the tricky part.
                          The nice thing with quadtrees is that you can skip generating any grids outside the camera frustum and "subdivide" the grids based on pixel coverage so the vertex wastage is pretty much as little as possible, it's very efficient.

                          4.10 Update! -> [Community Project] WIP Weather & Ocean Water Shader
                          WIP Interactive Water Shader, WIP 2D Water Sim
                          WIP FFT Ocean w/ Foam, Quad-tree Infinite Ocean LOD

                          Comment


                          • #14
                            A little update.
                            Got the proper atmosphere working! Material is pretty hard to set up right with different planet sizes but I guess it works. I need to do some testing.

                            Comment


                            • #15
                              Big demand for this....

                              Comment

                              Working...
                              X