How can I Access the base polygon data of a mesh?

Hi,

We are evaluating using UE4 as an interim tool in a larger pipeline. One of the requirements is that we need to be able to export the scene out of the editor at some stage, so I am looking into how much work it would be to write an editor plugin that will essentially traverse the scene graph and export the meshes to one of more hierarchical alembic archives.

Now I am still learning, but my initial impression is I would need to iterate over all Actors, and get there mesh components, such as StaticMesh. From there I would imagine there would be a way to get at the base polygon data, IE vertices, triangles, etc, but I can’t seem to figure that out.

UStaticMesh does have a method for getting vertices, but that doesn’t seem to be intended for this purpose, nor does it appear to give any information necessary to reconstruct the actual tri’s.

Wanted to loop back to this as it is still an open question and something my current company is really keen on figuring out. The new world creation tools in 4.8 are nothing short of amazing and exactly what we are looking for, but it all hinges on the ability to be able to say “Here is a world I have created in the editor, now export it all to Alembic files on disk so it can move through the rest of the pipeline”.

To provide more clarity here, what we want to do is use the Editor for creating our environments, everything from placing static meshes, to procedural foliage, terrain, and more. Also using Blueprint to do procedural creation of geometry.

Basically all the things you do in the Editor to create a level.

But then instead or building a game from that, we want to export the “scene” from the editor, to a standard format on disk like Alembic. All the static meshes, all the procedurally generated content, all the foliage, terrain, etc. We want to export it all out with transform information and everything, so that we could then take that and render it in a standard offline renderer like PRMan or VRay, and do additional work on the assets in applications like Maya and Houdini. In other words, make the editor just one step in an overall VFX pipeline.

Now obviously this is going to require custom development by us, and we fully understand that. Just looking for some guidance on how to go about doing that, the best way to get the data we need, the best practices for doing so.

We do have some support for this at the moment. If you select a set of Actors and then choose File->Export Selected, you can choose to export to FBX or OBJ. If you use FBX, you can look at the FFbxExporter::ExportLevelMesh function to see what it exports - it should handle meshes, BSP, landscape, lights, cameras etc. It does not currently handle things like ProceduralMeshComponents though. Because that feature is implemented as a plugin, we would need a slightly more flexible system to support exporting, though that does sound like a good idea.

. This is even better than I thought! This should work for foliage as well then since that is just scattering StaticMesh actors right?

So what about procedural meshes. For example we want to do things like using BP setup SplineMeshes to do things like procedural roads and stuff. Sounds like something we would need to add support for, so can you suggest where we might look to get started on that? Or since you said it sounds like a good idea, is this maybe something that you guys could implement a lot easier than us?

Foliage actually uses instancing by using an InstancedStaticMeshComponent, so I’m not sure that will work automatically right now. You’ll need to take a look at how foliage is added to the level and possibly add some additional support.

To extend support right now, you’d need to edit (or duplicate-and-edit) that function I mentioned to look for different things (like foliage and spline meshes) and then extract poly data. Hopefully looking at the existing code will give some good indications of how to do that.