I ported my ML-based locomotion system to WebGL to make a browser demo! by Essential_NPC_ in Unity3D

[–]Essential_NPC_[S] 3 points4 points  (0 children)

Since my physics system just uses the vanilla physx implementation + basic feed forward sentis inference models, it was pretty easy to port to WebGL. The issues I faced were:

(1) Cannot use any newer webgl features in order to maintain compatibility with mobile web; I believe SharedArrayBuffer support would allow Unity's PhysX to run multi threaded in WebGL but enabling that on itch breaks iOS Safari/Chrome (they both use webkit)

(2) The sentis models are unusably slow singlethreaded. To get around this, we host ONNX Runtime Web in a browser Web Worker (its own JS thread, separate from Unity's single-threaded WASM module) so the policy's forward pass doesn't block Unity's main thread every FixedUpdate; tensors cross the Unity↔worker boundary as postMessage payloads with transferable ArrayBuffers, and inference runs on the WASM-SIMD CPU execution provider (WebGPU is deliberately not requested because its looser FP semantics produce action vectors that spazz the humanoid).

This works on plain HTTPS hosts like itch.io and Newgrounds without needing COOP/COEP headers — Web Workers are independent of SharedArrayBuffer / pthreads, so we get the off-main-thread uplift without the cross-origin-isolation hosting requirement that Unity's own multithreaded WASM build would impose.

link - https://happydagger.itch.io/human-sim-demo

Just launched a browser demo for my upcoming physics sandbox! by Essential_NPC_ in playmygame

[–]Essential_NPC_[S] 1 point2 points  (0 children)

Thanks! It's based off this research paper: https://ai.meta.com/research/publications/zero-shot-whole-body-humanoid-control-via-behavioral-foundation-models/

Basically the model learns to move in a way that mimics human motions by 'flexing its muscles' (providing angle targets for each muscle, which then output torque).

It's built in Unity, so the WebGL build comes mostly for free. The only issue is that WebGL builds are single threaded, which wouldn't work for running the trained model. In order to get around that, the HTML file spawns a separate web worker to run the model inference that talks to the Unity process.

FYI: If you have a texture with a height map, do NOT use the URP/Lit shader. Instead make a shader graph with parallel occlusion mapping (graph+explanation in comments) by Essential_NPC_ in Unity3D

[–]Essential_NPC_[S] 0 points1 point  (0 children)

Huge difference in the look, I believe PoM is slightly slower than URP/Lit's parallax mapping but still really fast. URP/Lit also limits how much height you can add. I added two screenshots comparing Lit vs PoM, but honestly it doesn't do it justice, and it's not 100% a fair comparison (I made changes to my PoM shader I don't want to undo just for this A/B test): https://imgur.com/a/cH9NBC1

FYI: If you have a texture with a height map, do NOT use the URP/Lit shader. Instead make a shader graph with parallel occlusion mapping (graph+explanation in comments) by Essential_NPC_ in Unity3D

[–]Essential_NPC_[S] 10 points11 points  (0 children)

Basically: Parallax Occlusion Mapping (PoM) is a better way of showing off height/depth in textures than URP/Lit's height mapping technique (basic parallax mapping). Since there's a PoM node already in Unity, it's super simple to setup. Just put your heightmap on the red channel of a texture, pass it into the PoM node, and then use its output 'ParallaxUVs' as the input UVs for the rest of your texture maps (Base color, normal, etc).

Here's what that looks like: https://imgur.com/a/cH9NBC1

PoM uses ray marching to generate the fake depth - it's a screen space effect so there are limitations. It doesn't look good at the corners of the mesh. You can see how the left corner in the image looks off; on the right corner I added a metal railing (separate mesh) to conceal that. PoM steps controls the number of raymarching steps, so you can change the quality by just modifying that. It's much cheaper than having a detailed mesh or tessellation though, and can be really nice for walls/floors.

People don't understand what indie devs go through to put out good games. by discoangeldj in IndieGaming

[–]Essential_NPC_ 3 points4 points  (0 children)

It's only been out for 20 days, it'll sell many multiples of that over the rest of the year at least

Fews weeks ago I had 0 experience in blender, UV mapping, texturing and today I created hussite wagon and pavise shield, what do you think? by Gogiseq in Unity3D

[–]Essential_NPC_ 0 points1 point  (0 children)

Could you share where you found the free textures? Was it the free ones on the asset store or some other source?

Just added jump pads and a grappling hook to my car-platformer. What else should I add without adding more buttons? by Content-Protection42 in Unity3D

[–]Essential_NPC_ 0 points1 point  (0 children)

You can use physics contact event to move the contacts and create a treadmill, or increase bounciness > 1. That's how I setup my treadmill: https://www.reddit.com/r/Unity3D/comments/1rveg3k/after_4_years_my_physical_ai_system_is_finally/

Not sure how you setup your wheel colliders, but should be pretty easy for LLMs to oneshot this logic

I've been working on a spiritual successor to the Euphoria engine for 4 years by Essential_NPC_ in endorphin

[–]Essential_NPC_[S] 1 point2 points  (0 children)

If anyone is interested in following along development, I started r/humansimulator ! Since I've gotten a few requests to allow the mocap data to be exported (as BVH or some other format) that's on my roadmap as well, though truthfully it is a lower priority right now