Readit News logoReadit News
ux commented on Sharing everything I could understand about gradient noise   blog.pkh.me/p/42-sharing-... · Posted by u/ux
purplesyringa · 3 months ago
The illustrations were cool. They could've been just prerecorded animations, but I really appreciate making them endless. Quite mesmerizing and motivates reading.
ux · 3 months ago
Hehe, thanks. The thing is, it could hardly have been prerecorded animations :D

I don't know if you tried before, but compressing noise is particularly hard, so 16 videos would have been quite too much of bandwidth. The total size of the shaders is something around 70kB (not minimized) for endless lossless videos, and since I had to write them anyway if I were doing records of them, it was really a no-brainer to embed them to be honest.

ux commented on Sharing everything I could understand about gradient noise   blog.pkh.me/p/42-sharing-... · Posted by u/ux
ux · 3 months ago
> What an impressive and thorough deep dive.

Thanks!

> Have any of you ever gotten lost tweaking fade functions to get that perfect wave-like look?

You cannot use anything for the fade function, because you likely want the derivative (and potentially the second derivative) to be 0. See https://gist.github.com/KdotJPG/417d62708c76d53972f006cb906f... for making different ones. I personally never tried anything else than the hermite and the quintic.

ux commented on Fixing the iterative damping interpolation in video games   blog.pkh.me/p/41-fixing-t... · Posted by u/ux
refulgentis · a year ago
I was bit confused how a formula that depends on a constant frame rate works with variable refresh rate. Then the author commented that you don't need to calculate the quantity that depends on frame rate in code. https://news.ycombinator.com/item?id=40401211

I'm really lost, but alas have ~0 experience with 3D about 15 years into a career.

Ignoring variable frame rate: 1. Doesn't the frame rate depend on the display hardware?

2. Can you know the frame rate at runtime?

Variable frame rate: 3. What quantity do you use for frame rate for variable frame rates?

ux · a year ago
1. depends if you're in the physics main loop or not; in Godot for example the physics main loop is based on the project configuration, not correlated with the display (I could have expanded on that in the article)

2. You can know the targeted frame rate, you can also infer it by averaging the delta times at runtime (not reliable but maybe more accurate on a slow machine?)

3. In my graph, I did pick random delta between 15 and 120 fps IIRC; the point was to simulate what could roughly happen with random lag spikes

ux commented on Fixing the iterative damping interpolation in video games   blog.pkh.me/p/41-fixing-t... · Posted by u/ux
ncruces · a year ago
Seriously guys, don't write:

  a = lerp(a, B, 1.0 - exp(-delta * RATE2))
Write:

  a = lerp(a, B, -expm1(-delta * RATE2))
This is precisely the situation where you really want to use expm1: https://www.johndcook.com/blog/cpp_expm1/

And (as pointed in the above) if you're worried about the slowness of it, just Taylor expand it to x+x²/2.

Finally, unless division is too costly, do:

  a = lerp(a, B, -expm1(delta / -T))
Where T is the “time constant” (which you can intuitively express in time units, like seconds): https://en.wikipedia.org/wiki/Exponential_smoothing#Time_con...

It's not the half-life (sorry) but it's still a lot more intuitive as a parameter.

ux · a year ago
That's some very good recommendations you made here. I'm adding all 3 at the end, thank you.
ux commented on Fixing the iterative damping interpolation in video games   blog.pkh.me/p/41-fixing-t... · Posted by u/ux
Ono-Sendai · a year ago
Proposed solution is too expensive with ln and exp calls.
ux · a year ago
Only the exp call happens in the processing loop. The ln is in the conversion function, it's not supposed to land in the code.
ux commented on Fixing the iterative damping interpolation in video games   blog.pkh.me/p/41-fixing-t... · Posted by u/ux
chrisjj · a year ago
In monoticity guaranteed even if the next frame is short?
ux · a year ago
As the delta time converges to 0, the lerp coefficient is going to converge to 0 as well, meaning it won't move. Said differently, if time stops the interpolation as well. You may enter into the realm of floating point accuracy issues at some point with low values, but I'm curious of what specific scenario you have in mind here?
ux commented on Fixing the iterative damping interpolation in video games   blog.pkh.me/p/41-fixing-t... · Posted by u/ux
chrisjj · a year ago
Nice, but ...

> So there we have it, the perfect formula, frame rate agnostic ,

... worth noting what happens on a frame time spike.

ux · a year ago
A frame time spike is covered by the overshooting point: it will basically land further down the curve, which means a point converging toward the B target.

u/ux

KarmaCake day1792March 20, 2012View Original