Ocean waves simulation with Fast Fourier transform

Поделиться
HTML-код
  • Опубликовано: 2 авг 2024
  • How does ocean waves simulation with Fast Fourier transform work?
    Source code:
    github.com/gasgiant/FFT-Ocean
    Music:
    / igor_vaiman
    Catlike Coding on Gerstner waves:
    catlikecoding.com/unity/tutor...
    3Blue1Brown on Euler's formula:
    • e^(iπ) in 3.14 minutes...
    3Blue1Brown on Fourier transform:
    • But what is the Fourie...
    References:
    github.com/gasgiant/FFT-Ocean...
    0:00 Intro
    1:02 Waves Math
    2:52 Fast Fourier Transform
    5:36 Oceanographic Spectra
    9:24 Algorithm Walkthrough
    11:04 Cascades
    12:25 Height Sampling
    13:53 Outro
    #unity #shaders #water
  • ИгрыИгры

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

  • @peterhall6656
    @peterhall6656 2 года назад +342

    You have done some good work on this issue. I am a retired expert in Fourier theory and it is interesting to see how the FFT still rocks on 50 years ago when I first used it.

    • @warpigs330
      @warpigs330 2 года назад +34

      something tells me that we will be using fft for as long as we do computing. It is so fundamental.

    • @ShatabdaRoy115
      @ShatabdaRoy115 2 года назад +19

      holy moly. I'm 14 and I got alot to learn

    • @Francesco_Armillotta
      @Francesco_Armillotta 2 года назад +13

      Basically you can study whatever field in physics and fourier theorem is everywhere :)

    • @zacharychristy8928
      @zacharychristy8928 2 года назад +7

      I remember learning about it for the first time, and it totally changed how I thought about information. I used them like crazy in my next internship on software-defined radar systems. They're an insanely good tool to have.

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

      @@ShatabdaRoy115 the e^2pi*i part is really just the number 1
      e^pi*i is negative 1
      e^(angle in radians)*i is the number on the complex unit circle distance 1 from the origin at the angle you put in

  • @phillipjoyce8825
    @phillipjoyce8825 3 года назад +309

    Got about 7 minutes in until my brain rejected it. Stunning work, good on you for being so good at maths! I wish I could understand what you've done properly

    • @dinosyr
      @dinosyr 3 года назад +8

      I made it about 6 mins i guess im more smooth brained lol

    • @RomekRJM
      @RomekRJM 2 года назад +40

      I feel this video is too condensed. There are multiple complicated math formulas appearing on the screen in 2-3s intervals at some point. It is certainly a good glimpse for someone looking for high level overview on how to generate oceanic waves, but to cover it completely clip would have to be 2h+. Kudos for making it though!

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

      @@RomekRJM the linked videos in the description help make a bit more sense of it. Not that it helped me much; I’m absolute garbage at math

    • @santosmichelena3519
      @santosmichelena3519 2 года назад +9

      I understood everything quite clearly but I think it's only because I and doing my masters in a very very closely related topic. The video is definitely very dense.

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

      well done, for me 4 min was enough)

  • @papel6280
    @papel6280 2 года назад +112

    Can’t believe I am learning Physics in a Unity tutorial-this is so well-made!

    • @gamedevwithjacquelynnehei465
      @gamedevwithjacquelynnehei465 2 года назад +9

      I totally get what you mean! It's crazy how much math and science you use in game development. Watching videos like this just shows me how much I don't know.

    • @damislav
      @damislav Год назад +4

      @@gamedevwithjacquelynnehei465 if one would know that math and physics can actually be fun and used for something, maybe I would bother to learn it in school xD

    • @TheArrowster
      @TheArrowster Год назад +2

      ​@@gamedevwithjacquelynnehei465 Computers are all about math and science. Virtual environment is just a simplified version of real world.

  • @NicholasSpies
    @NicholasSpies 2 года назад +72

    I was at a computer graphics company (on of the first doing commercial work) in 1987 and saw what was at the time an astounding, color still of a perspective view of the surface of a calm sea, bathed in the golden light of a sunset. It had taken hours, perhaps even over night, to render on a minicomputer. It was quite advanced at the time.
    I was told by the guy who modeled the scene that it involved sin/cos functions, which was more or less obvious because it was periodic but I didn't really understand how (and the source was FORTRAN, which had to be batch processed from a stack of Hollerith [IBM ]cards). So it was a pleasure to find this explanation.

  • @ltmcolen
    @ltmcolen 2 года назад +47

    I've personally had instances when we were at anchor,
    the current came from the north and was stronger than the wind coming from the south.
    Pushing the ship with her stern towards the wind. The strangest part was that the waves also came from the south
    hitting the transom. It's like a huge bass drum being kicked irregularly

  • @redsteph
    @redsteph 2 года назад +50

    This is awesome, hope you’ll cover ocean shading, LOD management etc as you’ve said!

  • @joshko9030
    @joshko9030 3 года назад +30

    Amazing work man! Getting the feeling that this is gonna blow up

  • @flatspinrc5262
    @flatspinrc5262 3 года назад +32

    Hope there's more videos coming! They are all beautifully presented.

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

    THIS IS GREAT. THANK YOU!!
    its so hard to find detailed breakdowns of complex topics that arent targeted to specialists or total beginners. 100% sub'd and excited to see what else you have to offer! THANKS AGAIN.

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

    Man, youtube recommendations have been awesome lately! Finding all of these small but amazing channels left and right

  • @tiporari
    @tiporari 3 года назад +18

    I implemented your GitHub code in a unity project with XR enabled. These waves look awesome in VR. I assumed performance would be an issue, but it runs perfectly. Thanks for creating this. Giving me an awesome jumping off point for a novel VR experience.

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

      Oh, thanks for the idea! I was hoping to implement it in Unreal, but VR in addition to ocean would be great. Here's hoping I won't get seasick xP

  • @curiouspers
    @curiouspers 2 года назад +7

    This is very high quality content, thank you! I hope you're doing great and will return with more great stuff!

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

    Great video! Thanks for covering the math and describing the issues involved.

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

    What a great video! Thank you for going into the details and providing detailed references.

  • @wii3willRule
    @wii3willRule 2 года назад +10

    Man, this is awesome. A bit dense/condensed, but an excellent high level overview-- I learned a lot. I'm completely new to FFT, so I know that I'm going to be checking out the 3B1B video next, but this was honestly the coolest introduction.

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

    this video is just awesome.And I am really interested in topics the current video does not mention like ocean shader and mesh LOD.Looking forward to see more about these!

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

    Outstanding work . Speechless but still commenting seeing how underrated this vid is .

  • @neuralworknet
    @neuralworknet 10 месяцев назад

    Omg this channel is insane! I really loved your videos. Keep up man!

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

    Never thought fourier transforms would work for me one day
    Dude the world is a better place with u in it
    So you could help people understand better and more tangible
    Great job
    Keep up the good work

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

    wow this looks ultra realistic, good job!

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

    Subscribed, you deserve more attention on youtube. Thanks for that video!

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

    What a very outstanding explanation, i love your work!

  • @loganlee7510
    @loganlee7510 5 месяцев назад

    Very easy to understand :)
    Thank you for making this video

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

    I once worked on a lobster fishing boat 90 miles off the coast of North Carolina, and there were rare occasions where the ocean was amazingly flat, as depicted in this simulation. But most of the time there were rolling hills and even mountains of water.

    • @JumpTrajectory
      @JumpTrajectory  2 года назад +2

      Thank you for the observation! This is swell, I think. I didn't know how important it is for the look of the ocean at the time as I was making the video, but now I understand that it is present most of the time. Good news is that it is already supported in the code, I just didn't include in the scenes for the video.

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

    Great topic and extremely detailed, such great work nice!

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

    Super useful and very nicely done!

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

    Pretty cool to see the applications of what you learn in differential equations

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

      if you do anything even mildly related to math/physics/computation in the future it will all be diffy qs

  • @abhishek.g0yal
    @abhishek.g0yal 3 года назад

    Awesome 🔥🔥🔥
    Instantly attention captured

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

    Great explenation and visualisation!

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

    Fantastic work, thank you

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

    Dude. Your video is great. Keep up the good work.

  • @danielprovder
    @danielprovder 2 года назад +2

    Im not sure the accuracy of this, but I’ve read that there is something about pink noise as the spectrum of the ocean, it has a characteristic rise in amplitude as the frequency decreases. What’s interesting is that the pink noise is invariant under Fourier transform, and I wonder if applying this randomness instead of Gaussian would change the already beautiful results. Looking forward to more content!

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

    Excellent video! Great job.

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

    This is so interesting. People like you make games beautiful. Thank you :)

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

    nice job man keep going amazing content!

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

    Maaaan RUclips always recommends videos explaining the gap in your understanding for an exam perfectly right after the exam XD

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

    This is amazing work - I'll be looking out for a Patreon page soon. I hope you keep making videos - subscribed!

  • @norbertpape1993
    @norbertpape1993 10 месяцев назад

    Beautiful work!

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

    This is so cool... I've gotta try this method in my Archipelago project! Thank you for posting!

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

    Really interesting and well made!!

  • @mrcao-fb9wx
    @mrcao-fb9wx 2 года назад

    One of the best video on the topic!

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

    This is superb! Definitely subscribing!

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

    Beautiful presentation. Subbed!

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

    Great work! Thanks!

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

    Thank you for good knowledge, I will try to digest it into use.

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

    좋은 강의 영상입니다! 많은 도움이 되었습니다~! 정말 감사합니다.

  • @muhammednedimsahvelet4431
    @muhammednedimsahvelet4431 10 дней назад

    Thank you so much. This video is so helpful.

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

    What a genius applying these advanced transforming things. Only thing you could have added is clouds /sky movement to make it even more vivid.

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

    Great explanation!

  • @TopConductor
    @TopConductor 7 месяцев назад

    Dude, you are legend!

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

    Very nice work! I thought the foam was a bit much on some of the waves. They gave the impression that they were hitting some rocks that were out of the frame. Then again there must be an indication of reflected waves if it was the case which I did not notice. It's amazing how we get attuned to how the sea behaves: our vestibular system starts doing some Fourier analysis after spending some time on the see and we get sea legs when we are back on land.

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

    Huge like to this , great explanation! bravo!

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

    It's great work. Thank you!

  • @CB-hn6pr
    @CB-hn6pr 3 года назад

    Spectacular !

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

    Excellent and fascinating work. It is very neat how you can synthesize a realistically-looking ocean based on rigorous physics of wave dynamics. I have one comment regarding the rendering, for example at 11:05. While the theory used is certainly for non-breaking waves, and therefore the waves by themselves would not produce foam, one can easily imagine a situation where the foam is pre-existing and the waves just move it around. Now, what happens in this animation extract is that the white patches (which I perceive as foam) move with the wave crests. In my opinion, you would get a more realistic effect if the foam remained on the air-water interface essentially at the same points in space horizontally, and the waves simply propagated over it. If you want to be maximally realistic, you could consider the back and forth motion associated with the horizontal oscillations produced by each wave cycle, and even, possibly, the slow drift, produced by the Stokes drift (although that latter aspect would not add much to the realism on the time scale of a few seconds).

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

      Yeah, the foam definitely should be persitent. There are difficulties in meshing it with the cascades. There are two ways to do it, basically, and both are not perfect. Still working on it, actually. It is relatively easy to make it move with the wave cycles, though.

  • @DaveJ6515
    @DaveJ6515 10 месяцев назад

    When something conceptually and mathematically so elegant works so well for so long in so many different fields, it probably holds some fundamental meaning.

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

    dude you really deserve millions of subscribers

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

    Thanks for the knowledge.

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

    pretty nice video ! thanks a lot !

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

    really nice!

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

    Looked at the code and have no idea what half the stuff does but I understand the concept. Really high quality waves though, looks amazing.

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

    Subbed, very nicely presented overview

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

    Really great content.

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

    This is the content I'm here for! 👏

  • @KingofUshankas
    @KingofUshankas 9 месяцев назад

    AMAZING!!

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

    Amazing video!

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

    Your videos are honestly amazing! Thank you and keep it up!

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

    Fantastic! Wish I saw this earlier

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

    Очень круто! Спасибо, что решил поделиться.

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

    astonishing

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

    Great video!

  • @user-tt9cb4mh7v
    @user-tt9cb4mh7v 2 года назад +2

    It is nice to hear your slav accent

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

    Outstanding.

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

    Sir! Thank You for Your work! That's very valuable material and it is a matter of time for Your channel to go viral!
    I would be awesome if You could cover these topics in more details

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

      It is not a matter of time for this channel to go viral. If only you could help this sharing the video in your social channels - that would make an impact, not just random noise.

  • @oliverf.4235
    @oliverf.4235 2 года назад

    Great video.

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

    It's incredible !!!!

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

    You're a genius.............thank you!

  • @therollo9
    @therollo9 11 месяцев назад +4

    Who’s here from the Acerola ocean video?

  • @0Jacx
    @0Jacx 2 года назад

    Awesome!

  • @cptray-steam
    @cptray-steam Год назад

    Mind = blown, I'm probably gonna have to watch this like 30 times before I fully understand how it works.

  • @christopherking6129
    @christopherking6129 2 года назад +2

    Neat! I'm surprised inverse FFT isn't used in procedural generation more often.

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

    Following this closely! Currently using Crest HDRP

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

    Hi! any Idea of how can I integrate dynamic waves and foam, and does buyoancy script come included?

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

    Hello!
    What parameters can be used to obtain a wave with large peaks as, for example, for Gerstner waves? Or does this method not provide for such an approach?
    Thanks! Amazing work!

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

    Amazing!!!!

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

    How do I change the Y position of the water, I would be interested in being able to change it because my terrain is at a different height than the water is when starting the play mode and I can't change it...

  • @b33blebrox
    @b33blebrox 9 месяцев назад

    Amazing! Can imagine what enormous computations are required to add there some solitons to simulate waves with negative slope...

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

    amazing

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

    It's an amazing effort, I noticed there's also foam around the edge of the rowboat. It seems like there's a little too much uniformity and too much foam. It might look a little boring to remove some of that garnish, but it should look more realistic with less foam or maybe the foam triggers only a little more at the extremes

  • @Martin-se3ij
    @Martin-se3ij 2 года назад

    mind boggling.

  • @whidzee
    @whidzee 3 года назад +8

    Wow this is just amazing. most of the description went over my head but i am still very impressed. How would you go about combining this with onshore waves around an island? to have breaking waves coming from all angles?

    • @JumpTrajectory
      @JumpTrajectory  3 года назад +6

      Oh! That's a whole other thing! I've read some about it, but not much. Check outh this talk developer.download.nvidia.com/assets/gameworks/downloads/regular/events/cgdc15/CGDC2015_ocean_simulation_en.pdf

    • @stevethewolf562
      @stevethewolf562 2 года назад +2

      @@JumpTrajectory You should definitely make a video about this also, it's super interesting and probably more useful to a wider variety of devs. Great work so far, by the way!

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

    Гуд джоб, камрад! Ю а нот со нью ин шейдерс, ю ноу :)

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

    Underated

  • @---tr9qg
    @---tr9qg 2 года назад

    OMG!!! 😳 Cool!!!!

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

    Very nice video, definitely be interested in seeing the follow up on the other stuff you talked about. One thing I'll mention, is that when you exit the Unity world, those problems with "Pipelinestalls" and things aren't really issues. In API's like Vulkan, asynchronous execution of GPU commands is not only an option, its *expected and default behavior*. You can even separate the FFT step *entirely* from your rendering, have it be performed at a lower frame rate, and even *interpolate* the results by looking a head, but I digress. What you would probably do in this case is use double buffering, use the GPU to write the output in one buffer, and on the next frame use another buffer, allowing you to safely copy the information you need to your CPU while it is calculating the next buffer. No pipeline stalls period. What you would really want to do however, is calculate boyancy *on the GPU* instead, then copy *that* data to the host which is much much smaller.

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

      Thank you for the advice! I would really like to dive into the graphics APIs at some point. The idea with GPU boyancy seems interesting. I think, as a bonus, all the GPU power can allow a more sofisticated boyancy model (voxel based maybe?)

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

      @@JumpTrajectory It's funny you talk about this because i am actually trying to convert a buoyancy system (inspired by Habrador buoyancy tutorial) to compute shaders, in order to make it compatible with FFT ocean. So far it works pretty well with Gerstner waves (from CatlikeCoding tutorial), but i am dizzy when i read the fft ressources you linked because my math background is too weak to understand all this right now (I honnestly don't even really understand what FFT is).

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

      This has nothing to do with Unity as is. Unity supports async gpu readback, async compute and all the other things you mentioned as well. You should research the topic before you embarass yourself in the future.

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

    I have ocean tiles but ... tiling... is an issue and I HOPED that you would go more into detail in this regard as there are no ressources I can find on "cascades" and more importantly how to implement them once you already have a tile.
    Anyone know any ressources on this?

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

    i would like to see a video about combining two waves from different directions :)

  • @user-zr1ex8hq6c
    @user-zr1ex8hq6c 3 года назад +1

    What is the principle of Phillips spectrum ?

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

    What about the foam around objects (like the boat)? Do you simply use particle effects or are those also done on the water shader? If so how?

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

    amazing. Please do more videos like this