Attach To Vertex

Plugins Attach To Vertex

Stopper

Invaluable member
Featured Contributor
Messages
359
Reactions
4,541
Points
123
Stopper submitted a new resource:

Attach To Vertex - Attaches an object to a skin/cloth/hair vertex

This plugin sets an object's position to a vertex on a person atom's skin, clothing, or hair.

It needs to load the vertex positions from GPU buffers, which is slow. Expect performance to suffer to some degree (especially if using multiple).


Usage

  1. Add to an atom (e.g. CUA)
  2. Select Person, connection type, and object to connect to
  3. Position using the 'Re-attach to Closest' button.
    1. You can also use the vertex slider, but this cause...

Read more about this resource...
 
Amazing plugin. Is it working with save/load scene ? what with subscene? can i save somehow few cua links to appearence, then load aperance in other scen and load that links along with cuas? (like that plugin to load apearence with cuas i forgot its name) :)
 
Amazing plugin. Is it working with save/load scene ? what with subscene? can i save somehow few cua links to appearence, then load aperance in other scen and load that links along with cuas? (like that plugin to load apearence with cuas i forgot its name) :)
Saving and loading should work, at least with my testing. Linking should as well.

Subscenes are iffy, but give it a shot?
 
Saving and loading should work, at least with my testing. Linking should as well.

Subscenes are iffy, but give it a shot?
Nah, just asking. Better thing would be to save/restore preset with automaticaly adding many cuas :)
 
For Person-Skin-Skin offset and rotation seem to get reset to zero when loading a scene or loading a CUA preset. The vertex index is restored, though. Should presets have "Zero Offset on Reattach" disabled to avoid the reset? What position and rotation settings should the CUA have on its Control tab? I currently use the default "On" for both.

Out of curiosity: How is orientation in relation to the vertex determined? I assume its the vertex normal but that only defines one axis.

Expect performance to suffer to some degree (especially if using multiple)
Could that be optimized with a batch-query for all vertices of the same target? I.e. all objects that attach to a person's skin coordinate to issue a single query for their combined set of vertices?
 
For Person-Skin-Skin offset and rotation seem to get reset to zero when loading a scene or loading a CUA preset. The vertex index is restored, though. Should presets have "Zero Offset on Reattach" disabled to avoid the reset? What position and rotation settings should the CUA have on its Control tab? I currently use the default "On" for both.

Out of curiosity: How is orientation in relation to the vertex determined? I assume its the vertex normal but that only defines one axis.


Could that be optimized with a batch-query for all vertices of the same target? I.e. all objects that attach to a person's skin coordinate to issue a single query for their combined set of vertices?
Looks like the the zero offset setting is the culprit, yeah. Unfortunately it looks like saving skin in general is broken. I'll need to fix it later.

I use it with the controller state On. Turning it Off will work too, but you'd likely need to turn off physics or it'll fall. Other settings have weird interactions.

