Interpolation & Velocity • Math for Game Devs [Part 4]

  Рет қаралды 64,071

Freya Holmér

Freya Holmér

Күн бұрын

last but not least, we'll be talking about the ever present lerp and its friends, along with a quick overview of rotations & point velocity!
If you enjoyed this series, please consider supporting me on Patreon!
🧡 / acegikmo
00:00:00 - Asgmt. 7 solution (Regular Polygons)
00:17:39 - Asgmt. 8a solution (Adaptive FoV)
00:45:52 - Asgmt. 8b solution (Adaptive FoV)
01:04:26 - Asgmt. 8c solution (Adaptive FoV)
01:33:18 - Interpolation
01:49:31 - Lerp example
02:03:19 - Inverse lerp
02:22:57 - Remap
02:33:48 - Blending images using lerp
02:34:51 - Bezier curves
02:47:39 - Velocity
03:12:19 - Rotations
Assignments:
Asgmt. 9a (Coil)
Asgmt. 10a (BC Inventory)
docs.google.com/document/d/1N...
03:39:47 - Asgmt. 9a solution (Coil)
03:52:41 - Asgmt. 9b solution (Coil)
03:55:53 - Asgmt. 9c solution (Coil)
04:15:00 - Asgmt. 10a solution (BC Inventory)
04:30:21 - Asgmt. 10b solution (BC Inventory)
Originally streamed as a course for students at futuregames.se/, who were super kind to let me both stream this live as well as upload it here! so massive thanks to the people at FutureGames!!
💖 Patreon ❱ / acegikmo
🐦 Twitter ❱ / freyaholmer
📺 Twitch ❱ / acegikmo
💬 Discord ❱ / discord
🌸 Instagram ❱ / freya_holmer
✫ Video Production by Higher Vision:
➥ / highervision1
➤ Edited by Stelly: / stelly47050876

