Coding Adventure: Ray Marching

Поділитися
Вставка
  • Опубліковано 1 кві 2019
  • In this coding adventure I explore ray marching and signed distance functions to draw funky things!
    If you're enjoying these videos and would like to support me in creating more, you can become a patron here:
    / sebastianlague
    Project files:
    github.com/SebLague/Ray-Marching
    Learning resources:
    iquilezles.org/www/articles/di...
    jamie-wong.com/2016/07/15/ray-...
    www.iquilezles.org/www/articl...
    blog.hvidtfeldts.net/index.php...
    A little bonus visualization:
    • Sphere Tracing Visuali...
    Music from filmmusic.io:
    "Supernatural" and "Hiding Your Reality" by Kevin MacLeod (incompetech.com)
    Licence: CC BY (creativecommons.org/licenses/b...)

КОМЕНТАРІ • 931

  • @SebastianLague
    @SebastianLague  5 років тому +808

    Hi everyone :) Not sure if this was clear from the first video, so to preempt any possible confusion about how this episode connects to the hydraulic erosion one -- it doesn't! The plan for this series is just to explore a variety of topics as I discover/become interested in them. So while I'll definitely be returning to the erosion project, there'll probably be a bunch of random stuff before then.
    With that said, I hope you enjoy the video!
    And as always, links to my project files, as well as the resources I used to learn about this stuff are all in the description.

    • @junpeiiori4720
      @junpeiiori4720 5 років тому +7

      S'all good, man! you can make a video on any topic and it'll still be a joy ride.

    • @SliphRahl
      @SliphRahl 5 років тому

      I'd be intrested to see more about the erosion project. Might be interesting if it worked toghetter with the Procedural landmass generation in some way.

    • @HadiExtreme
      @HadiExtreme 5 років тому +1

      Ray marching is super interesting! As is this series. I've learned a lot from you over the years, so thank you mate. I also had a ton of fun working on a fork of the Path Creator project 2 months ago, check it out if you have some time :)

    • @collinpearce310
      @collinpearce310 5 років тому +1

      Is there any chance you'll finish the ai series? The start of it was really great!

    • @tomasdougan1419
      @tomasdougan1419 5 років тому

      What you are doing with this series is fantastic, intuitive, and very entertaining. I love the improvisational nature of it where any given episode isn't related necessarily to the last. With each release, I find myself enthralled in your new project and in admiration of your curiosity. Keep up the incredible work! And thank you!

  • @monochr0m
    @monochr0m 5 років тому +3587

    That pythagoras animation had me in tears

    • @erichlof
      @erichlof 5 років тому +57

      I actually LOL'd, which I rarely do

    • @adamprice4658
      @adamprice4658 5 років тому +104

      Pythagoras, the master programmer.

    • @Skyefaux
      @Skyefaux 5 років тому +8

      same lol

    • @pushqrdx
      @pushqrdx 5 років тому +11

      me too 😂 didn't see that coming

    • @Definitely_a_Fox
      @Definitely_a_Fox 5 років тому +22

      Slap slap

  • @CodeParade
    @CodeParade 5 років тому +1648

    Your visuals are so nice looking! I'm interested to see what else you do with ray marching :)

    • @SebastianLague
      @SebastianLague  5 років тому +274

      Thanks, means a lot coming from you! I’ve had so many people recommending your videos in the comments, and I can see why - your work is incredible.

    • @randomsnow6510
      @randomsnow6510 5 років тому +13

      Hello cp! Btw your non euclidean engine could of been done in quake live since that game has seamless portals.

    • @isaacspiegel2395
      @isaacspiegel2395 4 роки тому +6

      It would look so good in marble marcher👀

    • @antsolja
      @antsolja 4 роки тому +3

      hello code parade i was just thinking of you for some reason lol

    • @samuelthecamel
      @samuelthecamel 3 роки тому +1

      Aren't you the guy who made an entire game out of ray-marching fractals?

  • @BlukBlukGames
    @BlukBlukGames 5 років тому +754

    I really like this format of videos. As usual awesome

  • @jordananderson2728
    @jordananderson2728 4 роки тому +509

    4:30
    "Dormammu, I've come to bargain!"

    • @parker9163
      @parker9163 4 роки тому +14

      Exactly what it reminded me off

    • @ccricers
      @ccricers 4 роки тому +13

      I wonder just how many particle and smoke effects in VFX for movies are based off fractals.

    • @ugur5721
      @ugur5721 3 роки тому +3

      @@ccricers I wonder are they writing codes when making CGI.

    • @NStripleseven
      @NStripleseven 3 роки тому

      Lol

    • @pinkajou656
      @pinkajou656 3 роки тому +1

      HA

  • @slavcabbage2619
    @slavcabbage2619 2 роки тому +49

    Sebastian Lague has to be my favorite coding youtuber. Its just the fact that all of his coding adventures are so interesting, entertaining, and most importantly inspiring.

  • @RoySchl
    @RoySchl 5 років тому +193

    those 2d visualizations showing how the algorithms work are awesome. (the rest of the video too)

  • @Jabrils
    @Jabrils 5 років тому +496

    Seb I watched the entire video with my jaw dropped because I have no idea what the hell you're doing. You've truly transcended into Ultra Instinct. Proud of you man 😭
    also, request: can you visualize 3D ray marching like you did 2d?

    • @anujv2909
      @anujv2909 5 років тому +6

      Hello jabrils

    • @SebastianLague
      @SebastianLague  5 років тому +110

      Thanks :D
      Had a quick go at your request. It's a little ugly, but take a look here ua-cam.com/video/0J8tKGjEE5Q/v-deo.html

    • @djobbo
      @djobbo 5 років тому +2

      @@SebastianLague wow that's awesome

    • @manualvarado2212
      @manualvarado2212 5 років тому +3

      Love to see you here Jab!

    • @DoomRater
      @DoomRater 3 роки тому

      Hey don't feel too bad, while I get a lot of these "free" calculations and renders are the result of caching the results of the technique and then coding stuff with those cached results, I can't visualise the actual code using those cached results in my own head.

  • @bjarnes.4423
    @bjarnes.4423 5 років тому +70

    This format made me activate the bell. Keep up the good work!

  • @kristinawaldt
    @kristinawaldt 5 років тому +7

    Your videos are amazing-the visualisations are so clear and easy to understand!
    Thank you for sharing this with us, it's very helpful and inspiring.

  • @manualvarado2212
    @manualvarado2212 5 років тому +2

    Woah, Sebastian! 8D
    Most of the images in this video were incredibly satisfying!
    Thank you so much for diving into these adventures, and for sharing them with us

  • @Hyuts
    @Hyuts 4 роки тому +1

    Thank you for being such an amazing and generous person Sebastian!! The world needs more people like you.

  • @liaia7375
    @liaia7375 5 років тому +293

    I don't understand anything in this video
    But still enjoy it

  • @marty34534
    @marty34534 4 роки тому +3

    Absolutely mind boggling! This kinda reminded me of old-school CSG in raytracing

  • @urban24
    @urban24 5 років тому +2

    My jaw dropped at the object blending, and then you completely blew my brain out with the mandelbulb visualisation! So simple, yet so beautiful.

  • @DevanSoni
    @DevanSoni 5 років тому

    This is my most anticipated video series. Keep up the great work Sebastian!

  • @TranceDaNight8
    @TranceDaNight8 5 років тому +20

    Some technique like this one was used on the movie “Annihilation” for the alien life form, pretty spectacular

  • @jonathanravenhilllloyd2070
    @jonathanravenhilllloyd2070 5 років тому +43

    It feels so good to hear you say "I have no idea how the code works, but..." :D

  • @strivenlen640
    @strivenlen640 5 років тому

    Omg! These raymarching simulations are pure gold. I really enjoy every single video of coding adventures.. keep it up Sebastian

  • @Katniss218
    @Katniss218 5 років тому +2

    That looks really, REALLY cool! Can't wait to see what you'll come up with next!

  • @soumyajitkushari675
    @soumyajitkushari675 4 роки тому +44

    4:30 this looks like the extra terrestrial being from Annihilation

    • @RegahP
      @RegahP 4 роки тому +1

      It does! That movie was awesome

    • @laurentrinks1111
      @laurentrinks1111 4 роки тому +2

      I was looking for this comment! I know the visual person or whoever made a lot of the shapes very mathematical. Like the flowers and the mold were fractals. So I bet it was planned and the alien was that shape!

    • @adamglueckski8064
      @adamglueckski8064 3 роки тому

      That extra terrestrial being was based on the mandelbulb! Same thing

  • @mikaxms
    @mikaxms 5 років тому +6

    That 2D sphere tracing looks so awesome!

  • @narutolll
    @narutolll 4 роки тому

    I'm still relatively new to programming and these coding adventures are refreshingly creative. I'm loving every second of these. Can't wait for the next one.

  • @flobbinhoodgames8117
    @flobbinhoodgames8117 4 роки тому

    Wow, this was really phenomenal! I like this format because you can experiment without being forced to slow down for long explanations and tutorials. That being said, I'd be thrilled if some of these videos turn into a tutorial series!

  • @Jejkobbb
    @Jejkobbb 5 років тому +34

    Thats so fucking cool. And I agree that object blending is satisfying as hell. Keep up these amazing videos

    • @SpaceKebab
      @SpaceKebab Рік тому

      object blending would be so useful for blending meshes!

  • @mihailazar2487
    @mihailazar2487 4 роки тому +9

    02:49
    HOLY VOLUMETRIC BOOLEANS
    OMG
    THIS IS BRILLIANT

  • @Vr0sen
    @Vr0sen 5 років тому

    By far the most easily understood Ray Marching video I've seen! I love the was you showcase code examples in a non-intrusive way, but still enough to get a basic understanding,

  • @MrWaketeu
    @MrWaketeu 4 роки тому +1

    You are a genius, this visual are insane : thank you so much to share your experimental work with us, it is truly inspiring

  • @ValemVR
    @ValemVR 5 років тому +3

    This is so cool to render boolean surfaces at real time ! Loved it !

  • @xd123_
    @xd123_ 4 роки тому +21

    4:23 rgb version of what you see when you press down on your eyeballs

  • @LamanodeManolo
    @LamanodeManolo 4 роки тому

    Woooooah. That 3d fractal had me mesmerised indeed. That's a direct sub my dude, amazing content, great format, nice presentation.
    Keep it up, you're good!

  • @momoaraki7934
    @momoaraki7934 3 роки тому

    You are amazing teacher. I love how you focus on foundational functions to express conditional intersections and blends!

  • @philosoaper
    @philosoaper 5 років тому +103

    so.. after ray marching comes ray jogging? ray sprinting? ray marathon? ray expedition racing?

  • @bountyhunterj6822
    @bountyhunterj6822 4 роки тому +5

    The eerie music was from one of my favourite games, Mindustry! **happiness noise**

  • @MylaRolettoPingarelli
    @MylaRolettoPingarelli 4 роки тому

    You're an inspiring person my man, I'm not on this level of coding but the things you do just captivate me. Love to see more of these videos maybe even longer videos either way I'm here and entertained

  • @mftylord
    @mftylord 5 років тому

    Love the series! It is introducing me to so many topics that I didn't know about but find super interesting. Your serious has inspired me to try out some of my own ideas with ray tracing. I'm eagerly awaiting your next video!! 😁

  • @grunch346
    @grunch346 4 роки тому +6

    You could use the subtraction technique at 2:47 for making your clouds interact with the mountains and not go through them

  • @zumpiez
    @zumpiez 5 років тому +227

    Ahh, I see you have discovered the special effects from Annihilation

    • @ben_burnes
      @ben_burnes 5 років тому +18

      Was definitely my first thought too; was such a cool effect.

    • @Zi7ar21
      @Zi7ar21 3 роки тому +2

      What do you mean

    • @ShimrraJamaane
      @ShimrraJamaane 3 роки тому +2

      @@Zi7ar21 The movie Annihilation. The alien object looks almost exactly like the mandelbulb.

    • @Zi7ar21
      @Zi7ar21 3 роки тому +4

      @@ShimrraJamaane I just searched for the scene and it appears that it is indeed a mandelbulb, with some transformations applied to it

    • @ShimrraJamaane
      @ShimrraJamaane 3 роки тому +3

      @@Zi7ar21 I'm glad I now know the name for what that thing is. I want to render an hour long version of that and use it for my Zoom background :)

  • @edwardslayd7816
    @edwardslayd7816 5 років тому

    Amazing Sebastian! I'm glad I stumbled across your videos! You have sparked creativeness in my brain! I hope to show you something you have inspired some day!

  • @ThefamousMrcroissant
    @ThefamousMrcroissant 5 років тому

    Very clean format. One of the easiest to listen to youtube tutors as well. Keep up the excellent work

  • @nrxpaa8e6uml38
    @nrxpaa8e6uml38 2 роки тому +3

    OMG just imagine the "3D Mandelbrot" thing implemented for VR! It would be trippy af!

  • @tranl1050
    @tranl1050 5 років тому +23

    4:33 Dormmamu, I have come to bargain

  • @jaugretler9140
    @jaugretler9140 2 роки тому

    Beautiful. Especially the visualisation of the Mandelbrot bulb has some otherworldly beauty to it

  • @user-er7tu3xc8j
    @user-er7tu3xc8j 7 місяців тому

    these visualizations were amazing for helping me understand ray marching. thank you!!

  • @Kiloku2
    @Kiloku2 4 роки тому +3

    You already had my like when you put Pythagoras tapping away at a laptop

  • @electratix
    @electratix 4 роки тому +10

    The 3D Visualisation of the Mandelbrot set reminds me of the film, Annihilation.
    WARRRPP warp warp bum BRRRUUUUUM

  • @MrFedX
    @MrFedX 4 роки тому

    I don’t understand how you can make a video that cool looking, yet at the same time super informative... And it’s just 5 minutes! That is really impressivez Thank you.

  • @DerXavia
    @DerXavia 5 років тому

    amazing stuff, have to try it myself! The use of the distance function, to show/hide intersections of two objects, blew my mind

  • @AK-ry5lh
    @AK-ry5lh 4 роки тому +3

    Dude I love these videos. Any tips for someone to get started with such topics? I have extensive "standard" software engineering knowledge, but really no idea about graphics and all the other cool stuff you do.

    • @bencai605
      @bencai605 4 роки тому +3

      Yeah these coding adventure videos make me wanna play around with stuff like this as well but im not sure where to even start ...

  • @FaffyWaffles
    @FaffyWaffles 4 роки тому +12

    4:21 it the furnucking thing from annihilation.

    • @forfox
      @forfox 3 роки тому

      that what i wontet to say

  • @unknown4me1
    @unknown4me1 5 років тому

    I really like those coding adventures! So interesting to watch! keep up the good work

  • @FelheartX
    @FelheartX 5 років тому

    Awesome video dude. I love how you include all those steps, the many visualizations, the stuff you played around with (like 3:49).

  • @bakbak4960
    @bakbak4960 4 роки тому +3

    "I messed around with it for a little bit"
    *do something I really need to improve my gaming development skills in such an easy way*

  • @MrMusAddict
    @MrMusAddict 5 років тому +3

    Congratulations. You can now apply to become a visual effects artist for Marvel. That mandlebulb looks exactly like the quantum realm!

    • @doxxius3536
      @doxxius3536 5 років тому +2

      NO! If a recruitment agent gets him, no more this kind of videos. Company secret. Fuck Marvel and CGI studios!!! For someone is a lifetime opportunity and for others is slavery to trade secrets and other corporative BS. A similar thing happened to some YT channels.

  • @MichaelProstka
    @MichaelProstka 5 років тому

    That is just about the single best explanation of ray marching I have ever come across. Very well done!

  • @SonyCommander
    @SonyCommander 5 років тому

    Sharing this knowledge with us is such a wonderful thing to do, thank you very much

  • @antae5979
    @antae5979 5 років тому +5

    YES PLEASE, I don't mind having another 3Blue1Brown in my life

  • @UJustGotGamed
    @UJustGotGamed 3 роки тому +2

    I'm a simple man.
    I see 3D fractals, I click.

  • @TaarLps
    @TaarLps 4 роки тому

    I come back to this video and the one about marching cubes so often. I just love it.

  • @jhinius7689
    @jhinius7689 3 роки тому

    I watched this a long time ago but recently started learning ray marching and omg this made things make so much more sense

  • @Obyvvatel
    @Obyvvatel 5 років тому +3

    1:21 "we'll start by calculating distance to the scene". What does that mean?

    • @diegomendes1998
      @diegomendes1998 5 років тому +3

      I think is the distance from your point to the nearest point in the scene.

    • @SerBallister
      @SerBallister 4 роки тому

      @@diegomendes1998 Yup, for a given 3D start point and direction (ray), you have a function that returns the distance to hit (distance function).

  • @QuadraAce
    @QuadraAce 4 роки тому +4

    What tools/frameworks does he use?

    • @henryso4
      @henryso4 4 роки тому

      it probably isn't too hard just to do a really basic opengl renderer and throw in imgui, with some inputs hooked to shader constants--then again raymarching is all in the fragment/pixel shader (whether you're an opengl or d3d guy!!)
      If you wanna get started on raymarching you can use shadertoy.com -- it sets up all the opengl stuff behind the scenes and lets you just write fragment shaders

  • @Srcsqwrn
    @Srcsqwrn 4 роки тому

    I've only recently started in unity and learning coding. It's wild how only a short time ago I didn't understand most of anything you were talking about for code, or what I was seeing, but I thought things were interesting. Now I get little inklings of clues as to what is going on.
    I can't wait to keep on learning, and then eventually mess around with code in the same way you do!

  • @kharekelas4259
    @kharekelas4259 4 роки тому

    I watched this video 3 month before and had no idea what you talking about. But during the time I started to learn some basics about shader and ray marching, now by rewatching it, I found myself able to understand it and even comprehend some math logics you've used for certain effects.

  • @yyny0
    @yyny0 5 років тому +5

    Man, I love raytracing, even if it isn't computationally viable (yet)

    • @GameGonLPs
      @GameGonLPs 5 років тому +2

      But keep in mind that this is NOT raytracing, this is raymarching, they are not the same. Both are awesome though.

    • @SerBallister
      @SerBallister 4 роки тому

      @@GameGonLPs Arguably ray marching is more expensive.

  • @antiscribe4150
    @antiscribe4150 3 роки тому +3

    It makes me sad that I will never be able to play with the shapes from 3:18 because it is physically impossible

  • @VerumBit
    @VerumBit 4 роки тому

    wow, you are pushing it so much! the fractal end is Amazing! my best compliments

  • @altheslacker4198
    @altheslacker4198 5 років тому

    Thank you for easily the most interesting and enjoyable channel I have seen.

  • @antiscribe4150
    @antiscribe4150 3 роки тому +3

    Watched this video like 5 times and I'm still trying to understand it

  • @lyndenpfaff8026
    @lyndenpfaff8026 4 роки тому +6

    Normal person: makes 2d fractals
    This kid: makes 3D fractals
    Me: what would a 4d fractal look like?

    • @ClokworkGremlin
      @ClokworkGremlin 4 роки тому +1

      Actually, given the way bits of the Mandelbulb keep fading in and out at the edges, I think it might be 4D, since that's kind of what 4-dimensional geometry looks like when it's rotated into and out of a 3-dimensional perspective.

    • @oskarkrogsgard3014
      @oskarkrogsgard3014 4 роки тому

      What normal person makes 2d fractals? Normal CS student, perhaps

  • @LethiuxX
    @LethiuxX 2 роки тому

    Your channel is a total gem. Subscribed for life.

  • @himselfe
    @himselfe 5 років тому

    Expected the video to be trendy clickbait, learned about ray marching, clicked subscribe. As other comments have said, really nice format! No over-complication, just clear explanations backed by simple and easy to understand examples. Nicely done!

  • @segelsonproduction
    @segelsonproduction 4 роки тому

    BEST video on SDF and Ray Marching, so clear and easy to follow, thanks!

  • @serbancercelescu6693
    @serbancercelescu6693 5 років тому

    Man, I don't usually comment on youtube for quite obvious reasons, but your channel is amazing. As a serious competitive programmer for four years and discrete algorithmics student, I can say that your videos are a truly incredible blend of theory and actual codings. A lot of kudos

  • @vedran.kapetanic
    @vedran.kapetanic 5 років тому

    Loving this series!

  • @josh_swanson
    @josh_swanson 4 роки тому

    Just what I was looking for! Currently prototyping a game that deals with clay and needed to figure out how to blend geometry seamlessly. This will be helpful.

  • @mxRyan01001
    @mxRyan01001 5 років тому

    Saying that you are simply brilliant is not enough! Well done mate and keep doing that please!!!

  • @jakemccallum7468
    @jakemccallum7468 4 роки тому +1

    Instant subscription, brilliant video and fascinating topics .

  • @carmelwolf129
    @carmelwolf129 3 місяці тому

    this stuff is extremely interesting. thank you for showing us all the experimentation results! i hope that once i have more time in my life i'll be able to mess around like this too

  • @hisoka44444444
    @hisoka44444444 4 роки тому +1

    Awesome visualization at the end, cool technique, thanks! Liked and subscribed ^^

  • @sebastianrodriguezbojorge7123
    @sebastianrodriguezbojorge7123 5 років тому

    I like the video editing and how you acknowledge and describes your struggles as well. That pitagoras was 😂

  • @heinrichkreuser2659
    @heinrichkreuser2659 5 років тому

    Hi. I really like your video, I love that you take initiative to create cool things via coding. I see you like creating images that are aesthetically pleasing and tries to model nature, much like I do.
    Currently I'm looking into galaxy generation. The idea of how the colors would look and how the galaxy form intrigues me. If you're looking for a new project some day, I'd be delighted to see how you would take on one like this.
    Keep up the good work!

  • @knowledgedh7700
    @knowledgedh7700 5 років тому

    This is so cool this stuff very mesmerizing, really enjoying these videos ignites my passion for coding. Which I need for uni at the moment cause of the coding we are doing

  • @rusticagenerica
    @rusticagenerica 2 роки тому

    Extraordinary work !!! God bless you for sharing it.

  • @AHotLlama
    @AHotLlama 5 років тому

    Another amazing video, I can't wait for the next one

  • @igoramorim8148
    @igoramorim8148 5 років тому

    Thank you Sebastian! Right to the point. The 2D animation is very clear and really helpful to understand the concept :)

  • @belgacemnedjima2231
    @belgacemnedjima2231 5 років тому

    This channel is underrated and deserves more subs
    Amazing work

  • @Ivan_1791
    @Ivan_1791 4 роки тому

    Geez, this is one of the best channels ever.

  • @JacksMacintosh
    @JacksMacintosh 5 років тому +1

    I have no idea what I was looking at in the end, but it was beautiful

  • @NickDoc7
    @NickDoc7 3 роки тому

    Just amazing! The fractal blow my mind

  • @arturovillalobos1882
    @arturovillalobos1882 3 роки тому

    that last visual was so dope !

  • @GameDevHQ
    @GameDevHQ 5 років тому +1

    Damn dude. This was amazing. Well done

  • @vladimirkovalenko7298
    @vladimirkovalenko7298 4 роки тому

    This is mindblowing! Thanks!

  • @bassemb
    @bassemb 2 роки тому

    I recently started using MagicaCSG, a SDF-based modeling tool, and this helped demystify it for me, thanks!

  • @taospencer1403
    @taospencer1403 4 роки тому

    Very cool video, probably my favourite coding video i've found so far...

  • @quillaja
    @quillaja 5 років тому

    Excellent visualizations of the concepts! Glad to see you linked to Inigo Quilez's website. =)

  • @krytharn
    @krytharn 5 років тому

    I'm in love with this channel.

  • @JordanService
    @JordanService 3 роки тому

    And subbed that was amazing. Love that final look!

  • @scaramorey128
    @scaramorey128 5 років тому

    I really like these coding adventure videos.

  • @clementpoire9841
    @clementpoire9841 4 роки тому

    Your videos are a precius powerfull fuel for my motivation to work on my personnal project. Thank you so much, you're giving me hope, seriusly !