Generate Procedural Mesh

[=JamesG;282933]
I just wanted to give an update on something I have been working on for 4.8. Way more people than expected were using the CustomMeshComponent - it was only intended as an example of creating geometry! Anyway, there is clearly a lot of interest in creating geometry using Blueprints, so I’ve added a new ProceduralMeshComponent. This has a very different API, and some new features. I tried to just add features to CMC, but it just wasn’t feasible whilst still maintaining backwards compat. The new API is based on arrays of positions, indices, normals etc, rather than an array of ‘triangle’ structs. I’ve also added a new ProcMesh library of useful functions, and tried to keep the component fairly simple. The big new features are collision support, vertex UVs and colors, and automatic normal/tangent generation. Here is a screenshot of what it looks like in BP:


[/]

Hi ,

I’ve had a look at the new ProceduralMeshComponent you’ve made. One question I have is do you think it would be better to structure things to use a struct of arrays rather than an array of structs? The way it currently is all the data for each vertex is bound together with a struct.

One thing I’m doing with my game is updating the vertex colors each frame. I hacked this together in the old version but for compatibility it would be good to refactor everything into the engine version.

The problem with the way it’s implemented is there’s no quick way to update the vertex colours. What I’d have to do is loop through all the vertices structs and update the color for each one. If it used a more data oriented approach keeping an arrays of everything in the section struct I could just replace the color array each frame which would be much more efficient than looping through all the vertices.

Please let me know what you think. If the engine version won’t be implemented this way I’ll probably have to stick to my version.