Пікірлер: 105
@danielfilgueira2893
@danielfilgueira2893 2 жыл бұрын
"So I guess that's it, that all of the math course". I found it funny the anticlamatic ending for such a journey I've been through, watching and studying theese classes hahahah. Seriously, though, thank you Freya for the amazing demonstrations, it is already helping me improve a lot as a game developer :) Heading to the shaders one rn
@thetiphon
@thetiphon Ай бұрын
I'm bad at math, trigonometry and english but this series helped me a lot. I've implemented some assignments in godot and now feeling much more comfortable when see code that has these weird functions and vectors. Thank you
@alexhillel8612
@alexhillel8612 3 жыл бұрын
I love this series. Clear and succinct, some parts dense but always approachable, and underpinned with practical application. Thank you Freya!
@pogostar1878
@pogostar1878 Жыл бұрын
Assignment 7 5:14 - Circle angles fun-fact 11:06 - Array wrapping (modulo) 16:09 - Regular polygon exception Assignment 8a solution Assignment 8b solution Assignment 8c solution 1:11:22 - Projecting onto space 1:19:59 - Cam point to avg position of points 1:23:42 - Shader talk: URP vs HDRP in Unity 1:27:32 - Fractal shader Interpolation 1:43:43 - Extrapolation 1:45:14 - Slerp Lerp example 1:54:13 - Using lerp for smoothing 1:59:08 - Quick lerp questions 2:00:22 - The math behind lerp 2:02:38 - 😺 Inverse lerp 2:11:25 - Math formula, edge cases 2:14:25 - inverse lerp example 2:21:45 - Photoshop levels example Remap 2:26:58 - Remap examples Bezier Curves 2:42:58 - Use case example Velocity 2:55:30 - Acceleration 2:57:05 - Unity example 2:58:35 - Velocity formulas 3:01:52 - Unity example, cont'd 3:07:29 - Why multiply by Time.deltaTime? Rotations 3:18:37 - Angle-axis rotation 3:20:55 - Angular velocity 3:23:09 - Shortcut: Perpendicular vector 3:25:55 - Shortcut: Rotating in 2D by arbitrary amount (Matrix 2x2) 3:34:13 - Using Quaternions
@dango9941
@dango9941 2 жыл бұрын
I just finished this amazing course for some training at work. I'm very bad at Math so it was a challenge, I couldn't even complete some exercises without looking at your solution, but I definitely learned a few incredibly useful things. Thank you so so much!!
@oddorangeowl
@oddorangeowl 3 жыл бұрын
This lecture was amazing! I'm excited to watch your new shader series!
@hughsprague
@hughsprague 2 жыл бұрын
Two enthusiastic thumbs up! I am an "old newbie" learning Unity and Blender as a hobby. I wish I had found this day one. I struggled with the basic concepts and finally got things to work through sweat and tears. Thank you for the time and effort it took to create this series. Now, I need to go back and look at the hacks I coded to get things to work around angles, movement, etc. Awesome tutorial. Onto shaders!!!!🤣
@dennismckenzie8329
@dennismckenzie8329 Жыл бұрын
I love the way you explained array wrapping using the modulo operator and index out of bounds.
@senser1o76
@senser1o76 2 жыл бұрын
The best explanation I've ever seen. Really fascinating.
@Spaaace
@Spaaace 2 жыл бұрын
Freya, you're awesome and an inspiration. Thanks for the math.
@AndersonMarquesss
@AndersonMarquesss 2 жыл бұрын
I struggled with some tasks, and others were really fun to complete, but in the end I learned a lot. Thank you for sharing with us.
@amyhaber5712
@amyhaber5712 2 жыл бұрын
Much appreciate if you can bring us more about math & shaders, excellent work!
@CosmicComputer
@CosmicComputer 2 жыл бұрын
Sincerely Freya, thank you for sharing all this knowledge.
@CH3R.N0BY1
@CH3R.N0BY1 Жыл бұрын
worth going through the whole series for the ears
@PumpiPie
@PumpiPie 3 жыл бұрын
Nice video :D Learned mutch. Keep up the good work :D
@traz4038
@traz4038 2 жыл бұрын
1.03.00 we could find the point of most outer circle's tangent and use the dot product code earlier to find most outer one. Then calculate the angle between. I believe its more efficient and works fine but its good to see there are many ways to solve it with using different methods
@ahbarahad3203
@ahbarahad3203 3 жыл бұрын
Please upload more lectures these are one of a kind
@entropy_7827
@entropy_7827 2 жыл бұрын
forsenE I C BAJS
@yumiyonashi8518
@yumiyonashi8518 2 жыл бұрын
Thank You Freya ....you are my first real math teacher i guess..god bless you.
@carlaludgate6597
@carlaludgate6597 2 жыл бұрын
You're a fantastic teacher!
@GankablePlayer
@GankablePlayer 2 жыл бұрын
Thank you so much for the course!
@desarrollojava
@desarrollojava Жыл бұрын
Excellent video!
@Matt23488
@Matt23488 2 жыл бұрын
This series has been absolutely fantastic! Also, Thor
@miloszgierczak4806
@miloszgierczak4806 Жыл бұрын
Everytime im comming there, I feel like im watching a missing season of big bang theory and i love it!
@Ferenc-Racz
@Ferenc-Racz 3 жыл бұрын
wow.. finally an enjoyable math teacher.. (no she is programmer, but with a good explanation skill.) :) I subscribed! Thank you for your work!
@Murilo_Oak
@Murilo_Oak 2 жыл бұрын
I owe you a lot! Thanks!
@LocdnessMomster
@LocdnessMomster 5 ай бұрын
Your videos make me want to go back for a PhD in math, i love math
@mohokhachai
@mohokhachai 4 ай бұрын
We need people like yu
@aric7726
@aric7726 Жыл бұрын
When you started talking about whether iLerp was clamped or not I thought you were saying "clapped" and I was nodding along like 'yeah iLerp in unity is pretty clapped'
@botteu
@botteu 3 жыл бұрын
@Freya Holmér Great video, great series! Trying to understand this stuff by perusing maths sites usually breaks my brain but you make it so clear. Thank you 🙏 I have a question about trajectories (kind of) that I haven’t been able to figure out but I’m sure is in there somewhere. How do I find the initial velocity vector if I have the following pieces information about a projectile: Starting position (A), landing position (B), gravity vector (g) and speed (s, which is a scalar constant)? All vectors are 3D where Z is up if that makes any difference.
@CaptainSlowbeard
@CaptainSlowbeard 3 жыл бұрын
I know this is a bit of an inane comment, but you have a really nice voice. This was my main point, but probably related, I honestly love maths but got convinced by teachers that I was terrible at it when I was a kid in school. It doesn't seem very intimidating when you're explaining all kinds of interesting stuff. Hope you keep making more vids 👍
@z08840
@z08840 2 жыл бұрын
4:51:15 you don't need "the law of cosines" - radii produce an isosceles triangle, in which angle bisector is an opposite side bisector perpendicular to this opposite side - so you have 2 triangles with hypotenuse = r, and opposite side = (a+b)/2, so alpha = 2 * asin((a+b)/(2*r))
@bhaveshtiwari5783
@bhaveshtiwari5783 3 жыл бұрын
Loved the video plz do more your amezing ❤️
@AJ213Probably
@AJ213Probably 2 жыл бұрын
I like content like this even if I don't end up fully understanding it. At least I am able to say "Hey, I remember there is a solution to my problem out there... Oh it's inverse lerp!"
@Alex-fp2sx
@Alex-fp2sx 2 жыл бұрын
hi. love it . kind really want the ps picture , can i ? or where to get it . thanks
@Ten_
@Ten_ 2 жыл бұрын
This whole course was great! Thank you for providing it for the public too! Two quick questions: 1. I don't suppose there's a printout of the photoshop page you were working on? Or is that futuregames stuff? 2. You mentioned you had more Bexier curve resources - are those still around? Thanks again!
@King-mj2bn
@King-mj2bn 2 жыл бұрын
Just take notes. You'll remember far far better if you do.
@AlexxxMurkin
@AlexxxMurkin 2 жыл бұрын
1:51:15 you're turning into mathematician here, haha.
@yousefsayed6380
@yousefsayed6380 Жыл бұрын
This course is awesome, definitely the best math course you can watch on the internet! :) Also can you put a link to the image file as it would help for revision Thanks 🙏.
@mohammadebrahim4038
@mohammadebrahim4038 Жыл бұрын
hi Freya, thanks for the series. where can i find the exported images of your explanation in photoshop? did you upload them somewhere?
@epicbattles3887
@epicbattles3887 2 жыл бұрын
for the coil thing. if you don`t have Freya`s math lib. I got it sorted with this : ... float circleRad = Mathf.PI * 2 * tWinding; Vector3 pt = new Vector3(0, Mathf.Cos(circleRad + i), Mathf.Sin(circleRad + i))* coilRadius; pt.x = i * height; points[i] = pt; Gizmos.DrawSphere(points[i], pointRad);
@stephenyork7318
@stephenyork7318 2 жыл бұрын
For the dirt homework question, wouldn’t it be easier to just go to the first point and use 180-360/n ? You’d have to calculate a little extra from the starting position to the first point but you’d essentially just need a single loop.
@ridespirals
@ridespirals 2 жыл бұрын
where did you get that little 3d xyz thing you hold? I want one.
@kiat4797
@kiat4797 2 жыл бұрын
We want more .
@araldjean-charles3924
@araldjean-charles3924 Жыл бұрын
I am a big admirer of your work. I hope I can introduce my son to it. He has become a teenager (everything is negotiation). However, I disagree with your comments about modulo. One has to be internally consistent once you are using them. They form a cyclic group under addition. Z%4 has 4 elements: namely {0,1,2,3}. It is literally taking all the integers and cyclically mapping them to {0,1,2,3}. So what is -1 in that world? The so-called additive inverse is the number you add to 1 to get 0. So -1 is actually 3. Proof: 1+3 = 4; 4%4 = 0 QED. Another example what is -7 (i.e. the additive inverse of 7), 7%4 = 3, 3+1=4; thus, 1 is the additive inverse of 7 (also note 7+1 = 8; 8%4=0). To generalize, take any negative integer -n; -n is the additive inverse of n. Find n%4; what number y from set {0,1,2,3} you must add to n%4 to get n%4 to be a multiple of 4. That number y is -n in Z%4 Thank you for your excellent work!
@JarppaGuru
@JarppaGuru 2 жыл бұрын
3:01:51 its like memory triangle. make pyramid shape pos on top and bottom v*t and line between. what ever you need calculate put thumb on it and you got fotmula to get it. works awesome on sin cos tan no need think do i need multiply or divide and what order. there is allways 4 psibilities and 1/4 time you nail it LOL
@nobels3246
@nobels3246 Жыл бұрын
@Freya Holmér Question to calculating the auter most point at 32:45. Since you have normalized the directions to the points i fail to see how checking the max y value won't work to figure out the auter most point. Great video by the way
@oddorangeowl
@oddorangeowl 3 жыл бұрын
At 3:32:32 , shouldn't the negative sign and positive sign be swapped? Since the y basis vector is the one with the negative.
@oddorangeowl
@oddorangeowl 3 жыл бұрын
Wait, got my matrix multiplication mixed up. All good!
@bzikarius
@bzikarius Жыл бұрын
2:09:40 Do the negative volume! It will suck out voices from your head!
@z08840
@z08840 2 жыл бұрын
try to solve first problem for next terms - position camera (including angle and direction) such as all points fit in its FOV and distance to (barycenter of) points is minimal - and do it in 3d space - and suddenly it becomes quite non trivial :)
@usoppgod8107
@usoppgod8107 3 жыл бұрын
Great lecture. Is this the last one? That would be sad. I would be thankful to know if there is more math i would need to learn to get better at shaders.
@acegikmo
@acegikmo 3 жыл бұрын
last one for now yeah! I have considered making more parts if people would want me to, but, nothing planned yet
@eongft4027
@eongft4027 3 жыл бұрын
@@acegikmo we really want
@Flobbled
@Flobbled 3 жыл бұрын
@@acegikmo please do more
@supertenchoo4271
@supertenchoo4271 2 жыл бұрын
@@acegikmo make more.. you are an awesome teacher
@zekunyang4686
@zekunyang4686 2 жыл бұрын
Really good.Without subtitles, my English is not good, no, no, no
@richardguilliams7278
@richardguilliams7278 2 жыл бұрын
Hi freya. im currently having a strange issue with my code and havent found an answer anywhere online. was wondering if i could post it here and get your help if possible? it involves locking my players velocity to the normal of the wall they are climbing. My code seems like it should work but something is off becuase my player slowly moves away from the wall till the raycast loses detection
@samferrer
@samferrer Жыл бұрын
39.10 ... is practical to have a 180 deg field view theory? The camera can be rotated too. But if you have to, then lobachevsky is a good approach...
@Chimponaut
@Chimponaut Жыл бұрын
Great series, thanks for it. As a little animal side note: never lift adult cats in their neck this may result in breaking their neck. Cats lifting their kittens in the neck is fine because of the low weight of a kitten, the adult cat is not built to be able to support being lifted in the neck like that.
@Pandorarl
@Pandorarl 6 ай бұрын
37:02 Is normalizing the vectors more expensive than dividing the dot by the lenght of the not normalized vector. Dot(a,b)/lenghtA = cos(a)
@JarppaGuru
@JarppaGuru 2 жыл бұрын
23:00 idont want draw gizmos lines anymore. there is it forrach loop back. you allready knew you need it why erase xD
@rheemboi
@rheemboi 3 жыл бұрын
Where can I get your math library
@acegikmo
@acegikmo 3 жыл бұрын
github.com/FreyaHolmer/Mathfs
@rheemboi
@rheemboi 3 жыл бұрын
@@acegikmo thanks
@clown3949
@clown3949 Жыл бұрын
It`s really usefuul, if you already know math
@aotahuu744
@aotahuu744 2 жыл бұрын
Can anyone share a summary copy of this course in PDF or PSD?
@devil2005iscool
@devil2005iscool Жыл бұрын
if you import the crypto library you can use alot of these already public predefined functions
@ahmedfarooq7253
@ahmedfarooq7253 Жыл бұрын
♥️
@2002budokan
@2002budokan 2 жыл бұрын
Great content, great explainations, having a content list for huge videos is great; but why do you erase and rewrite all over the time?
@VillageIDT
@VillageIDT Жыл бұрын
The modulus is typically computed as the remainder of an integer division, so a negative dividend won't give an intuitive result. You can get around this by simply casting the dividend as an unsigned integer, so -1 becomes 4294967295 for a 32 bit integer. This should give you the desired result.
@muthu1593
@muthu1593 3 жыл бұрын
Could you please send me that Photoshop image
@JarppaGuru
@JarppaGuru 2 жыл бұрын
3:08:16 it all ready was you just made variable name
@egmeatom
@egmeatom 3 жыл бұрын
Why there is no subtitles? Can KZfaq create it's own?
@acegikmo
@acegikmo 3 жыл бұрын
the video is too long for youtube's auto-generation unfortunately :c
@imteajsaimun4134
@imteajsaimun4134 3 жыл бұрын
Make a video on how to shoot bullet in a round planet pls pls😊😊
@hariharanvnseven
@hariharanvnseven 2 жыл бұрын
Time 4:11:02 Whats corePt + localPt.x * xLocal + localPt.y * yLocal I thought xLocal as oriented x Direction and yLocal as oriented Y Direction why do we need to multiply LocalPt with xLocal and yLocal what it will do
@JarppaGuru
@JarppaGuru 2 жыл бұрын
39:21 you can get angle without getting dot you all ready had x and y distance for point before dot lol so you calculate again
@user-oe1zm6ub6i
@user-oe1zm6ub6i 3 жыл бұрын
I’m a developer from Taiwan. Because I can’t understand English, I rely on subtitles.Can you help me with subtitles? English is fine. This is a google translation. Please forgive me if I don’t understand. Thank you
@zalxder
@zalxder 2 жыл бұрын
3:05:24 the game opens and you try to walk but immediately die in lava at the end of the level and the credits roll
@samferrer
@samferrer Жыл бұрын
2.01:30 I think lerp(A,B,t) = A + (B-A)t is simpler
@skaruts
@skaruts 2 жыл бұрын
I wish you could turn on auto-generated subtitles. I don't have sound atm. :S
@JarppaGuru
@JarppaGuru 2 жыл бұрын
2:54:22 remove mph bcoz we not use feet/s in math lol or inch/second. can allways convert kph to mph lol
@JarppaGuru
@JarppaGuru 2 жыл бұрын
9:41 you have nice 2x2M square bcoz use radians without multiply with radius lol
@JarppaGuru
@JarppaGuru 2 жыл бұрын
41:35 i have ever in my life heard FOV as radians LOL use degrees sin cos tand and pi LOL and what is it matter it is same thing just need convert LOL
@boon8950
@boon8950 2 жыл бұрын
panoramic
@cmyk8964
@cmyk8964 2 жыл бұрын
I hate Godot’s default % behavior, and literally can’t think of a single use case where posmod() doesn’t work but % does.
@MrRoBot-wn4kp
@MrRoBot-wn4kp 2 жыл бұрын
Please open subtitle for this video
@diogoduarte4097
@diogoduarte4097 9 ай бұрын
Lerp? More like... LARPing as a slerp, amirite?
@deefdragon
@deefdragon 2 жыл бұрын
cat ears at 2:02:37 for anyone who wants to know why.
@markmanning2921
@markmanning2921 2 жыл бұрын
if I watch all your videos over a 3 day weekend is that binge watching :) p.s. dont use % when your array size is evenly divisible by 2, use & index++; index &= (array size -1); no division p.s. i also saw 7 regular polys not just 2 overlapping triangles :) but you knew that :)
@hero_big9234
@hero_big9234 3 жыл бұрын
Hi Freya. .
@JarppaGuru
@JarppaGuru 2 жыл бұрын
3:18:12 long story short. you will use dot product to rotate LOL where i am where i need go dot it rotate delta time
@user-lo5ws2pm5h
@user-lo5ws2pm5h 2 жыл бұрын
好教程,求字幕
@mykelas531
@mykelas531 3 жыл бұрын
"it is ma'am!"
@JarppaGuru
@JarppaGuru 2 жыл бұрын
6:16 YES that one is 120 write it LOL pentagon was 108? never thing that way i think 72 LOL 360/5 degrees are easy lol lets use radians 1 tau 6-24.... noh its pi2 use it you love it use pi lol
@samferrer
@samferrer Жыл бұрын
Debate about the circle. I say it is a circle with infinite radio ... or you say it is a line (180 deg) ... The same debate as in flat earth Yet, there is no infinity in computer science...
@dookcurruff9047
@dookcurruff9047 2 жыл бұрын
youre beautiful
@purplecat9942
@purplecat9942 Жыл бұрын
im fall in love i guess
@tyh7388
@tyh7388 2 жыл бұрын
It gets funnier and funnier every time photoshop crashes and you curse its name lol sorry not sorry XD
@mohokhachai
@mohokhachai 4 ай бұрын
The hardest thing i all the engine
@JarppaGuru
@JarppaGuru 2 жыл бұрын
6:33 its not circle then its straight line infinity cant you thing? make point one after another with 0 degree its straight lol, but you cant know you using tau its look better doing 3.14 pi 0.5tau 180degree lol making lines 0.5tau have to become circle nooooh its line
@underfilho
@underfilho 2 жыл бұрын
great lecture, but now I'm mad at you because you use τ and not π 😡
@numoru
@numoru 2 жыл бұрын
hey big head
Why can't you multiply vectors?
51:16
Freya Holmér
Рет қаралды 388 М.
The Continuity of Splines
1:13:50
Freya Holmér
Рет қаралды 1,3 МЛН
Тяжелые будни жены
00:46
К-Media
Рет қаралды 4,3 МЛН
Normal vs Smokers !! 😱😱😱
00:12
Tibo InShape
Рет қаралды 98 МЛН
it takes two to tango 💃🏻🕺🏻
00:18
Zach King
Рет қаралды 20 МЛН
5 tips for better platformer controls
5:22
The Shaggy Dev
Рет қаралды 171 М.
Giving Personality to Procedural Animations using Math
15:30
t3ssel8r
Рет қаралды 2,4 МЛН
The Beauty of Bézier Curves
24:26
Freya Holmér
Рет қаралды 1,9 МЛН
Math for Game Developers - Smooth Move(ment) (Linear Interpolation)
10:08
Essential Mathematics For Aspiring Game Developers
47:06
javidx9
Рет қаралды 377 М.
When Optimisations Work, But for the Wrong Reasons
22:19
SimonDev
Рет қаралды 773 М.
Visualizing quaternions (4d numbers) with stereographic projection
31:51
Normal Maps, Tangent Space & IBL • Shaders for Game Devs [Part 3]
3:18:11
An introduction to Shader Art Coding
22:40
kishimisu
Рет қаралды 897 М.
Apple watch hidden camera
0:34
_vector_
Рет қаралды 30 МЛН
Carregando telefone com carregador cortado
1:01
Andcarli
Рет қаралды 1,3 МЛН
Распаковка айфона в воде😱 #shorts
0:25
Mevaza
Рет қаралды 1,6 МЛН
Which Phone Unlock Code Will You Choose? 🤔️
0:14
Game9bit
Рет қаралды 10 МЛН