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

Velomous

Member
Jan 14, 2024
140
94
@Velomous
1ms vs 5ms : This Diff is criminal regarding computing time!
Watch the whole video, pure c++ is not 5x faster, it's not even 2x faster. Also keep in mind it's running 1000 for loops doing multiple additions in that amount of time. 5ms is very reasonable, you will struggle to get better results than that with most programming languages.

The crime is pure blueprint taking 454ms to do 500 loops and flat out failing to go all the way to 1000 (probably gives an infinite loop error or something to that effect).

This is reduced to 5ms when the majority of the math operations in the loop is done via c++ instead of blueprint and 1ms when the whole loop is c++.

5ms for a couple thousand math operations is fairly reasonable, you can see it in practice in the video too there isn't even a perceivable stutter till you get up to like 80+ms. You can see at roughly the 1 minute mark, c++ taking 50ms to do 10,000 loops, the stutter is only perceivable if you're actively trying to see it. At 94ms it is the standard kind of stutter you sometimes get in games these days.

Also this was on a very old i7 2600 cpu (I had a pc just about like that i think roughly 15 years ago, had a worse gpu though) the gap would be narrower now both because blueprints has probably improved a bit since then and because we have better cpus, even the low end ones.

I'm kinda tempted to run the same test on my engine to see how it goes. I'm just not ready to start workign with c++ yet, although when i start this will probably be one of the first things i try.

PS: Easiest trick to see how your game on a potato pc is to just disable boost on your cpu and run it on your igpu, if you can play your game at reasonable framerates on it's lowest settings at 1080p under those conditions, it'll run on just about anything.
 
Last edited:
  • Like
Reactions: razfaz

razfaz

Member
Mar 24, 2021
119
151
Velomous
I admit that I haven't looked into that vid that deeply, am a lazy individual.

But, You got me hooked with your inspiring short essay. This may be a fascinating topic!
It reminds me of the good old days when memory and computing operations were limited.

Now we are talking.

PS: Need some time before answer, bc it's gettin' late here and I'm sleepy.
How ever, I really luv Your food for thought and it is very refreshing+exciting!
Thx.
 
Last edited:

razfaz

Member
Mar 24, 2021
119
151
The journey of related topics was educational and exciting, but we (unfortunately) still have to work on the main topic "Soft-Bodies".

On my different lazy research paths I came across the following Tube (maybe helpful) I must share, the Guy has so few views and is the worst narrator (in fact he's one of the worst I was forced to listen to), but somehow I liked it on the other hand, because of... I dunno


@_All : There is, sadly, still no easy clicky solution to solve this, we have to jump into the C++ UE hacking path of manipulating the UE Physics-PrimitiveBodies and transforms on runtime I fear.

Note 1) I would prefer a c++ solution in form of a Plugin that alters the BodyInstance (Object) with access to PhysicsAssets-Primitive-components.

Note 2) Watch out, please don't alter PhysicsAssets by brute force, make sure that you "lock" (function) the PhysicsAssets you want to alter before altering!
Just sayin' if you don't wanna have funny things as a result. <- important
 
Last edited:

Velomous

Member
Jan 14, 2024
140
94
I'm just about done with learning the niagara particle system properly (or well, to an intermediate level i suppose). Although I just noticed an interesting tidbit.

It is true that skeletal meshes do not support distance fields,but only in a certain sense, they do not generate distance fields, but the materials on them can still be affected by distance fields!

210724-231132.gif
It's configured to turn black when within certain proximity to a distance field. These are the current settings (plugged into basecolor)
24-07-106.png

You don't have permission to view the spoiler content. Log in or register now.

So, if we want tomake it possible for skin to deform based on distance fields we can actually probably still do that by attaching a static mesh to for example the finger bones on another character which can generate distance fields but keep it off the visible spectrum so the camera can't see it.

The only potential issues with the approach i can see are that there would of course be no deformation available for anything that does not generate a distance field (all skeletal meshes would need to be coupled with static ones to generate distance fields so they could affect objects like that) and also the distance fields (at least the global which i'm using here) can't seem to differentiate between distance fields of other objects and the object it's applied to; which means that if you attach distance field generating static meshes to a skeltal mesh that deforms from distance fields, it would normally be affected by the distance fields of the attached objects.

Which means that using it in practice for skeletal mesh to skeletal mesh deformation would be quite complicated.

It might be a bit of a consolation perhaps that no matter if skeletal meshes generated distance fields or not. In order to use distance fields on their materials we would have to disable that distance field generation anyhow because it would affect itself.

It also complicates worn items (clothing a little) you'd have to disable distance fields on them, however it can also be useful since you colud for instance enable distance fields on certain items in order for them to deform the flesh underneath (for instance i imagine it could be quite useful for things like belts and socks)

More info:
You don't have permission to view the spoiler content. Log in or register now.

If we want this effect to be truly accurate though, we'd need to either find a way to force tiny objects to generate distance fields or figure out a way to use .
 
Last edited:
  • Like
Reactions: TheExordick