Hmm, yeah, I couldn’t find it either, though it seems kinda strange to me, that FColor isn’t exposed to BP.
However, it should work if you create a C++ Blueprint Callable Function that takes in a TArray of FLinearColor and returns a TArray of FColor and simply converts one to the other. FLinearColor even seems to have a “ToFColor” function. That way you could create your color array procedurally in BP, convert it and then pass it into CreateMeshSection; although that would add the overhead of converting each FLinearColor. If you get performance problems you might then think about creating the colors completely in C++.
Ok good, so it’s not just me. Odd indeed, although the devs are probably aware of it but it’s probably not a priority or something. Really wish they’d expose it, especially since it’s the only way to add verrtex colors in blueprint right now. Custom C++ stuff is a bit over my abilty at the moment, I’ll eventually have to get into it though. Thanks for the help!
Hello, I’m new to procedural meshes and have a Problem.
Everytime I try to build a mesh the normals are facing inwards, how can i fix this ?
Take your list of triangles, then for every 2nd and 3rd entry, swap them to reverse the winding, eg:
for (int i = 0; i < Triangles.Num(); i += 3) {
Triangles.Swap(i + 1, i + 2);
}
From memory that’s how swap works.
Hi! 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 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 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. Thanks!
Thank you .
Another question.
I’m building a field of x/y cubes with for oops but of course the time is rising expotentially. A field of 150x150 cubes takes ~30-45 seconds to build.
Is there a faster way than for loops ?
If you’re hitting performance bottlenecks, first move all logic into C++; you’ll still do for-loops but they execute lightning fast in C++.
Next is to work out if you need everything that you currently use, and everything that ‘CreateMeshSection()’ does. Perhaps you should pass in empty vertex colors if you don’t use them to avoid copying data that’s not required. How are you calculating tangents? That step may be quite slow, and can be approximated if you don’t need perfect accuracy.
Hey all, hope someone can help, having trouble with the ProceduralMeshComponent. Consider the vertices laid out as below.
5==4==3
| | |
2==1==0
I’m setting triangles TArray in this order:
3,0,1
3,1,4
4,1,2
4,2,5
Should/can this work? I have the component all working fine if I create 6 separate vertices for each quad, but I thought I’d be better off cutting down the verts with this approach.
EDIT: here’s a couple of screens of the data and output. I only see one triangle on screen (ignore the others, they are different components).
It should work – you certainly don’t want to load the same vertex multiple times.
What call do you make to send your data to ProceduralMeshComponent?
Ah, you have made me realise the problem…the code I was looking at was executing at the point I update the mesh. When I initially created the mesh I hadn’t set the triangles yet (oops). Classic case of not seeing the wood for the trees, this is why you share your coding problems, thanks
I’m trying to add second UV as well. (to pass some data) Anyone is able to share some light?
[=intoxicat3;490419]
I’m trying to add second UV as well. (to pass some data) Anyone is able to share some light?
[/]
At the moment you’ll be needing to use CasperJeff’s modifications from here, or do something similar yourself.
[=mid_gen;491172]
At the moment you’ll be needing to use CasperJeff’s modifications from here, or do something similar yourself.
[/]
How do you go about accessing that repo?
[=mflux;492802]
How do you go about accessing that repo?
[/]
You need to link your UnrealEngine.com account to your account. #GitHub_Account
[=mid_gen;492945]
You need to link your UnrealEngine.com account to your account. #GitHub_Account
[/]
Wonderful thank you!
[=casperjeff;370650]
If anyone has an interest, I forked 4.9 release and added support for an additional UV set in ProceduralMeshComponent (also required changes to DynamicMeshBuilder). It’s probably not suitable for a pull request to Epic as I was forced to ‘require’ the additional UV for some unrelated editor based users of DynamicMeshBuilder (there are some overlapping dependencies on the PMC that I wouldn’t have expected)
If you have Epic access, you should be able to see/acquire my changes here: .com/casperjeff/UnrealEngine/tree/proceduralmesh_multi_uvs
I haven’t run across any negative side effects - although its very possible I missed something (first engine tweak for me)
My team is using the additional UVs to pass in custom data to store with the mesh so that we can do some material/shader trickery (change emission settings) based on reading these non-texture based uv values.
Enjoy!
[/]
Hi Casperjeff. Thanks for this branch, it will help me get more details into my procedural meshes!
So far I’ve copied over your changes and recompiled the build. However in Blueprints I still see only one slot for UV (UV0). Are there additional steps to make this change take? Much appreciated.
[=mflux;498329]
Hi Casperjeff. Thanks for this branch, it will help me get more details into my procedural meshes!
So far I’ve copied over your changes and recompiled the build. However in Blueprints I still see only one slot for UV (UV0). Are there additional steps to make this change take? Much appreciated.
[/]
Ah I figured it out. I needed to recompile the entire UE4 build straight off of git.
Any hope this can become a ? Or is this the way it is because it requires modification of DynamicMesh?
You guys know if there’s a way to use a ProceduralMeshComponent as the “model” of a SkeletalMesh ? I’d like to attribute animations and a skeleton to my ProceduralMesh, but I’m stuck. Ideally the best solution would be to start from a SkeletonMesh, and then somehow tell it to use a ProceduralMesh as its model. No idea if that’s a possibility ?
Procedural meshes and the other kinds of meshes have very little in common so that won’t work. They’re entirely different families of classes with totally separate content pipelines.
I’ve built a procedural-to-static converter that works in the editor, presumably it could be made to work for skeletal meshes as well if weighting was added. I’ll look into it when I get some more time.
Alright, I kinda guessed that but figured it wouldn’t hurt to ask nonetheless. In any case, this kind of conversion requires to not be in runtime but rather in the editor where meshes can be cooked, doesn’t it ?