Hair Simulation WebGPU

Amazing! :two_hearts: Bookmarked…

2 Likes

Thanks for all the feedback so far, you are all awesome! :heart:

Made some progress towards a releasable modular hair / rope / strand physics engine, allowing various forces and strand properties to be combined across arbitrary meshes (including skinned or moving ones). Here’s a little demo:

bg

I did notice that this breaks on Android Chrome with a hard to pinpoint Instance dropped error in getCompilationInfo which is a shame, I’ll have to fix that before using it in my game.

Note: If you’re curious what the API will be like, check from line 1615 to see how the demo scene is set up.

5 Likes

You rock! :saluting_face:

This stuff is so complicated, it would be a nightmare for most of us to even begin to wrap our heads around what’s going on here. :grinning_face_with_smiling_eyes: You’re a really good programmer! :flexed_biceps: :keyboard: :fire:

There’s an interesting issue with the Playground though. Everything runs smoothly while I’m not interacting with camera or rotating the camera, but as soon as I stop, the FPS drops to 10–12 for a second or two, then returns to the V-sync rate.

My first thought was to set the camera’s inertial values to zero even if it doesn’t make a lot of sense, but that didn’t help. Any ideas?

2 Likes

This stuff is so complicated, it would be a nightmare for most of us to even begin to wrap our heads around what’s going on here. :grinning_face_with_smiling_eyes: You’re a really good programmer! :flexed_biceps: :keyboard: :fire:

Thanks! I am often struggling to keep the motivation (for my bigger game) because it’s very tiring, after the initial ideas, to try to bring several little systems (rope physics being just one of them) into a game and with an extensible design. But releasing little pieces at a time as playgrounds gives a feeling of completion which is nice, to just take a pause and get feedback. And that the bits and pieces might help / inspire others even if the game never makes it. Open communities are so cool!

I see the lag that you mention whenever I move objects rapidly :thinking: but not sure I can repro when just moving the camera. I’m not sure why either would happen, because the camera isn’t even tied in at all to the physics shader, and there is a constant number of iterations for the verlet integration + no culling, so I’d expect similar times every frame. :thinking:

I’ll think about it when I’m working on this more, maybe a reason will surface.

Would be happy btw for anyone to check these playgrounds out in mobile, to see what level of support there is.

EDIT: I think I found the issue! While debugging I was copying over the whole geometry to CPU every frame to spot an issue. Forgot to turn it off afterwards!

This one should have a more constant frame rate:

2 Likes

This happened to me once when I was working on a billing backend for a mobile operator. After fixing a bug (in production env), I forgot to set the debug-mode flag back to false, which effectively disabled the entire caching mechanism for database reads. As a result, there was a massive number of DB queries.

A guy from the IT department called me to say that the billing process had been running for two days straight :grinning_face_with_smiling_eyes:, they were struggling to send out invoices to customers, and even the CEO had gotten involved :laughing:. After I set the flag back to false, the whole process finished in just two hours.

God bless hardcoded const debug = true/false statements and my lazy ass to use .env files :smiley: ! I never use this debugging approach since then.


The good news is that the latest version of your PG no longer has any issues! Well done! :flexed_biceps: :saluting_face:

iPhone 16 Pro, latest iOS/Safari/WebGPU still experimental. Chrome has not support yet.
Unfortunatelly it’s not working:

1 Like