Unreal Engine how can we achieve soft Skin Physics in Unreal Engine

mikeblack

Newbie
Oct 10, 2017
35
31
It ain't that hard to get accurate location, i've done it before here, it's not exactly an elegant solution though but I imagine yuo must be doing something relatively similar. It's not without it's problems though, i think if I revisited this I would try to move the semen projectile from the niagara emitter to being just a normal physical mesh because the niagara collisions tend not to be very reliable, especially for gpu particles., i think for the regular collision approach on gpu particles thhey only collide if they are rendered, and they only render if they are not obscured by anything (such as the mesh or even another particle)

It is a problem I could solve with scratch, but I think just moving the projectile itself to a blueprint actor and forwarding it's collision & position data to the niagara emitter would be simpler at the end of the day.

It's also possible to use CPU particles for the projectile, but to forward data from CPU particles to GPU particles the only way i know is to send the data from the cpu particle to a blueprint actor and then send it back from the blueprint actor to the GPU particle emitter which is a mite convoluted.
Interesting so you spawn particles for all triangles and check how close they are to get the one with the correct triangle id. I'm trying to do the same just without the spawn a particle for every tirangle part. With a roundtrip to blueprint to figure out the triangle id of the hit there and pass it back to niagara.

Looks like it has potential. I use plugin to handle any kind of data retrieval when tracing against a skeletal mesh. Can get the hit UVs, triangle, vertex position etc. It's super handy.
Looks useful. Will try to get the triangle id of the hit with it.
 
  • Like
Reactions: Velomous

Velomous

Member
Jan 14, 2024
290
281
Interesting so you spawn particles for all triangles and check how close they are to get the one with the correct triangle id. I'm trying to do the same just without the spawn a particle for every tirangle part. With a roundtrip to blueprint to figure out the triangle id of the hit there and pass it back to niagara.
Yeah, like I said, not elegant. Do let me know if you figure it out!
 

mikeblack

Newbie
Oct 10, 2017
35
31
Do let me know if you figure it out!
It works with the vertex plugin but has it's own downsides with my current implementation.
Preparation - create mapping from vertex index to triangle index:
1. In Niagara spawn a particle for each triangle location of the skeletal mesh (like in your setup).
2. Send all triangle positions + indexes to blueprint (had to limit here how many it sends at one time due to engine restrictions of around 32k active events).
3. Use vertex paint plugin "Get Closest Vertex Data on Mesh" function. Either can have it find the closest vertex for each triangle position one at a time or use it to get all vertex positions directly and do a manual closest distance matching. For each vertex index save the index of the closest triangle in a array.
4. Save the array to file.

Actual use:
1. Load the file to array being a mapping of vertex index to index of closest triangle.
2. Spawn collider.
3. On collision event run "Get Closest Vertex Data on Mesh" to receive closest vertex index.
4. With the array from step 1 map it to it's matching triangle index.
5. Send triangle index to Niagara for effect.

Downsides:
1. Looses some precision. The vertex count is around half of the triangles so mapping from vertex won't give the exact triangle at hit location.

Vertex res:
PositionsVertexBased.JPG
Triangle res:
PositionsNiagaraTriangleBased.JPG
2. The roundtrip takes quite a bit time.
Niagara CPU hit event to blueprint->blueprint closest vertex check until event->send back to Niagara GPU
has a visible delay. Not so much regarding performance as it runs via events but each step does add a bit delay until events are received. The closest vertex check also says it takes around 25ms. It all adds up creating a visible delay.
Didn't try much optimization yet. Like the closest vertex check would allow to pass the bone of the hit to improve performance there which I didn't use.

VertexDelay.gif
 
Last edited: