Math for Game Programmers: Juicing Your Cameras With Math

Поделиться
HTML-код
  • Опубликовано: 16 окт 2024

Комментарии • 122

  • @yuler_
    @yuler_ 2 года назад +43

    I come back to reference this talk every now and then so
    0:00 Overview
    2:41 Juice intro
    3:27 Camera shake
    6:40 Camera shake 2D
    7:27 Camera shake 3D
    9:53 Camera shake implementation
    15:07 Camera shake takeaways
    15:37 Smoothed motion
    21:26 Framing
    27:00 Voronoi split-screen cameras

  • @raiju6090
    @raiju6090 6 лет назад +166

    the split screen demonstrated is really cool

    • @higgins007
      @higgins007 6 лет назад +4

      Yeap totally badass. I am so stealing this idea! :)

    • @hexzyle
      @hexzyle 4 года назад +2

      Aegis Defenders did this ruclips.net/video/4_8zvHQyy9A/видео.html

  • @KKomalShashank
    @KKomalShashank 3 года назад +7

    Squirrel Eiserloh was my game programming professor at SMU Guildhall. He was the best teacher I ever had. The most amazing person, who explained complex concepts in such a cool, interesting and easy-to-understand manner. Everyone has their No. 1 teacher that they remember fondly for the rest of their lives. For me, that teacher is Squirrel Eiserloh.

  • @lisyarus
    @lisyarus 3 года назад +29

    A tiny improvement on asymptotic averaging for anyone who comes by: if you're doing the timestep-dependent variant, i.e. x += (targetx - x) * smoothness * timestep, it's better to do x += (targetx - x) * min(1.0, smoothness * timestep) so that you don't overshoot when your timestep gets too large (e.g. unexpected lags, framerate drops, etc).

  • @ObeseWizard
    @ObeseWizard 5 лет назад +84

    Holy frick this is an insanely good presentation. You don't think about these things when you play games but they make a world of a difference. Even his silly little platformer demo for this instantly gave me a "polished" vibe just because of the smooth camera.

    • @homeyworkey
      @homeyworkey Год назад +1

      lol i feel i recognie u from rocket league but i got no clue

    • @ObeseWizard
      @ObeseWizard Год назад +1

      @@homeyworkey lol yeah I used to play an absolute ton of rocket league, I don't play much anymore though. Same name in game

    • @patrickmayer9218
      @patrickmayer9218 10 месяцев назад +2

      Interesting as fuck that you guys would've never heard from one another again if you didn't happen to both be into learning about game dev cameras (and also kinda wholesome!)

  • @demonsnails
    @demonsnails 6 лет назад +44

    The part about camera shake was very insightful

  • @masondeross
    @masondeross 3 года назад +7

    This talk deserved to be a full hour; great talk and especially good for the limited time allowed.

  • @RealRushinRussian
    @RealRushinRussian 5 лет назад +24

    Great talk! I keep coming back to it every now and then. Using perlin noise instead of simple random numbers or designing different rules for camera movement in certain directions are the things that are easy to overlook and not even consider but they could make a huge difference in making sure that your game just feels right.
    One interesting thing to point out is that for some games you can choose not to shake the camera itself but rather to shake the UI. I've just noticed this in Doom (2016) and it appears to work well. The player's camera does not move at all, but all the interface elements do. Great way to add "weight" and "juice" to explosions and hits without messing with the player's aim or spatial awareness. There's still vertical recoil from some of your own shots but that's rather standard and expected by players anyway. I assume shaking the UI works best if you have UI elements in most if not every corner of the screen so that it feels more immersive.

  • @torphedo6286
    @torphedo6286 Месяц назад

    I love all the illustrative graphics, little visualizations like that help a lot

  • @scottcourtney8581
    @scottcourtney8581 6 лет назад +15

    The Voronoi split screen technique is bloody brilliant!

    • @Sparrow420
      @Sparrow420 4 года назад +2

      totally, first time i saw it i was speechless.

    • @hsvfanjan17
      @hsvfanjan17 3 года назад +1

      I think it's an excellent solution for a 2 player split screen but when he showed it being used for 4 players, some of the players' screens were way too small. I guess with some tweaking it's possible to solve it, though :)

    • @Lakius
      @Lakius 3 года назад +1

      It'd be simple enough to calculate the area or weighted area to determine which view needs to gain space and which view could/should lose some. You could then dampen the rate of change too. What I mean by weighted area is that a square ish view has more effective area for a player to navigate with, so should be cut off more than that poor pair with weird slivers of view.

  • @ZeroZ30o
    @ZeroZ30o 6 лет назад +109

    Great talk, very well explained and no wasting time

  • @jitspoe
    @jitspoe 4 года назад +3

    Instead of Asymptotic Averaging, I would recommend using damping, which is effectively the same, but takes a delta time into account so it's not framerate dependent. Equation is very simple: (src * factor + dest * dt) / (factor + dt), where src is the source (starting) value, dest is the destination (target) value, factor is the damping factor (0 = instant, and you can go up from there), and dt is the delta time or frame time.

    • @alfredoadam8869
      @alfredoadam8869 4 года назад

      jitspoe hello,i have some trouble on this .in 3d game ,if i rotation the camera then the rotation will cause lazy camera follow but i only want that when i move the camera follow lazily.sorry for my bad english😂

  • @sosasees
    @sosasees 3 года назад +2

    Screen Shake is so important that early arcade games used to make up for the hardware's inability to do screen shake
    by flashing the colors of the screen.
    The effect can be really intense and deadly to epileptics.
    I'm really glad that we can now do screen shake.
    This effect is subtler, and by that I mean that it's still intense
    but only as intense as it needs to be.

  • @chadverrall9516
    @chadverrall9516 11 месяцев назад

    1) Camera shake in 3D, Translation helps show how it effects your hero in a 3rd person game and foreground, while Rotation is mostly going to effect things in the distance or background. Typically in 3D you also want to reduce the amount of roll you do, as that tends to make people sick. While your argument for no translation movement (or is very bad) might be accurate for a First Person game, I think it's incorrect with a 3rd person game.
    2) Camera shake in VR can be done, but in general you want to use all translation changes Vs rotation (because Rotation will make people sick). We had camera shake in Lone Echo 1 & 2 with just translation and it worked very well.
    Overall an amazing talk!

  • @anonymous-de3mn
    @anonymous-de3mn 6 лет назад +9

    I am not at all in the game development area, I am just a mere gamer, but this was extremely interesting and very well explained.
    Great presentation of a very interesting aspect of games !

  • @REAL-NANO
    @REAL-NANO 5 лет назад +4

    Actually on my forth beer when 9:00 . Was gettin a bit dizzy, TY for killing that slide.

  • @dioricergy6931
    @dioricergy6931 3 года назад +3

    The exponential increase shake feels wrong when implemented in rapid shooting weapon. The early shoots will have no noticeable recoil feel. But it seems great to emphasize killing streak or successive combo.
    I think we should have several instances of shake in different intensity and amplitude for various context such as explosions, shoots, constant shake etc.

  • @thego-dev
    @thego-dev Год назад

    note: in practice, for 3d (projected onto a 2d screen), pitch and yaw _are like_ "2d translation" and roll _like_ "2d rotation", so 3d rotation by itself is "equal to" 2d's rotation+translation, which is preferred, and 3d translation a bad kinda jittering ground effect dependant on perspective that, if you even _could_ do in 2d, _you would avoid like the plague_
    so in essence, good camera shake in 2d and 3d "work the same"

  • @alexslavski5056
    @alexslavski5056 6 лет назад +2

    Superb!!! This is a brilliant example of how to make an interesting and informative presentation.

  • @slmjkdbtl
    @slmjkdbtl 4 года назад

    the demos are so high quality

  • @NoahtheEpicGuy
    @NoahtheEpicGuy 4 месяца назад

    an additional method of 3D camera shake, which is by far my favorite, is projection, frustrum, or shear shake. (I don't know the actual term for it, but shear is probably the most understandable, since it's how Build Engine games and Doom '93-derived games did looking up and down in a column-based renderer: shearing the Y axis projection.) It's essentially a 2D shake in 3D, where you shear the projection matrix about the X and Y axes. In simpler terms, the vanishing point moves around instead of staying at the center. I'm lacking the vocabulary to do it justice here.
    Lethal Company is the best real world example I have, and is most noticeable when a spike trap slams down.

  • @Ratstail91
    @Ratstail91 5 лет назад +2

    That star wars camera always blew me away. I'd love to do that myself someday.

  • @aleju
    @aleju Год назад

    Very good presentation! I used to work at Tt Games (didn't implement the split-screen myself though). A friend of mine told me that the split-screen in Lego Star Wars made him dizzy though. Luckily, it can be disabled in settings.

  • @betatester03
    @betatester03 6 лет назад

    This is a FANTASTIC talk. Concise and extremely helpful.

  • @ZoidbergForPresident
    @ZoidbergForPresident 6 лет назад +4

    Cool stuff!
    Would love to see more details about that Voronoi screen-splitting.

  • @thelegendgamer33
    @thelegendgamer33 6 лет назад

    Excellent talk, very clear and detailed yet focused and concise.

  • @freedom_aint_free
    @freedom_aint_free 2 года назад

    Amazing video, full of excellent programming tips and tricks !

  • @JusTyr3c
    @JusTyr3c 5 лет назад +1

    Great and very efficient talk. Thanks a lot

  • @HeadphoneTarnish
    @HeadphoneTarnish 3 года назад

    This guy blows it out of the water every year

  • @Lines-In-The-Sand1
    @Lines-In-The-Sand1 6 лет назад

    Terrific talk. Lots of very practical and useful information.

  • @polaris911
    @polaris911 6 лет назад +1

    that was really helpful, especially since you had visual examples. Thank you for sharing

  • @cacheman
    @cacheman 6 лет назад +9

    The slides are at mathforgameprogrammers dot com

  • @sirdiealot7805
    @sirdiealot7805 6 лет назад

    Awesome talk, thank you. I don't remember seeing this kind of split in any game. One famous game that unfortunately messed up the multiplayer camera is Spelunky.

  • @rumfordc
    @rumfordc 6 лет назад +1

    awesome talk. every point was useful

  • @muskop42
    @muskop42 3 года назад +2

    The talks that he referenced:
    The Art of Screenshake: ruclips.net/video/AJdEqssNZ-U/видео.html
    Juice it or Lose it: ruclips.net/video/Fy0aCDmgnxg/видео.html

  • @Gidaio
    @Gidaio 4 года назад

    Super interesting. I'd love to look more into the split-screen thing, but the site mentioned doesn't have this talk...

  • @chrisME1320
    @chrisME1320 6 лет назад

    Very interesting talk, I've been thinking of making a splitscreen of this sot for some time now.

  • @munk_ken
    @munk_ken 3 года назад +2

    For vr, why not use a post processing blur variance to make it feel like a camera shake without causing the person to dispose of their recent meal.

  • @TheFinagle
    @TheFinagle 3 года назад

    One more comment for shake screen in 3D - dont mess up the players aim (what their cross hairs point at or what they would interact with if clicking) unless its your specific intent that their aim be thrown off. Its likely you would do both, but make sure whatever happens is on purpose not an accident or side effect.

  • @Lucrecious
    @Lucrecious 3 года назад +1

    Anyone know where the mentioned "Interpolations and Splines" GDC video from 2012 referenced at 17:08 is at?

  • @sagarpatel1633
    @sagarpatel1633 6 лет назад +6

    Thunbs up fo split scrren demonstration :)

  • @zdspider6778
    @zdspider6778 Год назад

    31:23 Interesting stuff. Where is his "Interpolations and Splines" video? (last text from that slide)

  • @tiagodarkpeasant
    @tiagodarkpeasant 4 года назад

    that focal point could be a good idea for a classic resident evil, the camera can move, but every area could have a point of interest making that cinematic camera effect

  • @benjaminramsey4695
    @benjaminramsey4695 6 лет назад

    Wow, well done presentation!

  • @hymen0callis
    @hymen0callis 6 лет назад +10

    learned a new word today: "asthmatotic"

  • @_gamma.
    @_gamma. 5 лет назад +1

    You could do camera shake in vr with a shader that only effects the edge of the player's vision, keeping their focus clear and having the effect more in the background

  • @Truephoria
    @Truephoria 4 года назад

    You could make a whole game centered around the splitscreen technique!

  • @Lugmillord
    @Lugmillord 6 лет назад

    This was fantastic and really useful!

  • @MyLittleMagneton
    @MyLittleMagneton 6 лет назад +1

    Are they using clip-on stereo mics ... ?

  • @projectrat5564
    @projectrat5564 6 лет назад

    These are great resources

  • @rustyshackleford6534
    @rustyshackleford6534 3 месяца назад

    The "asymptotic averaging" is just a low-pass filter(IIR) in another form.

  • @vertxxyz
    @vertxxyz 6 лет назад +14

    I just wonder why it wasn’t mentioned that asymptotic averaging can just be implemented with Lerp, it’s an easy way to let people understand lerp if you describe it like the talk did, but then quickly point to the function as the shorthand afterwards.

    • @CharalamposKoundourakis
      @CharalamposKoundourakis 6 лет назад

      Thomas Ingram Cause not all frameworks support lerp. You'd have to do it yourself in many cases.

    • @Xarbrough
      @Xarbrough 6 лет назад +7

      Because Lerp (linear interpolation) would be a misguiding name, since he is not moving the camera linearly towards a target, but it moves fast at the beginning and gets slower the closer it is to its target. Using the Mathf.Lerp function in e.g. Unity gives beginners an easy way of not having to type out the formula, but using it in the way shown makes the function not be a true linear interpolation anymore. Basically, Mathf.Lerp is meant to be used in a way where the parameter t is animated linearly from zero to one, but the shown type of smooth camera movement would just input a fixed value of t = 0.1, giving the correct result, but misusing the name 'lerp'.

    • @SqueakyNeb
      @SqueakyNeb 6 лет назад +3

      @Thomas Ingram Actually that x*.9+targetx*1. formula is exactly what lerp is (q = p*(t-1)+rt, for t = [0,1]). It can be implemented with lerp, yes -because it quite literally is lerp :P

    • @SqueakyNeb
      @SqueakyNeb 6 лет назад +2

      @Chris Y lerp is exactly what it is. You're moving linearly from points a to b, by a fixed amount, and a and b are moving over time. And mathematically, lerp is exactly that x*.9+targetx*1 formula.

    • @thomasspader6950
      @thomasspader6950 6 лет назад

      I think that with asymptotic averaging you aren't moving linearly. If you moved from x = 0 to x = 1 with lerp, you would have some set of N steps where each step moves you 1/N. If you moved from x = 0 to x = 1 with asymptotic averaging, you would first move to x = .5, then x = .75, then x = .875, etc, which is not linear.

  • @ZeroZ30o
    @ZeroZ30o 6 лет назад +1

    Does anybody know where to find the talks mentioned at the end?
    "Fast and Funky 1D Nonlinear Transforms (GDC 2015)"
    "Random Numbers (GDC 2014)"
    "Interpolation and splines (GDC 2012)"

    • @ZeroZ30o
      @ZeroZ30o 6 лет назад

      Oh, thanks a lot!

    • @tenebre5512
      @tenebre5512 6 лет назад +1

      essentialmath.com/tutorial.htm

  • @yapayzeka
    @yapayzeka Год назад

    5:34 now that's I call teaching 😃

  • @BarcelonaMove
    @BarcelonaMove Год назад

    Do somebody have a link to the slides?

  • @oels9507
    @oels9507 5 лет назад

    How do you choose which perpendiculars to use to create the boundary edges?

  • @JamUsagi
    @JamUsagi 6 лет назад +2

    The 4 player voronoi regions look like they could have been made more accurate. I don't blame him for not doing it though, that sounds like it'd be a real pain.

  • @ThePC007
    @ThePC007 6 лет назад +1

    So, how would that awesome split-screen work in a 3D environment?

    • @Lugmillord
      @Lugmillord 6 лет назад +2

      My guess: Surprisingly similar. You have a zoomed out camera that encompasses all players and use that image as your 2D plane.

    • @16m49x3
      @16m49x3 6 лет назад +2

      Just look at any lego game in multiplayer

  • @KaranChecker
    @KaranChecker 6 лет назад +2

    Split screen was wow!
    The rest pretty standard.

  • @TheDeadlyDalek
    @TheDeadlyDalek 6 лет назад

    Graphs I have seen of Perlin noise look like smoothly connected "hills" and "valleys". Wouldn't the small offset of +1 for the seeds result in only a small variation in values since it will get the values of a parallel set of points only slightly offset from the series "above" and "below" it?

    • @patakk8145
      @patakk8145 6 лет назад

      Good point, but in my experience +1 is a huge difference and looks almost random, as opposed to +0.03 for example.

  • @andrewdunbar828
    @andrewdunbar828 Год назад

    trama, parabula, and cetera

  • @viniciusschadeck4992
    @viniciusschadeck4992 14 дней назад

    Can someone please tell me how to make this noise stuff without this specific engine that i not even know just for watching this, because i'am making a game i almost pure JavaScript and already have Perlin Noise running to make my maps, Soo, just need to better understand how to use my foggy perlin noise code to pick a value... well, wait a second... the XYZ of the game is the same as a place in the noise? And the extra dimension time, using deltaTime from the game is a fourth dimension to make the gamera shakes crazy? God, i hope soo, i will try make it, because my camera code already has some offset functionality and i was trying to use some math arc calculations to make the shake smooth not random, but the end results are not exactly cool as i spected, also the directional "trauma" is fine, but not adds what i though it would add to a 2D game LOL

  • @harshdeepsinghmudhar6385
    @harshdeepsinghmudhar6385 3 года назад

    Only rotational in 2D is pretty good for failed actions or locked choices.

  • @benjaminsandeen9241
    @benjaminsandeen9241 2 месяца назад

    lol, I just watched the talk that occurred before this, and I watched this guy close the prior presenter's laptop and figuratively shove him off the podium 😬

  • @raph2550
    @raph2550 5 лет назад

    This is great

  • @jacquesdurand4416
    @jacquesdurand4416 4 года назад

    Good talk. I keep seeing Ben Affleck looking at the speaker

  • @ace100hyper3
    @ace100hyper3 6 лет назад +4

    The intro sound feels like you're eating a cockroach

  • @rafalradziwill9017
    @rafalradziwill9017 5 лет назад

    Where I can get this asymptotic averaging tool

    • @lukavelinov7419
      @lukavelinov7419 3 года назад

      It's not a real tool, it's just a formula that you can apply to get smooth, asymptotic movement.

  • @soirema
    @soirema 2 года назад +1

    that's barbaric that they dont let people finish their presentations, Im sure no one of the audience wouldn't mind

  • @AirskiiMusic
    @AirskiiMusic 6 лет назад

    You would think the GDC team could find better audio technicians! take the left Chanel, compress it then copy it to the right channel, that will eliminate the phasing and panning!!!! :)

  • @1rez378
    @1rez378 6 лет назад +1

    20:50 Wait, can't this be done with power function?

    • @omgomgomgd
      @omgomgomgd 4 года назад

      no, because the camera/player could move separately from that control every frame
      a power would not be able to capture the change in position easily, it's just easier to represent as "every discrete time step, do this"

  • @viniciusschadeck4992
    @viniciusschadeck4992 14 дней назад

    I tried, worked, but it not are exactly fast... i guess i have to scale my noise value to a small value, it moves, but take too long from shake down to shake up, if it was going to that direction, soo, putting a little more love will make it really fancy camera shake... My JavaScript Game looks more neat than some really badass engine based stuff right now, kinda kidding but actually not exactly, i'am using perlin noise and others advanced math stuff to make some cool generations, and this noise stuff was a piece of cake, also give me a better way to handle entity attributes, for now i had handed coded a specific code for player character, but after this idea, for sure it can run all entitys under the same hood, and just will had custom stuff if really needed, but i doubt about it, at least for a long time LOL

  • @AximVidya
    @AximVidya 3 года назад +1

    Pro tip for screen shake: Put a toggle in the game options and don't put too much effort into the actual effect cause 95% of players will set it to off.

  • @2archarry
    @2archarry Месяц назад

    The dev that kicked better jump dev

  • @Gooosek
    @Gooosek 2 месяца назад

    But i need a camerashake in vr 😭😭

  • @jgcooper
    @jgcooper 6 лет назад +25

    please dont do the "lazy" camera follow in platformers that was shown at the start of this talk.
    instead you want the camera to do the opposite, the center of the camera ought to be IN FRONT of the player respective to what direction they're moving, not behind as is the case in this video.

    • @docill9155
      @docill9155 6 лет назад +37

      The way you fix this is by having the camera target ahead of the player's intentional movement instead of targeting the player himself.
      You still want the "lazy" camera movement, so it doesn't snap to the players jerky movement. Again just target ahead when the player starts to move.

    • @jgcooper
      @jgcooper 6 лет назад +9

      yes, the key part is having it ahead, the problem is not the "lazy" aspect, but as a very prominent example it is an easy trap for others to fall in and follow, and it is sadly too common in indie platformers, for example it is one of the things that dragged down Dead Cells.
      edit: not just inde platformers, but also seen in old retro platformers.

    • @tehf00n
      @tehf00n 6 лет назад

      so a quick multiplication of -1 should do?

    • @jgcooper
      @jgcooper 6 лет назад +2

      lol no

    • @MatthijsvanDuin
      @MatthijsvanDuin 6 лет назад +5

      Super Mario World did this right though. I never consciously noticed this until I saw this brilliantly evil section in an SMW romhack which puts platforms and obstacles on a parallax-scrolling "layer 2", which is tied to the camera motion: ruclips.net/video/HLYGLanXyjE/видео.htmlm52s Notice at 10:37 mario moves to the left, and in response the camera quickly pans to the left to place it ahead of mario again (and as a side effect moves a layer 2 platform and causes mario to fall to his death).

  • @lexsec
    @lexsec 3 года назад +3

    I hope he didn't quite rudely kicked out the previous speaker...

  • @finfan7
    @finfan7 6 лет назад +2

    Good knowledge in the shake and follow sections but that voronoi split, while being conceptually 'cool' because it's new and different, seems just awful in every other way.

  • @krebgurfson5732
    @krebgurfson5732 3 года назад +2

    yes, screen shake. the option EVERYONE turns off if available, why do devs continue to do this.

  • @willegg8436
    @willegg8436 3 года назад

    Who is Math and why does want to juice me?!

  • @rasz
    @rasz 6 лет назад +4

    shaking - author is confounding feeling with visual effect. As a player I HATE this type of shit, but I bet marketing types find it looking great in demos.

    • @johnterpack3940
      @johnterpack3940 5 лет назад +2

      Amen. I don't know who started that or why people think it's cool. It is easily the worst trend in gaming. I'd stop playing a game the instant it shook the screen.

  • @bigmofo1122
    @bigmofo1122 6 лет назад +1

    At 28:32 'player' become male. Both of them. They each get half the screen.

  • @Kakerate2
    @Kakerate2 3 года назад

    17:08 for later me

  • @yoruhana190
    @yoruhana190 6 лет назад

    Those are nice technics, but where is the math?

  • @47Mortuus
    @47Mortuus 4 года назад +1

    Somebody tell this guy that translation includes rotation!

  • @biggiecheese2172
    @biggiecheese2172 2 года назад

    I always disable the shitty diagonal splitscreen garbage lmao

  • @Drecon84
    @Drecon84 6 лет назад

    Him clearing his throat every few sentences is very distracting.