For the orientation, I use the tangent vector as the second axis. I have to calculate it manually since they are not accessible for skin and cloth (and hair just doesn't have them so I use the vector towards the head).

Batching is possible, yeah, but I'd need to make this into a session/scene plugin. I'll likely do this in a later iteration.
 
Am pleased to find that it works with any atom, not just CUAs so I can finally light my model's hair on fire.

 
Stopper updated Attach To Vertex with a new update entry:

Various fixes

  • Will now detect skin switches and re-attach.
    • This also fixes loading from scene
  • The 'zero on attach' option is now default off.
    • Offsets should now persist when loading from scene
  • Code now only fetches the minimal subset of the vertex buffer from the GPU. Should help perf in most cases.

Read the rest of this update entry...
 
Excellent work Stopper! I had a similar project on my notes, I'm glad I don't have to dive into that haha x']

Out of curiosity, is it worth diving into it if I need an attach to work on state changing characters?
In a more direct way, is the attaching system working/refreshing if:
  • The character is changed at runtime through Timeline poses
  • The character is changed at runtime through standard pose preset loading
  • The character is on/offed through scripting at runtime
Thank you in advance!
 
Excellent work Stopper! I had a similar project on my notes, I'm glad I don't have to dive into that haha x']

Out of curiosity, is it worth diving into it if I need an attach to work on state changing characters?
In a more direct way, is the attaching system working/refreshing if:
  • The character is changed at runtime through Timeline poses
  • The character is changed at runtime through standard pose preset loading
  • The character is on/offed through scripting at runtime
Thank you in advance!
I've been holding off a while too, figuring someone would make it eventually. I needed the tech for something else I'm working on though.

Hopefully this covers your questions
  • Character/skin switching should work as of last update. Have not tried across genders, but would theoretically work too.
  • It will follow poses/movement from timeline or other sources
  • Morphs and other deformations (e.g. cloth grab spheres) should all work.
  • On/off appears to work. While off, position doesn't change but will resume while on.
If something isn't working for you, let me know and I can patch it. It's not the cleanest implementation but feel free to use any of it if you end up making something similar.
 
Thanks for the quick fix. I found another weird interaction on scene load when Naturalis is applied to a person. Naturalis does some calibration on load and weirdly the Vertex Index of your plugin changes from what is stored in the save when the attachment is in a body region that is affected by the calibration.

Naturalis.54 (free) is enough to reproduce. I assume vertex indices are fixed for Gen2 based persons, so index 0 (yes, zero) and 10928 can serve as an example.
For my test I have an empty with the vertex attach plugin and a sphere without collisions, scaled to 0.01 and parent-linked to the empty.
 
Don't know if it's feasible, but what about a way to link a specific part of the CUA to the target atom? For example, I was trying to "tie" the tip of these balloons' strings on the ground, to prevent them from going crazy after collisions, but unless I've missed something, there's no such control. I imagine this feature could be very useful for CUAs with physics.
 
Thanks for the quick fix. I found another weird interaction on scene load when Naturalis is applied to a person. Naturalis does some calibration on load and weirdly the Vertex Index of your plugin changes from what is stored in the save when the attachment is in a body region that is affected by the calibration.

Naturalis.54 (free) is enough to reproduce. I assume vertex indices are fixed for Gen2 based persons, so index 0 (yes, zero) and 10928 can serve as an example.
For my test I have an empty with the vertex attach plugin and a sphere without collisions, scaled to 0.01 and parent-linked to the empty.
Interesting. Will take a look.

Don't know if it's feasible, but what about a way to link a specific part of the CUA to the target atom? For example, I was trying to "tie" the tip of these balloons' strings on the ground, to prevent them from going crazy after collisions, but unless I've missed something, there's no such control. I imagine this feature could be very useful for CUAs with physics.
In general, this plugin works poorly with CUA physics. The way I modify the position ignores momentum, for example. What I would recommend is using this to create an Empty that functions as an attachment point, and then parent/physics link a CUA to it.

For attaching specific parts of the CUA, you might need to look at my CUA controllers plugin https://hub.virtamate.com/resources/experimental-cua-xps-controllers.37343/

Unity physics are based off of Rigidbody elements in the object and this plugin adds controllers for those that you can link to other things.
 
I've been holding off a while too, figuring someone would make it eventually. I needed the tech for something else I'm working on though.

Hopefully this covers your questions
  • Character/skin switching should work as of last update. Have not tried across genders, but would theoretically work too.
  • It will follow poses/movement from timeline or other sources
  • Morphs and other deformations (e.g. cloth grab spheres) should all work.
  • On/off appears to work. While off, position doesn't change but will resume while on.
If something isn't working for you, let me know and I can patch it. It's not the cleanest implementation but feel free to use any of it if you end up making something similar.

Thank you very much for the detailed answer!
This should perfectly cover my needs : D

And nope thank you, I generally tend to ensure plugins made by other people are used instead of ripping the code :)
Unless I have a really different use or a more complete plugin it's proposterous to do a simple duplicate and not use the original one. Especially if it's THAT well made!

Thank you again Stopper <3
 
Thank you very much for the detailed answer!
This should perfectly cover my needs : D

And nope thank you, I generally tend to ensure plugins made by other people are used instead of ripping the code :)
Unless I have a really different use or a more complete plugin it's proposterous to do a simple duplicate and not use the original one. Especially if it's THAT well made!

Thank you again Stopper <3
Eh... Many of my plugins tend to be glorified tech demos that are light on features and heavy on bugs, so I'm not territorial about other plugins doing similar things. Everything I've got is cc-by and fair game. Ping me on discord and I'll help you plug it into whatever you're doing. <3
 
Don't know if it's feasible, but what about a way to link a specific part of the CUA to the target atom? For example, I was trying to "tie" the tip of these balloons' strings on the ground, to prevent them from going crazy after collisions, but unless I've missed something, there's no such control. I imagine this feature could be very useful for CUAs with physics.
Another way to maybe make this work would by daisy-chaining. Add the CUA to a scene, then add an Misc>Empty to the scene, and move it to the spot on the CUA you want to link, parent the Empty atom, then use the plugin on the Empty atom to link it to the vertex.

I've never tried that with this specific plugin, but I've used this method of parenting a CUA to an Empty atom for the sake of controlling it from a different point than the default one for the CUA(especially useful for CUAs for characters that are heavily displaced from their control nodes)
 
Hey Stopper!

