Lerp smoothing is broken

Ғылым және технология

a journey through decay and delta time (I had to learn differential equations for this oh boy)
Slides: / 105228270 for my patreon supporters 💞
The slides are much nicer in person!! like, the AV team on site had me lower the refresh rate on my laptop because we couldn't get it to work otherwise, and on top of that, video compression on youtube is now ruining everything as usual ;-;
Anyway, first, a big thanks to the organizers at Guadalindie for inviting me and letting me publish the recording!
Second - I've been working on a blog post about lerp smoothing in the background, this talk is like a distilled version of half of that yet-to-be-published blog, so keep an eye out for that if you want to dig deeper! There's a whole side of this topic involving approximations to lerp smoothing, but it kind of exploded into a whole thing, which would take up another hour on top of what I already covered, so I couldn't fit it in!
Lastly - if you want to stay in touch and in the know whenever I release new videos, blog posts or unity plugins, be sure to sign up to my mailing list!
✉️ Mailing list ❱ acegikmo.substack.com/
Recorded at Guadalindie 2024, May 3rd
Timestamps:
00:00 Start
00:20 How to lerp smooth
02:07 The problem of framerate dependence
03:49 Linear motion
10:55 What is lerp?
12:32 The non-linear behavior of lerp smoothing
18:40 Finding continuity
20:23 Unraveling recursion
28:51 Going framerate independent
40:00 Half-Life
47:21 Summary
49:37 tldr (the useful part you want to copy/paste)
51:00 Q: How important is experimenting with math?
54:30 Bonus slide: Differential calculus
55:33 Bonus slide: Spring physics
56:39 Outro
💖 Patreon ❱ / acegikmo
🐦 Twitter ❱ / freyaholmer
📺 Twitch ❱ / acegikmo
💬 Discord ❱ / discord
🌸 Instagram ❱ / freya_holmer

