Interpolation & Velocity • Math for Game Devs [Part 4]
Вставка
- Опубліковано 8 тра 2024
- 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 - Наука та технологія
"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
I love this series. Clear and succinct, some parts dense but always approachable, and underpinned with practical application. Thank you Freya!
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!!
This lecture was amazing! I'm excited to watch your new shader series!
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!!!!🤣
I love the way you explained array wrapping using the modulo operator and index out of bounds.
The best explanation I've ever seen. Really fascinating.
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
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.
Sincerely Freya, thank you for sharing all this knowledge.
Freya, you're awesome and an inspiration. Thanks for the math.
Much appreciate if you can bring us more about math & shaders, excellent work!
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
Thank you so much for the course!
Nice video :D
Learned mutch. Keep up the good work :D
worth going through the whole series for the ears
You're a fantastic teacher!
Thank You Freya ....you are my first real math teacher i guess..god bless you.
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
This series has been absolutely fantastic! Also, Thor
Excellent video!
wow.. finally an enjoyable math teacher.. (no she is programmer, but with a good explanation skill.) :) I subscribed! Thank you for your work!
Please upload more lectures these are one of a kind
forsenE I C BAJS
I owe you a lot! Thanks!
Loved the video plz do more your amezing ❤️
We need people like yu
Everytime im comming there, I feel like im watching a missing season of big bang theory and i love it!
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 👍
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!"
@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.
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))
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 🙏.
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'
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!
Just take notes. You'll remember far far better if you do.
Your videos make me want to go back for a PhD in math, i love math
hi. love it . kind really want the ps picture , can i ? or where to get it . thanks
hi Freya, thanks for the series. where can i find the exported images of your explanation in photoshop? did you upload them somewhere?
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.
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
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!
@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
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);
We want more .
Really good.Without subtitles, my English is not good, no, no, no
2:09:40
Do the negative volume!
It will suck out voices from your head!
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...
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.
last one for now yeah! I have considered making more parts if people would want me to, but, nothing planned yet
@@acegikmo we really want
@@acegikmo please do more
@@acegikmo make more.. you are an awesome teacher
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 :)
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)
1:51:15 you're turning into mathematician here, haha.
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.
if you import the crypto library you can use alot of these already public predefined functions
23:00 idont want draw gizmos lines anymore. there is it forrach loop back. you allready knew you need it why erase xD
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.
Wait, got my matrix multiplication mixed up. All good!
3:08:16 it all ready was you just made variable name
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
where did you get that little 3d xyz thing you hold? I want one.
Great content, great explainations, having a content list for huge videos is great; but why do you erase and rewrite all over the time?
♥️
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
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
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
It`s really usefuul, if you already know math
2.01:30 I think lerp(A,B,t) = A + (B-A)t is simpler
Make a video on how to shoot bullet in a round planet pls pls😊😊
2:54:22 remove mph bcoz we not use feet/s in math lol or inch/second. can allways convert kph to mph lol
I wish you could turn on auto-generated subtitles. I don't have sound atm. :S
Where can I get your math library
github.com/FreyaHolmer/Mathfs
@@acegikmo thanks
Could you please send me that Photoshop image
Lerp? More like... LARPing as a slerp, amirite?
Why there is no subtitles? Can UA-cam create it's own?
the video is too long for youtube's auto-generation unfortunately :c
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
Can anyone share a summary copy of this course in PDF or PSD?
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
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 :)
9:41 you have nice 2x2M square bcoz use radians without multiply with radius lol
panoramic
I hate Godot’s default % behavior, and literally can’t think of a single use case where posmod() doesn’t work but % does.
Please open subtitle for this video
"it is ma'am!"
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.
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
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
cat ears at 2:02:37 for anyone who wants to know why.
Hi Freya. .
好教程,求字幕
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...
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
youre beautiful
im fall in love i guess
It gets funnier and funnier every time photoshop crashes and you curse its name lol sorry not sorry XD
The hardest thing i all the engine
great lecture, but now I'm mad at you because you use τ and not π 😡
hey big head