Announcement

Collapse
No announcement yet.

Procedural Mesh Examples - free!

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

    [PLUGIN] Procedural Mesh Examples - free!

    Hi everyone!

    Last year I wanted to learn how to procedurally generate meshes in Unreal, so I put together a few quick tests of my own. This got some interest from people here so I decided to clean it up and release it for free!

    I really hope this will be useful to others who also want to play with geometry generation in Unreal.

    Download and source code: https://github.com/SiggiG/ProceduralMeshDemos/

    NOTE: All the current code is for Unreal 4.22!

    Click image for larger version  Name:	ProcExamples.jpg Views:	1 Size:	116.0 KB ID:	1182663

    The purpose of this project is to provide examples on how to generate geometry in code, from simple cubes to more complex geometry generated from fractal algorithms.

    I would love for this to become a community project, so I will accept pull requests for new samples as well as any corrections to my code. I'm also willing to add contributors directly if anyone is interested!

    Please note that I wrote the code to be readable, trying my best to explain each step along the way. There are many ways this code could be optimized to run better, but I wanted to keep things simple in the first few examples.

    There is a lot of code duplication between the different examples which I felt was OK for the first few classes, but I will refactor some of the common functions into a utility class soon.

    Update: I recently converted the example from using Epic's ProceduralMeshComponent to Koderz's excellent RuntimeMeshComponent.


    All corrections, contributions etc are of course welcome! I'm still new to rendering in UE4 and ultimately want to convert some of this to using RHI calls myself (UPrimitiveComponent, PrimitiveSceneProxy etc).
    Last edited by SiggiG; 04-10-2019, 02:13 PM.
    Programmer at Klang Games | Ex-CCP (EVE Valkyrie / Sparc) | @SiggiGG
    Check out my procedural mesh examples

    #2
    Thanks SiggiG! I've done some tests with the ProceduralMesh gen but got stopped up at various points, so this will be very helpful.
    Storyteller - An immersive VR audiobook player

    Dungeon Survival - WIP First person dungeon crawler with a focus on survival and environmental gameplay ala roguelikes

    Comment


      #3
      Wow, that Sierpinski triangle looks awesome. Nice one

      Comment


        #4
        Thanks a lot, I will probably come back to ProceduralMesh and spend some time on this after my current projects!
        [Gamedev programmer at Darewise (Paris) - We are hiring]
        UE4 Git LFS 2.x Source Control Plugin 2.10-beta for UE4.21 - (v1 integrated by default in Beta status since UE4.7)
        UE4 Plastic SCM Source Control Plugin (1.4.0 for UE4.21)

        Comment


          #5
          Made some progress on animating the meshes, will post a couple examples on the Github later tonight.

          Keep in mind that this is a very expensive way to do it since the mesh is generated on every frame! I will move away from the ProceduralMeshComponent later on for a more optimal implementation.

          Programmer at Klang Games | Ex-CCP (EVE Valkyrie / Sparc) | @SiggiGG
          Check out my procedural mesh examples

          Comment


            #6
            Very nice!

            Comment


              #7
              Really Cool.
              Will take a look

              The trees, are they created using a DLA algorithm?

              Comment


                #8
                Originally posted by georgeng View Post
                Really Cool.
                Will take a look

                The trees, are they created using a DLA algorithm?
                No, but I'm planning on adding that and other algorithms later. What I have there is a simple line division with a random offset of the center point.
                Programmer at Klang Games | Ex-CCP (EVE Valkyrie / Sparc) | @SiggiGG
                Check out my procedural mesh examples

                Comment


                  #9
                  This looks like nice project, good work. But the GPL license can't be used in UE4 by EULA, you should change the license. (MIT, Zlib or other)
                  Hevedy - Instance Tools: https://hevedy.itch.io/hevedyinstances
                  Hevedy - Image Tools: https://hevedy.itch.io/imagetools

                  Comment


                    #10
                    Originally posted by Hevedy View Post
                    This looks like nice project, good work. But the GPL license can't be used in UE4 by EULA, you should change the license. (MIT, Zlib or other)
                    Ah thanks for that! The MIT one is probably all I need.
                    Programmer at Klang Games | Ex-CCP (EVE Valkyrie / Sparc) | @SiggiGG
                    Check out my procedural mesh examples

                    Comment


                      #11
                      Hey SiggiG, I've been working on some serious updates to the PMC and would be interested in seeing what all issues you've been running into! That goes for anyone else as well!
                      Last edited by Koderz; 05-23-2016, 12:48 AM.
                      Runtime Mesh Component - The best way to render procedural/runtime created meshes! - Version 3.0 Out Now!

                      Comment


                        #12
                        Originally posted by Koderz View Post
                        Hey SiggiG, I've been working on some serious updates to the PMC and would be interested in seeing what all issues you've been running into! That goes for anyone else as well!
                        I would love to hear what you have planned! I've been thinking about writing my own version of it, or going a completely different route.

                        What's been bothering me lately:
                        • The variables holding the generated data (mesh sections) aren't marked as Transient. So if you offer editor support (not just generate on BeginPLay), all the mesh data is saved along with your map. I got around this by making the whole component Transient, causing issues with transforms among others.
                        • No easy way to update mesh data once generated, so currently I need to re-create the mesh on every frame. We need a way to set a mesh as static (once generated) or dynamic. Perhaps allow updating the Vertices buffer, as long as length and indexes remain the same?
                        • A way to export the meshes to static mesh assets. Antidamage posted a way to do this I plan on utilizing once I need it.
                        • Using tasks/threading for mesh creation.
                        Programmer at Klang Games | Ex-CCP (EVE Valkyrie / Sparc) | @SiggiGG
                        Check out my procedural mesh examples

                        Comment


                          #13
                          Originally posted by SiggiG View Post
                          I would love to hear what you have planned! I've been thinking about writing my own version of it, or going a completely different route.

                          What's been bothering me lately:
                          • The variables holding the generated data (mesh sections) aren't marked as Transient. So if you offer editor support (not just generate on BeginPLay), all the mesh data is saved along with your map. I got around this by making the whole component Transient, causing issues with transforms among others.
                          • No easy way to update mesh data once generated, so currently I need to re-create the mesh on every frame. We need a way to set a mesh as static (once generated) or dynamic. Perhaps allow updating the Vertices buffer, as long as length and indexes remain the same?
                          • A way to export the meshes to static mesh assets. Antidamage posted a way to do this I plan on utilizing once I need it.
                          • Using tasks/threading for mesh creation.


                          Well, if you're interested, I'm in the Unreal Slack much of the day almost every day. (I'm in Eastern US, so not sure what timezone you're in)

                          You pretty much listed some of the same things that bug me. The only one I hadn't thought of was the mesh data getting saved, but I can probably solve that. I have far faster updates already done, as well as generally better render performance, and a few other things. I planned on supporting static mesh -> PMC, but not sure about the other way around.
                          Runtime Mesh Component - The best way to render procedural/runtime created meshes! - Version 3.0 Out Now!

                          Comment


                            #14
                            I've updated all the examples using Koderz's excellent RuntimeMeshComponent plugin. This is more efficient and faster than the UE4 ProceduralMeshComponent.

                            Awesome work Koderz, keep it up!
                            Programmer at Klang Games | Ex-CCP (EVE Valkyrie / Sparc) | @SiggiGG
                            Check out my procedural mesh examples

                            Comment


                              #15
                              Hey SiggiG I have trouble getting the plugin to load with 12.5 ...says the plugin was made with a different version of the engine and it wont rebuild for me!

                              Comment

                              Working...
                              X