Node Material animation runs slower than Unity shader graph

Hi there,
I’m trying to move a shader animation from Unity to Babylon Js, I rebuild the shader using Node Material in Babylon, however, I noticed the animation runs a bit slower in babylon than in Unity.

So I made the time node block visible in the editor and notice the time seems slower and irregular as supposed to Unity which you get a nice smooth time in shader graph.

here is the link to the playground. https://playground.babylonjs.com/#R5FKDY#1

is your frequency param the same?

Welcome aboard!

The animation seems quite smooth to me in your Playground…

Could you show what you are seeing in Unity in a .gif or a small video?

In Babylon.js, the time value is in seconds, maybe it’s different in Unity?

So i tested the speed of the animation in BabylonJs and Unity using a photo transmitter on screen, turns out BabylonJs is a slower than real time, I have to apply a 1.67 multiplier.

I’m not sure to understand.

We are normally running at 60fps, which is the frequency of the calls to requestAnimationFrame provided by the browser.

But regardless of the fps, the time parameter is increased by 1 for each passing second (at 60fps, it is increased by 0.016666 each frame)…

2 Likes

@Sandra_Feng indeed the time block is not actual time. It is only a value that goes forward relative to time. The relation is here Babylon.js/inputBlock.ts at master · sebavan/Babylon.js · GitHub

basically it updates of 0.01 for every frame at 60 fps so you are totally right 0.01 * 1.6666666667 = 0.0166666666667 which is the actual amount of second spent within a frame at 16 fps.

My bad, I was so sure we just used the real time in seconds that I did not check!

we could add a realTime time value maybe?

Yes, that what @sebavan suggested too!

1 Like

PR has been created:

2 Likes