2
\$\begingroup\$

How can I have multiple UV coordinates per vertex in a Procedural Mesh Component? My goal is to create a UV editor.

I know it is possible to generate multiple vertices per corner, as in UKismetProceduralMeshLibrary::GenerateBoxMesh but that's 24 vertices instead of 8 for a simple box. Would this be a performance problem?

I know that FRawMesh (used when importing an FBX into a static mesh) contains multiple UVs per "wedge" (properties stored for each corner of each face). But I don't know how to set or create the equivalent in custom mesh component (except by duplicating vertices).

I know that casperjeff modified the Procedural Mesh Component plugin to add an additional UV set (as he explains here), but I don't really know how to make one UV set correspond to one face.

I am looking for an efficient solution in terms of performances.

\$\endgroup\$
3
\$\begingroup\$

The only possibilty you have is to add the vertex twice, if no collision is generated, this will have almost no performance impact, if you do want collision, subclass the UProceduralmeshComponent yourself and override GetPhysicsTriMeshData to fill the collision array with non-duplicated vertices

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Thanks! This is what I decided to do. The number of vertex will be multiplied by three/four (most vertices belong to four faces), you think it will not impact performances? Anyway this is not a big problem since it will be possible to convert those meshes into static meshes, but I'm curious. \$\endgroup\$ – arthur.sw Apr 24 '16 at 9:22
  • 1
    \$\begingroup\$ It will affect performance but not noticeable, it took less than 1ms with almost 2048 vertices i think \$\endgroup\$ – Maxim DC Apr 24 '16 at 9:41
  • \$\begingroup\$ +1 Fond memories of making my first cube with hard edges and materials per-face =) With hardware this past decade vertex count is hardly ever a cause for concern compared to other things going on. \$\endgroup\$ – Patrick Hughes Apr 24 '16 at 18:58
  • \$\begingroup\$ I'm creating a cube voxelgame and with procedural, i can optimize to only draw the faces that are touching a non-solid block, but stil resulting in 500 faces on averege per chunk, with 800 chunks, my game is still running smooth \$\endgroup\$ – Maxim DC Apr 24 '16 at 19:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.