Another take on instanced fences - advice desired!

Hey, guys!

I asked about this thing before, but I think I explained it all wrong. So I prepared a new sample with the issue introduced properly this time.

The issue is that I’d like to create an array of fence prop that could be later on dissected to individual props outside of that array, without any deformation and with correct position and rotation for each of those fence links.

fence_dilema.blend (420.1 KB)

Left - standard array, but everything is one chunk and deformed

Right - used instanced original fence prop, but this way none of links clip to each other, creating noticeable gaps in between.

Bottom - manually placed, individual fence props. Since it was done by hand, it’s not precise, but it should demonstrate something of a desirable result I want to archive with curves instead.

If anyone could help me to figure this out, I’d very much appreciate it! Thank you!

Geonodes?

Hope that helps.

Or maybe this? It uses edges rather than vertices to instance fence segments. Seems to behave better on sharp turns:

But I’ve no idea if it can be actually turned into separate objects with their own transforms :thinking: Feels like it should, but… :person_shrugging:

Thanks, @AlphaChannel, for showing Resample Curve and Align Euler :slight_smile:

Heres another method to avoid any gaps!

Hope that helps.

That looks great! Would that be an option to somehow dissected it into individual links? So not one “Plane”, but several pieces created from this one, each with it’s own original position and rotation?

Thank you for that sent file!

I’d love to be able to set a custom object instead and this still deforms the whole thing in the end.

Hi!

This is great and looks like what I’m looking for!

My problem is, when I try to replicate it, it created tiny gaps, unlike in your screenshot. Would you know what’s up with that?

And then there’s that prop dividing issue I created this topic for. :frowning:

test_rail_2.blend (135.3 KB)

Since the length of the curve cannot be divided by segments evenly (unless you scale the segments), that creates gaps. The “offset” input value was meant to (crudely) adjust the division of the curve and hopefully close the gaps… I didn’t think it through, to be honest, there is probably a better way to do this.

Also in this case the fence segment was meant to have it’s origin point in the middle of its X-dimension.

The array example file (just in case anyone might find it useful):
gn_InstanceArray.blend (565.5 KB)

The problem is making the instances real, which the whole point, as you said… and this one really bugs me. The information about all these new Origins is there. Blender can see it. So it should be possible to separate them… in theory. But I’ve no idea how to actually do that :smiling_face_with_tear:

UPD. Actually, I think I’ve got it. Just need some time to work out a couple of issues.

Well, now I feel silly, the “issues” turned out to be not an issue at all. I just made things too complicated (though I did learn a lot about GeoNodes since last time).
I’ve changed “segment count”: there’ll still be some gaps (until some more advanced idea can be applied), but it’s simple and you can use several splines in one curve now. Just add them with Draw Tool, yay!

Anyway, while “Make Instances Real” operation does something weird to Curve Object - it instances curves - if we apply the modifier to Fence segment object instead, it works (inelegantly, but works).

gn_InstanceArray_fromMesh.blend (632.9 KB)

So, to the main point. Once the fence is done:

  • select the mesh object with the modifier;
  • go to Object > Apply > Make Instances Real;
  • it will make duplicates of those instances (all Linked). They are selected (except Active object is still the original one, so you need to change that), so you can easily move them to a new collection or something. Don’t lose the selection for now;
  • they all will have the GeoNode Mod on them, so to remove that: remove it from Active Object, then Object > Link > Copy Modifiers or Ctrl+L (it will copy the lack of modifiers to selected objects as well);
  • and that’s it, I think. You should have a bunch of new objects.

Please, tell me if there’s an issue in this workflow I might have missed.

Looks like you got it! Thank you very much!

The only thing that would make it flawless would be ability to set an offset again, like in your previous one. :slight_smile:

But this is already something I can work with, so thank you!

Glad to help!

Easy enough to change back - just add a Math Node before Resample Curve’s Length input:


Not sure if it’s a good approach though, so I excluded it until a better way presents itself.

Thanks!

I figured why I even need that offset in the first place.

I work with already predefined in-game props imported in Blender and for that reason, I don’t want to edit them. Only to use them as a reference to get 3D displacement data for meta/map files quicker.

I see the difference between your arrow model and my prop is that my fence link has it’s origin at the left side of itself, making those ugly gaps in the array. Technically, for the Blender, the simplest solution is to move the origin to the center on the prop. But that wouldn’t work for my precise in-game positioning purpose.

Could you think of the way how to overcome this? :slight_smile:

unknown_2022.08.27-15.54_2

You can move it right in the GeoNodes.
Right now points are spawned right in the middle of the edges

Take the vector Attribute from Capture Attribute node we have present, it’s “edge direction” information (and “length” as well).
Divide it in half with Scale.
Subtract it from Position (which in this case is edge/point position).
Plug into “Position” input of Mesh to Points node.
image

All it does is slides the spawn points along the edges to the “start” positions

I don’t think I’m doing it right :frowning:

test_rail_3.blend (143.5 KB)

While we’re at it, how could I set it up so it would ignore certain angles, as seen on this wall on the hill?

I’m afraid not right =)

That ^^^

I can tell you that Attribute coming from Capture Attribute node might be (part of) the answer.
It’s just a Vector from one point of the curve to the next. Once it goes through “Align to Euler” it’s used here to set the rotation of the fence segment. Y-axis is the component responsible for the rotation you need. You can probably make it ignore this rotation completely (assign 0 value to it), or clamp it to certain angles.
However… the length of each curve segment would still be unaffected and it will cause overlaps with neighboring fence segments (the steeper the angle, the worse is overlap).

For full use with 3D curve it probably would require a serious re-design of this node tree :thinking:

A simple idea (a destructive option) is to do the instances with a 2D curve then snap them to surface somehow, once they are real.

Sorry to bother again, but could you possible tweak it so it created doubled/mirrored instanced on one axis? To demonstrate this idea better, let’s think of lights inside wide vehicle tunnel :slight_smile:

I’m afraid it’ll take a bit more than a tweak :thinking: Making doubles is easy (instead of original mesh we can instance short Mesh Lines perpendicular to curve, and on those vertices we can instance the copies), but how to rotate them properly? It’s a mystery for another time, I’m sorry to say - it’s a bit bigger project that I’m ready to take on at this time (besides being geonode noob myself). Sorry :sweat_smile:

Pretty sure it’s a relatively trivial task now that we know for sure that instances can be extracted. I suggest you really learn the nodes so you’d be able to do these adjustments yourself - I can imagine plenty of special cases that would each need different version of this. And a lot of things you might want to have control over.
But at least here’s something to help you maybe? Note the new input values that can be adjusted from the Modifier:
gn_InstanceArray_doubled.blend (613.2 KB)

Well, you pretty much already did it! Thank you!

Yes, learning GeoNodes properly is on my to do list, just for now, I don’t need it extensively yet (apart of what we discussed here).

Thanks again for the examples and the advice!

Hello, again!

I’ve come to revisit your solution here and was wondering how could I make it work, so I could also rotate them alongside the curve as well? But their rotation should be mirrored against each other…

So, let’s say, if we were to rotate them on Z axis towards 90°, they’ll face each other as vice versa.

I’ve checked your node tree, but was unsuccessful. Could you, please, take a look once more?

Use scaling factor 2*(Index%2)-1

Please start a new topic next time.