Wonderful plugin :)
I'm currently stress testing it to see how much you can use, but for a couple attachments, it works fairly well without much perfs impacts!

Side note: I got stucked for about 10 minutes not understanding why the attachment was going everywhere at first. I realized through your video afterwards, that you had the "zero offset when...".

It's gonna be a breaking change to enable that by default, but I think you could add a text mention above/below that to make people understand that you actually need that checkbox for the first attachment :3
 
Hey Stopper!

Wonderful plugin :)
I'm currently stress testing it to see how much you can use, but for a couple attachments, it works fairly well without much perfs impacts!

Side note: I got stucked for about 10 minutes not understanding why the attachment was going everywhere at first. I realized through your video afterwards, that you had the "zero offset when...".

It's gonna be a breaking change to enable that by default, but I think you could add a text mention above/below that to make people understand that you actually need that checkbox for the first attachment :3
Good call... It was causing issues during scene load so I made it default off (and not storable), but there's probably a more user-friendly solution.

Glad you're enjoying it otherwise!
 
I found another weird interaction on scene load when Naturalis is applied to a person. Naturalis does some calibration on load and weirdly the Vertex Index of your plugin changes from what is stored in the save when the attachment is in a body region that is affected by the calibration.
I got annoyed enough by this to dig into the plugin code (and VAM's API, so I might misunderstand stuff). I think there are two problems:

The first is that vertexIndex is created with min=max=0 and constrain=true which I understand means it cannot restore to anything but zero. I think it should be constrain=false. That could be be changed after creation but why bother for constraints that change with the target (that might also be semi-valid like the skin of a person with a different name)? I think a better tactic would be to check bounds before using the vertexIndex and simply skip updating the atom's transform when that check fails.

Also, the Connect(Skin|Cloth|Hair) coroutines all call AttachToClosest which will always overwrite vertexIndex. Attaching while connecting only works when nothing moves until the coroutine gets its turn. That obviously is not a safe bet with Naturalis so I think the Connect* methods simply should not also attach. The added benefit is that it should also work for situations where the attached atom is definitely out of place like loading from a subscene.
 
Last edited:
I got annoyed enough by this to dig into the plugin code (and VAM's API, so I might misunderstand stuff). I think there are two problems:

The first is that vertexIndex is created with min=max=0 and constrain=true which I understand means it cannot restore to anything but zero. I think it should be constrain=false. That could be be changed after creation but why bother for constraints that change with the target (that might also be semi-valid like the skin of a person with a different name)? I think a better tactic would be to check bounds before using the vertexIndex and simply skip updating the atom's transform when that check fails.

Also, the Connect(Skin|Cloth|Hair) coroutines all call AttachToClosest which will always overwrite vertexIndex. Attaching while connecting only works when nothing moves until the coroutine gets its turn. That obviously is not a safe bet with Naturalis so I think the Connect* methods simply should not also attach. The added benefit is that it should also work for situations where the attached atom is definitely out of place like loading from a subscene.
Thanks for flagging. Sorry it took me a while to get to it but let me know if it works for you in the latest version.
 
I've been experimenting with wet clothing textures. I found that if you duplicate a hair as clothing item, you could then replace all the textures with wet textures and it will then become like a wet texture wrap around the hair to give a wet hair look. One problem I've had though is on hair that moves like the ponytail on Hairstyle 9 the wet texture slides off to the side. I was trying to pin it to the ponytail with the AttachToVertex plugin but it doesn't seem to be working.

This is from Hairstyle 9. It's 9A 4 for the ponytail and 9B 4 for the wet texture on the ponytail.


This is Moving Day with Ariadne just to test it out...

Ponytail-Wet-Texture-1.png


What I did was created an empty atom for Ponytail Tip and set it to to the tip with the plugin. Then created one for Wet Tip and with the plugin set it on the wet texture tip. I then linked those atoms together with Link To Atom and Link to object. But when the animation starts they don't stay together. I tried parentholdlink by @MacGruber as well but they didn't stay together.

Hair Connect - Wet Tip
Linked to 9B 4 (wet texture)
Vertex Index adjusted towards tip at around 1060.



Hair Connect - Wet Tip Plugin Settings.jpg

Hair Connect - Wet Tip.jpg


.............................................................................................
Hair Connect - Ponytail Tip
Linked to 9A 4 (ponytail hair)
Vertex Index adjusted towards tip at around 1060.



Hair Connect - Ponytail Tip Plugin Settings.jpg


Hair Connect - Ponytail Tip.jpg


Anyone here have any ideas on a solution? Is this something you think the plugin can do? Maybe I have something off in my settings.
 
Last edited:
Back
Top Bottom