Пікірлер: 625

  • @acegikmo
    @acegikmo29 күн бұрын

    FAQ! *Q: What about lerp(a,b,F*Δt)?* A: That's an approximation, and it happens to be a pretty good approximation! Especially if you are running at a high framerate, but it can falter pretty violently if you get lag spikes, or if you use large values of F. Even if you clamp it to not overshoot a value of 1, you can get disparate outcomes depending on framerate. Now, this whole talk is about half of what my (upcoming) blog post will cover! In the blog post, I spend a *lot* of time talking about approximations, including this one, and exactly where and how it fails c: *Q: Can't you just use a fixed timestep loop, separate from the rendering update loop?* A: You totally can! But if your fixed timestep is lower than your render framerate (which it usually is - unity defaults to 50fps in FixedUpdate for example), then you now have a new problem. Your motion will look stuttery because the position isn't updated as often as your rendering is, and so now you need to make it interpolate across those gaps before the next FixedUpdate hits. Now, in unity specifically, and specifically for rigidbodies only, there is support for interpolation, if enabled. However, keep in mind that this is an additional hack/patch, on top of your initial hack, of not using a framerate independent smoothing method. Personally I prefer just to use the framerate independent variant at the render framerate, unless it has to be a part of some existing timestep ecosystem, such as when you want it for rigidbodies *Q: How did you make these slides/animations?* A: It's a long story! Usually I use unity together with my animation tool + shapes, my vector graphics library. But this time around I used html/js/css, since this started as a (yet to be released) blog post on the same topic. I use html5 canvas to draw 2D graphics, and I use KaTeX to convert LaTeX into html elements. Pretty much everything else is custom made, from the slide nav to the interaction to the animations etc.! I have actually considered making a video about my descent into web dev in making this, because I have OPINIONS about javascript, lordie christ ;-; *Q: Will you publish the slides?* A: I already have! They're available for all my patreon supporters right here! www.patreon.com/posts/105228270 *Q: Will you publish something about the spring physics you showed near the end?* A: Eventually yes! likely on my blog as well, maybe as part of the lerp smoothing blog post, or as its own separate thing afterwards since my lerp smoothing post is already enormous

  • @Werbel

    @Werbel

    29 күн бұрын

    Q: What about the y′′+2ζωy′+ω2y=0 ? It looks interesting, but even chatgpt dont know that and only 2 pages on google, not really mentioning a code! Show me a pseudocode for that pretty please :). Or confirm K1 K2 K3 K4 solution by chatgpt.

  • @youtubeviewerxx

    @youtubeviewerxx

    29 күн бұрын

    PLEASE do make that video about web dev. I am trying my hand at explanation-blogging and it's not easy, I want to see how you do it with your kind of quality.

  • @telephonedude

    @telephonedude

    29 күн бұрын

    > because I have OPINIONS about javascript, lordie christ ;-; I am putting this post on my Christmas wish list. I recently fell back into wanting to do some web dev, and... yes. Lots of opinions, lots of feelings :')

  • @redpepper74

    @redpepper74

    29 күн бұрын

    That's super cool, I'd love to see your thoughts on web dev, especially how you're doing the canvas stuff. Right now I'm working on my first browser game (it's a picross/nonogram clone) and I'm only using the canvas, so it would be neat to hear about how you achieved certain things like smooth animations and making it run efficiently.

  • @sheepcommander_

    @sheepcommander_

    29 күн бұрын

    i need to know how to perfectly lerp

  • @guidosalescalvano9862
    @guidosalescalvano986229 күн бұрын

    Freya is such a rock star educator that people are queuing in line to watch her teach something.

  • @acegikmo

    @acegikmo

    29 күн бұрын

    literally though?? I don't think it's visible in the video, but there were *so* many people, including a crowd gathered, *standing* behind all the (filled) seats. after my talk I spent about 3 hours nonstop talking to people who had questions! it's weird, but also really fun and flattering ❤

  • @TheDavidlloydjones

    @TheDavidlloydjones

    29 күн бұрын

    @@acegikmo Well, Guido has it right. I don't know how the hell this got into my feed, but it's a pleasure to run across you for sure! 🤩🤣

  • @mario_actually

    @mario_actually

    29 күн бұрын

    @@acegikmoit’s so well earned. Absolutely S-rank.

  • @maxrinehart4177

    @maxrinehart4177

    29 күн бұрын

    ​@@acegikmo ​​that proves that you are knowledgeable, intelligent, has the rare skill to teach others, and kind person.

  • @hydropage2855

    @hydropage2855

    29 күн бұрын

    “her”?

  • @javierlim4873
    @javierlim487329 күн бұрын

    Cool connection at 16:30: It takes 53 iterations of halving. The mantissa of a 64bit float only has 53 (effective) bits of precision. This is not a coincidence! Specifically, a float is stored as 1.mantissa x 2^exponent, where the mantissa is a binary number. The number closest (but not equal) to 2 is hence 1.111...1b x 2^0 with 53 1s, equal to 1.99999999999999977795539507497 in decimal. Up to rounding, this is f(52) shown in the video! On the next iteration, there is no nearer representable number -- it simply rounds to 2! And indeed, it takes 52 iterations to get to this point, because at the nth iteration, a is 2^-n away from 2. The difference between 2 and 1.111...1b? 0.000...1b = 2^-52!

  • @octopodes_nuts

    @octopodes_nuts

    29 күн бұрын

    Bonus points if somebody knows how many iterations the example would have taken to get from 1 to 0 instead of to 2, taking subnormals into account

  • @atomictraveller

    @atomictraveller

    28 күн бұрын

    44100 is a constant you may be aware of. if not, you're too young. 44100 is a quarter, times 420, times 420. a quarter

  • @abebuckingham8198

    @abebuckingham8198

    26 күн бұрын

    I feel like 2^-52! is overkill. Could have just been 2^-52. 😏

  • @F_A_F123

    @F_A_F123

    23 күн бұрын

    ​@@abebuckingham8198 2⁻⁵²! is actually around 1

  • @hornylink

    @hornylink

    21 күн бұрын

    @@F_A_F123 people don't respect the need for precision nearly as much as they should. why shouldn't we just round pi to 3.14? what could possibly go wrong?

  • @Maxawa0851
    @Maxawa085129 күн бұрын

    'babe wake up new hour long freya holmér presentation just dropped'

  • @Spine223

    @Spine223

    29 күн бұрын

    so real

  • @ThePoke151
    @ThePoke15129 күн бұрын

    Freya = the best math teacher I had + cat ears

  • @KangJangkrik

    @KangJangkrik

    29 күн бұрын

    If my teacher wears cat ears, I would never sleep in the class again

  • @frediwalker2381

    @frediwalker2381

    27 күн бұрын

    i didnt even notice the cat ears lmao

  • @Wawwior

    @Wawwior

    25 күн бұрын

    Cat ears are a subset of best teacher ever criteria

  • @Teflora
    @Teflora29 күн бұрын

    I'm going into the video thinking "oh yeah, I know that" and in the middle of the talk you go deeper into a topic than I ever did and learn something new. It's amazing! That's why I always watch your videos!

  • @error.418

    @error.418

    29 күн бұрын

    100%, she gets me every time

  • @acegikmo

    @acegikmo

    29 күн бұрын

    haha, good! I generally try and capture as many people as possible in the beginning, so that the more advanced stuff is built on a foundation I've communicated, rather than assuming everyone knows that stuff already. sometimes it's useful to get reminders of things you already know too, so I think it's worth it! even if some people might find it basic or boring for a bit

  • @MetapeterUndMetagreta

    @MetapeterUndMetagreta

    25 күн бұрын

    ​@@acegikmo Absofuckinglutely!

  • @ere4t4t4rrrrr4

    @ere4t4t4rrrrr4

    20 күн бұрын

    @@acegikmo so I was reading the newly released Tom7 paper (called Badness 0, it's on HN frontpage) and he was talking about how some people explore subjects "depth first" and he gave an example of Donald Knuth. I was just thinking how your videos have so much depth too

  • @whynotanyting
    @whynotanyting29 күн бұрын

    "Shit! I fixed it!" Debating whether that's a good or bad thing to hear a coworker say

  • @catmacopter8545

    @catmacopter8545

    27 күн бұрын

    If you just don't mention it, they'll put the bug back in the code and get free job security. So that depends on what you think about keeping that coworker around!

  • @alextasarov1341

    @alextasarov1341

    26 күн бұрын

    @@catmacopter8545if the fix was an accident and they aren’t sure why it is fixed, it can be vexing to not know the origin such that you could prevent it from recurring.

  • @dr.kraemer
    @dr.kraemer29 күн бұрын

    Gotta admit, at this point I see Freya, I click.

  • @dr.kraemer

    @dr.kraemer

    29 күн бұрын

    (I'm not sure I'd even encountered the word before, let alone considered how to smooth one.)

  • @matercan5649
    @matercan564929 күн бұрын

    I love the cat ears, never thought a mathematician would be wearing nekomimi.

  • @sakura_x64

    @sakura_x64

    29 күн бұрын

    @@tbird81 she isn't, but you are

  • @cineblazer

    @cineblazer

    29 күн бұрын

    @@tbird81 Honest counter-question-why do you care? Why is the gender she was assigned at birth something you want to know?

  • @sakura_x64

    @sakura_x64

    29 күн бұрын

    @@tbird81 how is that relevant?

  • @acegikmo

    @acegikmo

    29 күн бұрын

    hmm, I think for me the cringiest part is that I didn't get a haircut before this event, my style works much better when my wavy inverted bob cut is properly showing, but now that it's grown out it just kinda looks awkward-medium length wavy

  • @acoust1c34

    @acoust1c34

    29 күн бұрын

    ​@@acegikmoyo I know nothing about gamedev or smth you doing, but I think you are not awkward and kinda cute really. goals tbh, maybe in 1-2 years all be a programmer/gamedeveloper wearing cat ears too ❤ you make it sound less confusing so thanks

  • @torylva
    @torylva29 күн бұрын

    Hi Freya, you probably don't remember me in particular, but I hope you remember my class! Me (and hopefully everyone) from Futuregames 2022 Game Programmer just wants to say "thank you!" for all you did for us! I was saddened that you got sick for our other course with you and I hope you feel much better these days! Every time I think of Lerp, I think of you! With loving regards, an alumni from FutureGames!

  • @acegikmo

    @acegikmo

    29 күн бұрын

  • @pinkeHelga

    @pinkeHelga

    29 күн бұрын

    @@acegikmo Oh no! You're not a teacher anymore? What are you currently doing?

  • @pinkeHelga

    @pinkeHelga

    29 күн бұрын

    @@acegikmo And now I'm confused... why is this verified account not 'Freya Holmér' but 'acegikmo'?

  • @acegikmo

    @acegikmo

    29 күн бұрын

    @@pinkeHelga because KZread decided to start showing handles instead of display names in comments for some weird reason

  • @Kobold666

    @Kobold666

    29 күн бұрын

    @@acegikmo Handles are unique, KZread ended the fun of trolling by impersonating other people in comments. Took them almost 20 years.

  • @AtomicAndi
    @AtomicAndi29 күн бұрын

    Around 1999 there was a car racing game called Screamer, which was great, but the tire grip depended on framerate. The slower your PC the faster you could take corners. I replayed it years later at 200fps and there was virtually no grip, like driving on ice

  • @adsilcott

    @adsilcott

    25 күн бұрын

    Rollcage came out the same year and was one of my favorite PC racing games, but it had the same problem. I loved that game but when I convinced a friend to buy it and tried to play him vs, he said that the steering was really bad. I thought he just needed to get good until I tried it myself. His system was faster and the steering was clearly tied to the frame rate. I thought that was an amateur mistake by the developer, but this talk has convinced me that it's a more subtle problem than I thought, and I've probably made similar mistakes in my own game development.

  • @alejogonzalez4997

    @alejogonzalez4997

    24 күн бұрын

    @@adsilcott Oh, you don't have to go so far back, in F1 2022 and 2023 (don't know about 2024), physics are framerate dependent. I mean, you don't have 0 grip at high framerates, but with a low enought performance you could almost ignore curbs. Also, random fact, I was searching for Screamer, and it seems that the studio is now the one that works in Moto GP games, Ride franchice, the new Hotwheel game and some more.

  • @curryleavesbydhanya

    @curryleavesbydhanya

    5 күн бұрын

    Need for Speed: Rivals (by EA) has the whole physics system tied to the framerate. If you are lagging the whole game will play slower, and if you unlock it to high fps the game plays like a timelapse

  • @AtomicAndi

    @AtomicAndi

    5 күн бұрын

    @@curryleavesbydhanya wow, that's bad for a "modern" title. You could also have slowmotion in Grand Prix 2 back in 1996, when the PC was too slow, but apart from that it was accurate

  • @brandonsaffell4100
    @brandonsaffell410029 күн бұрын

    Great discussion. How to convert from a per frame implementation to a time based implementation should be game dev 101, but we've seen plenty of AAA game companies fail at it.

  • @05degrees

    @05degrees

    29 күн бұрын

    Yeah.

  • @mickaelgodard

    @mickaelgodard

    26 күн бұрын

    I dont have a memory of a recent AAA game failing at framerate dependent bugs.

  • @darthnix

    @darthnix

    21 күн бұрын

    @@mickaelgodardevery game that ties physics to frame rate and locks your game at an fps because of it is a failure

  • @mickaelgodard

    @mickaelgodard

    21 күн бұрын

    @@darthnix Agreed, but which one did that recently?

  • @darthnix

    @darthnix

    21 күн бұрын

    @@mickaelgodard name any Nintendo game

  • @angeldude101
    @angeldude10129 күн бұрын

    If df(x) = af(x), chances are good you have an exponential; _the_ function whose rate of change is proportional to its value. Fun fact, a 90° turn is legally a constant proportion, so circular motion, whose rate of change is a vector 90° from its current position, is also an exponential. Often this "90° turn" is written as "i", so circular motion is expressed as e^it, which may or may not equal cos(t) + isin(t). Now we just need to do _spherical_ LERP smoothing along a B-spline of dual-quaternions, and we'll still probably not have the most complicated way to get from point-A to point-B.

  • @cineblazer

    @cineblazer

    29 күн бұрын

    This is the first explanation I've heard of complex exponentials as sinusoids that has actually felt intuitive to me! Crazy to have stumbled across such a gem in a KZread comment section :) I hope you have a wonderful day!

  • @APaleDot

    @APaleDot

    29 күн бұрын

    @@cineblazer Yep, the hallmark of circular motion is that the velocity is always perpendicular to the displacement from the center of the circle. With complex numbers, you just multiply by 'i' to rotate by 90°. So you could say that the velocity is just the displacement multiplied by 'i' (or some constant multiple of 'i'). Since exponentials are always proportional to their derivatives, as shown by d(e^(ax)) = ae^(ax) dx, we can see that if the displacement is s(t) = e^(it) then ds(t) = v(t) = ie^(it) dt. So we have v(t) = is(t), fulfilling the requirement for circular motion.

  • @angeldude101

    @angeldude101

    29 күн бұрын

    ​@@cineblazer Any function that only depends on a prior position and a time since said position can be described as an exponential. This includes exponential growth & decay, rotations, and even in a way _translations._ This even relates to the limit definition of the exponential exp(x) = lim n->∞ (1 + x/n)^n, where you're essentially breaking x up into infinitely many small chunks, and then repeatedly scaling the identity by the 1 + a single chunk. Whether that's by repeatedly eliminating 30% of a set of remaining dots, or simply taking one step after another to slowly inch your way across a mile, they all boil down to the same concepts. There are no coincidences in math; only special cases.

  • @timmygilbert4102

    @timmygilbert4102

    29 күн бұрын

    Wait isn't that just tan(a)?

  • @minerharry

    @minerharry

    29 күн бұрын

    Another secret is if you remember from Freya’s “why can’t you multiply vectors” talk, i is a unit bivector - an oriented plane segment representing rotation. The fact that e^i represents rotation is then no coincidence! In fact, with the 3D bivectors i j and k, if you have some bivector B = a*i + b*j + c*k, the *exponential* of that bivector e^(B*theta) works **exactly** like e^(i*theta) - it gives you a rotor* representing the rotation in the plane of the original bivector by the angle theta. Just like the exponential discussed, the bivector itself is another constant value - in fact, as alluded to in her talk, it is **the circulation bivector!!** This means that the formula for following a curve can be described as iteratively applying e^C(t)dt (or the corresponding integral). [I think the formula’s right I may be off by a few factors] *rotors are only mentioned briefly in the talk, but they are just scalars + bivectors. You need scalars as well to represent arbitrary (non-90*) rotations for the same reason you need scalars in complex numbers.

  • @oriandon22
    @oriandon2229 күн бұрын

    i'm a mathematician, and i love your stuff! i show your videos to my students as supplemental material and they find it soooo helpful. keep it up!!

  • @MooImABunny
    @MooImABunny29 күн бұрын

    6:22 oooh dimensional analysis is great! I love it, glad you learned about it. It doesn't solve everything, but every once in a while it lets you skip some hard work

  • @SeanCMonahan

    @SeanCMonahan

    25 күн бұрын

    It's also a check that your calculations make sense to begin with, that the units at the end have the dimensions you actually want, so you don't waste a bunch of time, say, finding a neat, closed form solution to a nasty, nested integral that is actually fundamentally wrong 🙃

  • @unflexian
    @unflexian29 күн бұрын

    freya more like feynman with how much you make learning feel like discovery

  • @a_soulspark

    @a_soulspark

    29 күн бұрын

    hmmm... with the cat ears, why not call her feynyan?

  • @paulbunyangonewild7596
    @paulbunyangonewild759627 күн бұрын

    once i saw those cat ears i knew i was listening to a professional

  • @colonelwatch9220
    @colonelwatch922029 күн бұрын

    Hmm, not a game dev but I find it fascinating that the same smoothing idea can show up in many places. In game dev, it’s lerp smoothing. In finance, it’s the exponential moving average (EMA). In my field, electrical engineering, I also just call it the EMA, but others call it the exponential filter or even the “1-pole IIR filter”. And, well, I never considered going about this issue without bringing up Fourier and cutoff frequencies, but here’s an explanation using just algebra (not even calculus!). Like, I never made that connection between the framerate dependency and the decay. Very interesting… EDIT: I remember now you mentioned that you do that clamp to prevent wiggling. When that’s done, it does becomes slightly different from the EMA. What you’re seeing is probably the Gibbs phenomenon. It takes particular filters like the Bessel filter to get rid of it without clamping, but I’ve also seen people just do clamping. For example, some variations of JPEG rendering do this so that you don’t get JPEG artifacts.

  • @npatch

    @npatch

    26 күн бұрын

    FWIW, I used this for smoothing out joint animation data coming out of a Kinect sensor. Sometimes joints jitter, so you can use this to smooth out the outcome without keeping history of data (other smoothing filters tend to need data from previous frames to do so). It's like the lowest hanging fruit smoothing.

  • @frederiklenk7756
    @frederiklenk775629 күн бұрын

    The lerp saga continues Also dang learning quarternions before differential equations feels like the wrong order of things 😂 I for sure assumed you'd have that down before. But probably just my uni bias since i still dont get quarternions but am quite comfortable with differential equations

  • @APaleDot

    @APaleDot

    29 күн бұрын

    nah, quaternions are just algebra.

  • @notnotkavi

    @notnotkavi

    29 күн бұрын

    ​@@APaleDotyeah agreed, it's just not introduced because within math outside of graphics it's relatively niche

  • @acegikmo

    @acegikmo

    29 күн бұрын

    I think it's a side effect of not having an academic background in math, the way/order I study things is entirely by happenstance, so I tend to have a very lopsided skill set

  • @05degrees

    @05degrees

    29 күн бұрын

    @@APaleDot Actually quaternions aren’t just algebra because they for example have a smooth structure. Like complex numbers (well and even real numbers)-complex analysis is even very famous, but quaternionic analysis is a bit bad so it’s usually not that well-known like real and complex cases. And I think one can study differential equations for a long long time, there’s just so much stuff, including hairy analytic stuff and weak solutions and all the worst that math can throw at you. Especially if we include PDEs (really they are a separate subject just for technical reasons and due so a couple of differences in application). So if you even studied ODEs and maybe PDEs at uni and even if you had a math specialty, you can still be far from having a grasp on them that is sufficient for many many areas and tasks. Likewise for quaternions and all other math though: for example I don’t think people usually are aware that you can forget about concrete i, j, k (like we can swap ±i in ℂ, we can rotate the imaginary unit sphere any way we wish and this won’t change any algebra, so if our results don’t directly manipulate with i, j, k, they’re probably more useful etc., compared to if they do depend on occurrences of i, j, k-well, except for quaternion implementation and numerical algorithms, I suppose).

  • @SulekSkelux
    @SulekSkelux29 күн бұрын

    Omg it's been a while, I'm so glad you're still making educational content

  • @kepstin
    @kepstin29 күн бұрын

    I saw the graph of the lerp smoothing function, and realized that it looked identical to a smoothing function I was using on some sampled data to clean it up - the "exponentially weighted moving average". I recently had to reformulate that to handle data being sampled at uneven intervals instead of at constant intervals… basically, making it framerate independent :)

  • @Zondac
    @Zondac28 күн бұрын

    LOVE your ability to take concepts i genuinely thought i knew almost everything about and then expand on them until even someone who’s been doing this stuff for a long time learns something new. Even concepts i was fairly familiar with you explained in a way I hadn’t exactly heard before, which helps recontextualise the tools we depend on!

  • @TaranovskiAlex
    @TaranovskiAlex29 күн бұрын

    Thank you! Awesome talk!

  • @zactron1997
    @zactron199729 күн бұрын

    Always brightens my day to sit down with some lunch and learn something from a fantastic presentation!

  • @leroymilo
    @leroymilo29 күн бұрын

    Thank you so much! I used lerp smoothing for a project and I fully understood all its issues, but I had no idea how to solve it. This was very useful!

  • @acegikmo

    @acegikmo

    29 күн бұрын

    yeah, it's one of those "it's close enough to working and I know it's wrong but it seems mostly fine so I'm going to ignore it until it becomes a problem" things you know

  • @Spine223
    @Spine22329 күн бұрын

    hey you really inspire me; I could never get up and teach.. but self-teaching and getting out there seems great

  • @MikkiPike
    @MikkiPike29 күн бұрын

    thank you for existing 💗

  • @collin4555
    @collin455529 күн бұрын

    Well, I was happy about anticipating the framerate dependence issue, and then it was a thrilling hour of hoping to keep up with the math. Exactly what I came for!

  • @dominiquefortin5345
    @dominiquefortin534529 күн бұрын

    @Freya Holmér Great work of vulgarization of the lerp function. It is always nice when all this research and exploration is put into a nice little narrative. I'm sure it took (x * 1h, where x > 3) to prepare. Continue to share with us your enthusiasm about computer graphics. I, my self, am interested PIDs control and lerp is kind of open loop control.

  • @atomictraveller

    @atomictraveller

    28 күн бұрын

    lerp is linear interpolation. it's being able to go in a straight line between two 1D locations. it's as elementary as elementary math can be. this is not an education.

  • @blonehou8522
    @blonehou852229 күн бұрын

    Loved this talk

  • @Krunklehorn
    @Krunklehorn29 күн бұрын

    The exp() and exp2() methods also approach 1 asymptotically and thus, naturally prevent overshoot, even at extremely low framerates.

  • @directrix1
    @directrix125 күн бұрын

    I am consistently impressed with how well you present this type of material. Always well made, and always worth the watch. Thanks!

  • @johnnysvensson
    @johnnysvensson29 күн бұрын

    This was great. Thanks for all your cool content Freya! I especially enjoy the math for game dev series and as someone who did ALOT of procedural content generation(mainly procedural textures/graphics, in software on the CPU) before it was cool and before everything was done on the GPU, i also enjoyed the vids about procedural geometry as well as the shader basics one as that is some stuff i need to get updated on/learn in order to stay up to date.

  • @tomkirbygreen
    @tomkirbygreen29 күн бұрын

    Pure awesome. Learnt lots, you rock!

  • @pavelperina7629
    @pavelperina762929 күн бұрын

    When I tried to solve similar problem I somehow realized that there's relationship between log and square/cubic/...-roots and I actually don't understand why these relations work. Or why there are even things such as fractional powers and roots. And how logs turn multiplication to adition. I took old slide rule and started to reverse-engineering it to the level I was able to independently reinvent logarithms (having advantage that I had some clue what I'm doing) and find them using square roots iteratively (which are basically fractional powers). It was nice feeling when all puzzle pieces worked together. After half year, I almost forgot everything I learned.

  • @Duiker36

    @Duiker36

    29 күн бұрын

    Yup. It's always a bit of a surprise how much of math can be broken down and understood like that. Part of the problem is that, in school, we are told to memorize how it works and then process stuff like a computer. It makes math feel scary, since we aren't computers. But when we have some idea of what we're trying to do, and why it's important, and have some time to poke and prod at how stuff works, it's remarkable how much of math just *falls out* naturally. It's what mathematicians mean when they say it's beautiful.

  • @Houshalter

    @Houshalter

    29 күн бұрын

    Understanding logarithms and those relationships has been the most useful and magical bit of high school math for me. It comes up everywhere. It's amazing humanity didn't discover it until modern times.

  • @acegikmo

    @acegikmo

    29 күн бұрын

    yeah! fractional/rational powers are really unintuitive! I think most people start using them around the time you start using calculators though, and so I think it largely goes unquestioned even though it's (as far as I know) also often unexplained around the time of high school, at least it was in my case! I really wanted to go on a tangent about rational exponents in my (yet to be published) blog post but it's already ridiculously long so I ended up cutting it 💀 maybe I'll save that for the future!

  • @OLIV3R_YT
    @OLIV3R_YT29 күн бұрын

    Great talk. Awesome slides!

  • @favalon79
    @favalon7922 күн бұрын

    I love Freya’s talks, where she explains things with beautiful animations and cats icons

  • @JoBoToGo
    @JoBoToGo26 күн бұрын

    I'm not a game dev, and I don't currently have any use for this awesome technique, but learning about it from you made my brain tingle in the best possible way, thank you!

  • @dealerpriest
    @dealerpriest29 күн бұрын

    As always, incredible!

  • @lionbryce10101
    @lionbryce10101Ай бұрын

    Woohoo, another presentation tk watch multiple times!

  • @christianloose9875
    @christianloose987512 күн бұрын

    I'm not a game developer nor a mathematician. But I could still follow most of this talk with my school math and software development background. It's very interesting and brilliant talk. With videos like this, KZread has real value instead of being a time waste. Thanks!

  • @aldanasjuan
    @aldanasjuan29 күн бұрын

    This is awesome Freya, I just tested the TLDR code and it works well. I love that if you use < -1 in the decay it will repel. I'd love to see the TLDR copy-paste version of the spring function but I'll wait for the blog post. Now I have to replace all those bad lerps in my game, which I'm grateful for knowing frame independence is closer.

  • @kolos0139
    @kolos013929 күн бұрын

    I'm only halfway trough, and this is already super interesting and incredibly well made even for me, who is neiter a maths person or in gamedev. Hats off, Freya!

  • @felipeticov
    @felipeticov29 күн бұрын

    thank you for being an awesome teacher!!!

  • @itzari8787
    @itzari878729 күн бұрын

    Absolutely loved the presentation, as always Freya, you’re a great science communicator.

  • @Zach010ROBLOX
    @Zach010ROBLOX29 күн бұрын

    I love you just had a mini talk after your talk xP

  • @AerialWaviator
    @AerialWaviator29 күн бұрын

    A great lesson and future blog post. Love the visual graphics, and read the FAQ (it literally answered the question I had). The nice thing about iterated approximations is they only need to be good enough for the level of context required. With Zeno's example, if walking 1/2-way to a destination, as some point, the remaining distance will be smaller than his foot, so can't take another full step. Same with computer graphics, at some point the next step will be smaller than a pixel. This quantum (minimum iteration unit) could a parameter that stops the iteration process loop, when it reaches a good enough quantum value.

  • @AquaEBM
    @AquaEBM2 күн бұрын

    Fun fact, we just discovered (with a cool perspective twist) Exponential Moving Average (EMA) smoothing, Very commonly used in DSP-related fields, like audio (smoothing parameter changes, to avoid gittery clicks in your audio), embedded (de-noising signals captured by sensors). This technique is a way to efficiently discretize exponential function(s), which, needless to say, ubiquitously model many physical phenomena. Awesome talk Freya!

  • @apotatoman4862
    @apotatoman4862Ай бұрын

    its time to multiply movement by deltatime

  • @memeed3981
    @memeed398129 күн бұрын

    I validate and specialize you. very nice talk.

  • @notapplicable7292
    @notapplicable729229 күн бұрын

    Gosh, this was wonderful!

  • @colinbrown7947
    @colinbrown794729 күн бұрын

    Oh wow! So cool seeing something I had to figure out for myself get explained so well. I was using lerp smoothing to animate a camera following a route on a 3d map, and had to solve for framerate independence. Funnily that approach had a lot of flaws so it got scrapped for a better camera following technique lol.

  • @FlameRat_YehLon
    @FlameRat_YehLon29 күн бұрын

    I guess the best attitude towards math is to have fun with it. When there's a dire situation by no means search the answer for it, and one shouldn't feel shameful doing it because time is precious especially for development work (where work can't really be divided much). But when there's leisure, well, that's when to really know what's inside. Knowing the answer of random what-ifs always brings fun, and so does feeling the power in knowledge. Like, because knowledge is power, learning new knowledge really gives the power fantasy vibe, which feels really good even if those knowledge will just go wasted. Also, love how you got the cat ears on perfectly! It often feels really hard to get cat ears on without them looking slightly off or asymmetric, for whatever reason, almost like there's a curse that prevents cat ears to be worn properly or something.

  • @ericrosas9199
    @ericrosas919928 күн бұрын

    This is actually insane that I was running into THIS EXACT PROBLEM over this weekend. I was porting over a minigame from TF2 called dodgeball into Minecraft and they used a LERP function to make the "ball" follow the player. The issue is that TF2 ticks at 66tps and Minecraft does 20tps so it was feeling different. Long story short I also found one of the equations you described to solve the issue, awesome talk :)

  • @KarimAktouf
    @KarimAktouf26 күн бұрын

    It is indeed beautiful and mesmerizing; thank you Freya for explaining it so well

  • @usMercurySilver
    @usMercurySilver28 күн бұрын

    This is a brilliant presentation - I love the attention to detail in the visualizations! It gets me fired up about being an educator.

  • @ABuffSeagull
    @ABuffSeagull28 күн бұрын

    This is perfect timing! I’ve been working on a custom text editor for myself for fun, and I want the cursor to “smear” around. I was just using earrings, but this’ll make it feel really nice. Thank you so much for this talk!

  • @curiouspers
    @curiouspers29 күн бұрын

    That's awesome, thank you! ❤

  • @mickaelgodard
    @mickaelgodard26 күн бұрын

    Great video once again! Congratualtions. I am in awe for your framework that you use for your videos and presentation. It's so perfect for your mission and it becomes your signature move. Super inspiring. PS: The dig at J. Blow was a bit out of nowhere and unnecessary but funny too.

  • @LucasStraub
    @LucasStraub25 күн бұрын

    The visuals on this presentation are so freaking good! It's just perfect!

  • @lambdaprog
    @lambdaprog29 күн бұрын

    Excellent presentation. I spent a few weeks working around this very problem in SDR# after a crappy Windows update that messed with the timing resolution. The solution involves timestamping and dynamic time compensation.

  • @miguelmora5809
    @miguelmora580928 күн бұрын

    I was there!, I enjoyed a lot your presentation, very stylish as always! It was great to welcome you in Spain

  • @acegikmo

    @acegikmo

    28 күн бұрын

    and thanks for joining the talk!!

  • @kono152
    @kono15229 күн бұрын

    babe wake up freya just uploaded

  • @DrSchischious
    @DrSchischious29 күн бұрын

    I really love your content. I'm a cs teacher at a school and really love your educational style. You know how to generate real knowledge in other peoples brains.

  • @Atrix256
    @Atrix25629 күн бұрын

    Great vid Freya!

  • @DetectiveYuki
    @DetectiveYuki6 сағат бұрын

    Love this. Your presentation is super engaging. I've decided to take some time to go through your math for game devs playlist as well. Thanks for the learning

  • @KingBobXVI
    @KingBobXVI27 күн бұрын

    This is actually very useful and topical for a personal project I recently have been working on - it's a game that involves time travel, and at some point while making it I realized that the objects more or less need to have their parameters all defined as a function of time rather than actually simulating stuff (well, there are simulation steps in there as "keyframes" are taken for the player inputs, but their position etc can be derived given any value _t_ - meanwhile, background objects with simple motion (say, constantly rotating gears) can't just do "angle += theta * dt", but have to go by a cosine, etc...). This is some good information on some more complex motions and how to derive them, I'm sure it'll come in handy moving forward!

  • @APaleDot

    @APaleDot

    26 күн бұрын

    Speaking of time-travel, the guy who blocked Freya on twitter has a talk about how he implemented Braid. Have you seen it?

  • @CameronOwen101
    @CameronOwen10129 күн бұрын

    Excellent video, also appreciate the custom edited subtitles with some extra context.

  • @AlexeySamokhin
    @AlexeySamokhin29 күн бұрын

    You art the best inspiring person.

  • @Filup
    @Filup24 күн бұрын

    I took an ODE course as part of my degree, and it is pretty awesome when you finally understand everything and can apply it to things like this!

  • @MindlessTurtle
    @MindlessTurtle29 күн бұрын

    Very cool talk.

  • @BilgehanKorkmaz
    @BilgehanKorkmaz29 күн бұрын

    Thank you.

  • @acegikmo

    @acegikmo

    26 күн бұрын

    and thank you!

  • @Atrix256
    @Atrix25629 күн бұрын

    Oh a new video!!!! Awesome!

  • @alejandroioio6784
    @alejandroioio678428 күн бұрын

    Oh you are back, thanks ! ❤

  • @SeanCMonahan
    @SeanCMonahan25 күн бұрын

    Holy cow, the interactive animations in the presentation are so illustrative! (I'm only partway through at this point.) I've always wanted to do this sort of thing. I imagine it can help give excellent A's during a Q&A at the end.

  • @zaynnxenonn2334
    @zaynnxenonn233429 күн бұрын

    Thank you for this very good video ! Always amazing to learn with you, you're a very good vulgarisator plus I love your cat ears 😻

  • @thaptam
    @thaptam23 күн бұрын

    This video enlightens me. Thank you!

  • @tonylovesmusic6806
    @tonylovesmusic680629 күн бұрын

    a new upload!!! my day is saved 🎉🎉🎉

  • @j16180
    @j1618027 күн бұрын

    This is a great class, you are a very good teacher.

  • @user-ef4yx3mu2q
    @user-ef4yx3mu2q26 күн бұрын

    Brilliant and useful, as usual. Thank you for the video.

  • @supertenchoo4271
    @supertenchoo427129 күн бұрын

    Am happy to see Freya Again wohoo ,lets gooo!!!

  • @stulora3172
    @stulora317225 күн бұрын

    A day with a new video from Freya is a good day.

  • @johningham1880
    @johningham188020 күн бұрын

    Very thorough and intuitive. And I think we now have the P part of a PID controller.

  • @johnbox5540
    @johnbox554022 күн бұрын

    freya talks are always so amazing

  • @luke871016
    @luke87101629 күн бұрын

    Freya's video is always the best

  • @shadamethyst1258
    @shadamethyst125829 күн бұрын

    There's also the fun problem of trying to make the 10fps client match better, or making this work with integers or fixed point numbers. Best solution to the latter I have found so far is to keep have a slower-updating counter, and then go back to using it every time it updates.

  • @sheepcommander_

    @sheepcommander_

    29 күн бұрын

    this doesn't match the 10fps client?

  • @shadamethyst1258

    @shadamethyst1258

    29 күн бұрын

    @@sheepcommander_ Well, you can see in the slide with all of the overlapping graphs, that there is still some inaccuracy, especially when Freya was moving the target quickly

  • @sheepcommander_

    @sheepcommander_

    29 күн бұрын

    @@shadamethyst1258 In godot i saw people talking about using the Engine.get_physics_interpolation_fraction() but i still don't understand it

  • @acegikmo

    @acegikmo

    29 күн бұрын

    ​@@shadamethyst1258 hmmmm I don't know if I'd call that "inaccuracy", it's more like, it's delayed, because it can't respond fast enough. I guess you *could* extrapolate to try and guess the next frame to stay ahead a little bit, but now you're clearly in the realm of inaccuracy, because now you're adding data that might be incorrect, as opposed to reading correct data a little later than you'd like, right?

  • @shadamethyst1258

    @shadamethyst1258

    29 күн бұрын

    @@acegikmo Well, I do wonder if a more accurate integration method wouldn't work better; you could always increase the accuracy by just computing substeps, though

  • @acrctba
    @acrctba20 күн бұрын

    That was an amazing talk. Thanks for that!

  • @seedmole
    @seedmole29 күн бұрын

    So much overlap with audio in this one!! This is essentially the solution to a feature I've wanted to add to a stereo pingpong delay for a while now, but couldn't quite figure out. The trick, I see now, is to raise the per-repetition scaling factor to a factor corresponding to the ratio of frame durations, or in my case delay lengths. Gonna mull this over and see how well it works.. should be exactly what I needed.

  • @seedmole

    @seedmole

    29 күн бұрын

    Hahaha yeah it does work. My thing uses a feedback parameter which is the same as R in this. Tested it a bit, all I gotta do to match the decay curves for two audio delay lines of different duration is raise one channel's feedback parameter to the power of that channel's duration divided by the other channel's duration. That will either slow down the decay of a shorter cycle, or speed up the decay of a longer cycle. Did basic tests and it came out perfect using an analog for integer ratios. Gonna take a bit to implement in the actual audio version but I am very encouraged. Thanks for this and all your brilliant contributions to programming in general, it reaches out far beyond just graphics programming.

  • @seedmole

    @seedmole

    29 күн бұрын

    Audio version implemented and is indeed working. Keeps a stereo image in place as it decays, instead of it splitting apart further and further as the slower side takes longer to decay due to its longer repeat cycle. Very cool!

  • @acegikmo

    @acegikmo

    29 күн бұрын

    @@seedmole hah, yeah I've had many people mention audio processing! this is a rabbit hole I've only ever tangentially been around (when making music), but I worry if I look into the math I'll be lost in that world for another 4 years or something

  • @absolutewisp

    @absolutewisp

    29 күн бұрын

    ​@@acegikmoUp next on Freya Holmér: The Decay of Soundwaves /s

  • @ka_okai9
    @ka_okai929 күн бұрын

    Its a beautiful function :)

  • @Fodi_be
    @Fodi_be27 күн бұрын

    Thank you Freya, that is super useful! Even though most of the explanation totally went over my head (I'm crap at math), I can still use that function in my projects.

  • @lex4478
    @lex447826 күн бұрын

    You did amazing!! Thank you for sharing

  • @siliconvalleyglobalnewssvg928
    @siliconvalleyglobalnewssvg92822 күн бұрын

    Amazing, you are a genius! Thank you for making this show about math & programming for us to watch!

  • @MetapeterUndMetagreta
    @MetapeterUndMetagreta25 күн бұрын

    Endlich mal wieder ein Freya-Video und mal wieder lehrreich. Großartig!

  • @dimastorres8530
    @dimastorres853028 күн бұрын

    I have a PhD and I would love to had you while I was learning molecular mechanics. Thank you very much for sharing ❤

  • @ElliotGeno
    @ElliotGeno23 күн бұрын

    Ha! I love lerping. It always felt so elegant (except for the frame rate thing) As you were talking about solving for R I kept thinking... wouldn't be better to just solve for half the distance or something. THANKYOU FOR DOING JUST THAT!

  • @yeoman588
    @yeoman58815 күн бұрын

    Your explanation of problem-solving at 51:47 matches exactly with how I like to think, which also jibes with me enjoying your videos immensely (aside from the top-notch production quality). I don't just want to know the solution to my current problem, I want to know WHY it's the solution and WHY it works. That takes more time up front, but if I ever have a similar problem in the future, having that knowledge helps me figure out the solution to the new problem, so I usually consider it a worthy investment.

  • @causticmango
    @causticmango29 күн бұрын

    You remind me that I love math, even though I'm not very good at it. Outstanding work!

  • @Kurator125
    @Kurator12520 күн бұрын

    Thanks. I just needed it :D works perfectly

  • @MohamedOsama-mz1mg
    @MohamedOsama-mz1mg26 күн бұрын

    You are one of the best game programming content creators ever, I hit like now and watch later

  • @TomBrienProfessional
    @TomBrienProfessional11 күн бұрын

    Wow this dropped at the perfect time. I used smooth lerping 5 times last week and always thing (Im sure this is more complicated than I think...) I waddled through the talk like a confused baby, and amazingly, I could understand and apply all the options at the end. Wow!

Келесі