2: I then want to get the points on that newly created SPLINE MESH as a source/surface to generate STATIC MESHES on top of it. To do this, as I understand it, I use the Copy Points node. This does not work as expected. See screenshot provided. Note I turned on Debug so you can see the prior steps seem fine.
Note: This almost works, but what you’re seeing in the small debug “Copy Points” is that it’s essentially making 4 variants of the newly created SPLINE MESH, but each with weird offsets (why you see a double peak, but offset).
Things I’ve tried 1: I tried switching meshes to several basic ones provided by Epic to ensure it wasn’t a weird mesh error (e.g. Lake Mesh and River Mesh from Water system). I tried making custom meshes in Blender, the error persists regardless of my mesh or Epic’s. That’s why I turned debug on the “Plane Mesh” to ensure nothing strange was going on.
Things I’ve tried 2: I’ve programmatically gotten the Source Mesh (as in the first screen shot with Get Attribute from Point Index), I’ve also tried hard coding it straight into Mesh Sampler. It fails either way. The Mesh referenced is identical at all steps.
Things I’ve tried 3: I’ve played with just about every setting possible on the very minimal nodes in the PCG graph. This includes all the settings in the Copy Points node, changing around from Relative, to Source, to Target. Nothing fixes this.
I’m going crazy, I can’t figure out why it does this, I’ve specifically kept the PCG graph VERY simple to trouble shoot the issue. Help?! Why doesn’t this work??? Thanks!
Try uncheck the Copy Each Source On Every Target? The copies look weird but hard to tell from the pic so not sure. Maybe try a mesh with just a few verts and inspect the attribute data with A key to get better idea what’s going on.
Copy Each Source isn’t the culprit, but switching over to literally the simplest mesh possible (a quad) gave me the big clue so thank you!
I’ll re-write a better answer later if I actually solve it completely, but the core issue is two parts:
Mesh Sampler: I had it on “sample per triangle”. Visualize a quad, those 2 triangles that make up the quad are “offset” which is what gave it that weird staggered, offset appearance. Changing to “sample per vertex” doesn’t make it any better, now you get 4 points that are now equally offset.
Pivot/Origin: Like most meshes, my meshes (and most you’ll ever use) have the pivot/origin is the center. This conflicts with what the spline is doing. The spline does not draw it’s first mesh with it centered. This would lead to the first spline being at a point in space, but the mesh “trailing” behind your first spline point (being centered around it). Rather, the spline “pushes” your first mesh out so that the mesh’s trailing edge starts at the same point as your spline point.
When we go to sample later, b/c of these 2, you’ll get the weird duplicates + offsets. I’ll now play around with those 2 to see if I can make it work. Thanks for getting me on the right track (or at least understanding why it’s happening)!
EDIT: The pivot/origin trick definitely helps. But I think I need to read the point data, and exclude any points that have a greater X value than the very first value read. No idea how to do that, will watch some tutorials and search around.
I think the core issue is there’s no way to actually access the Spline Mesh (or Point Data) the Spawn Spline Mesh creates. The output appears to be Poly LINE Data (not the actual mesh or its points).
In contrast, on a Spawn Static Mesh outputs actual Point Data and since it was never distorted/stretched/warped, the Mesh Sampler works properly.
If anyone has any suggestions on how to actually get the Spline Mesh or it’s Point Data, let me know! I’ve hit a dead end.
Maybe try a Spline Sampler->Projection with your road mesh as projection target. Not sure as it depends on when the spline mesh data gets generated and available for the projection to work.
You may already know this, but any data you have to work with should show in the Attributes Panel. It works in a similar way to debug, use it in a running graph. Press A on a node will show it’s data coming in or out depending on the drop-down selection (You may need to select your running graph instance in the left panel for the data to show). The mesh data will be there if it is available for placing points with, although it may be packed into another attribute column.
Spline projection can of course create a flat projection based on your spline, but that would only work if your Spline Mesh was based on completely flat geometry (e.g. road, river). If your geo has ANY z height at all, this of course doesn’t work.
The core issue is, afaik, there’s no way currently to get the actual mesh (and its points) you create with Spawn Spine Mesh.
What Epic would need to create is the equivalent of Surface Sampler but for Spline Meshes (or support Spline Meshes in Surface Sampler).
If I’m wrong and there IS a way to get the actual procedural geometry created in Spawn Spline Mesh, definitely lmk. But as far as I can determine, there simply ISN’T a way to do this! Which is sad, b/c it limits how useful procedural geometry can actually be.
I meant use the original spline to generate a bunch of sampler points, (then raise them up if needed w an attribute modifier to get above your mesh geometry), then use the projection node to project those down onto the spline mesh.
Again, this depends on when the mesh data is available to the projection sampler.
That doesn’t work from my understanding, because there is no “spline mesh” to project down onto. That’s the core issue, there’s no way to currently get the “spline mesh” at all.
All you’re projecting down onto is the spline (not the spline mesh), because that’s the only data Epic gives you. Perhaps I seriously misunderstand something, but afaik, there’s just no way to get the actual spline mesh or its points. Which is why I’m stuck
I do appreciate the thoughts and suggestion however, lmk if you have a better understanding than I do!
Gotcha. I’m on 5.5 and the Spawn Spline Mesh node doesn’t provide any output so I can’t test that out but I can see your problem. Depending on what you need to scatter there is probably a way to do it, just not directly sampling the mesh. Volume Sampler against a proxy volume mesh distributed along the spline or Surface Sampler might work if you can generate an appropriate surface. You can also resort to BP/C++ node and do raycasts if you need that level of control.