WaterMaterial not animating

I’m building a framework inspired by a-frame but wrapped around babylonjs and I’m working on a water tag (just drop a <b-water> tag into your <b-3d> tag and you get water).

I’m basing it on the linked playground but I notice:

  1. None of the examples seem to have working wave animations (it looks like there’s a vertex-shader for displacing the water but it’s stuck. I don’t actually care so much about this because without a LOT of vertices this effect looks cheesy AF.

  2. When I imitate the code, my water is completely static. I’ve tried messing with windForce, windDirection, etc. but the ripples just don’t move.

I’m using 5.34 same as the PG.

Very frustrating since the scene LOOKS phenomenal, the water is just “stuck”.

That’s hard to diagnose without a repro as it is working in the Playground.

Are you setting up a render loop on the engine and calling scene.render()? If yes, I don’t see why it would not work becase the time is updated in WaterMaterial.bindForSubMesh, which is called each time the water mesh is rendered.

The wave action seems to be stuck in https://playground.babylonjs.com/#1SLLOJ#20 and all the other examples at Water Material | Babylon.js Documentation.

Thanks for your quick reply.

Yes, I was manually calling scene.render and not using engine.runRenderLoop. Switching to that method works BUT it means I have no control over frame update rate (which I don’t necessarily want to be 90fps or whatever, especially on something like an Oculus Quest).

Anyway, I switched over to using runRenderLoop but skipping scene.render() unless the requisite time has passed and it works.

Thanks again.

1 Like

For me also your PG works. I don’t see anything wrong, it works as it should.
In fact it has always worked like that.
Adjusting the wave height does not make them move.