Learn GODOT 4 Compute Shaders with RAYTRACING!!

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

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

  • @NekotoArts
    @NekotoArts  2 года назад +16

    Theres a small error at 5:42
    To read and write data you use "image_out.data[some_index]".
    Think of it as a struct named "image_out" and you're accessing the "data" variable inside the struct.

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

      You talk about gles if I understand correctly, but how about vulkan?
      Can you raytrace with vulkan in godot?

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

      @@ARCAD3BLOOD This tutorial was made using Godot's Vulkan backend. As far as I know compute shaders aren't supported by Godot's GLES backend

  • @Acerola_t
    @Acerola_t 2 года назад +79

    I sure do love compute shaders

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

      also I followed the same tutorial series 2 years ago. Great resource! glad you adapted it for godot

    • @NekotoArts
      @NekotoArts  2 года назад +5

      @@Acerola_t ikr! David Kuri's raytracing articles are a goldmine of knowledge

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

      hello year old comment from the goat of all time

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

    Bro popping off with the editing!! I'm now going to take a couple of days to mentally process all of the info that was pumped into my brain

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

      Oh pshhh... I just binged editing tutorials for a few hours that's all.
      Also I will continue pumping shader knowledge into you >:) I will turn you into a shader God!!!

    • @LucyLavend
      @LucyLavend 2 года назад +5

      @@NekotoArts shader big brain time let's gooooo

  • @mohsregTV
    @mohsregTV 2 года назад +17

    Honestly your best work yet. Good job Nekoto 💟

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

    I can't even comprehend the work went into making this!

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

      Editing this one took quite a while! Thank you for appreciating the editing :D

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

    After I sussed out compute shaders I was wondering how to implement raytracing!
    Epic editing btw mate, I need to learn to edit like this for my videos 👀

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

      Oh hey! I saw your video halfway through editing, I really appreciate that you took the time to explain texture uniforms too!!

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

    This is my new favourite video about Godot it is so good. Well done neko!

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

      Thank you so much Leon!!!

  • @qubitx64
    @qubitx64 2 года назад +6

    You have my "Raytraced" respect. Great introduction to compute shaders.

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

    Amazingly well presented and very useful info!

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

      Thank you so much Ombarus!!!

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

    i know nearly nothing about computer science and can barely use godot, but i watched this video all the way through and thoroughly enjoyed it! i'm definitely not qualified to say that you did a good job in terms of accuracy or whatever but you definitely did a great job entertainment-wise :)

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

      Thank you so much! I try to keep things light hearted and fun when teaching, otherwise it gets boring to learn anything.

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

    Watched this twice. First time was entertained. Second time was educated. Thank you.

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

      Thank you! I like to have fun while teaching, otherwise it gets boring to teach. Glad you enjoyed the video!

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

    Nice video! I've been looking forward to compute shaders on Godot for ages, so I'll be s̶t̶e̶a̶l̶i̶n̶g̶ borrowing your expertise!

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

      Your comment reminded me that I forgot to add a license to the repository. All the code is CC0, so feel free to steal as much as you need :)

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

    Wowza that was really good! It has to be your best video yet. Well done!

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

      Thank you Kevin!! I'm quite happy with how this one turned out too!

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

    Gold, I was actually looking for an explanation like this.

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

    Thanks. Complex, but good reference.

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

    my brain started logging out when all the math formulas came up on screen 💀

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

      LMAO. I had to read the Wikipedia page like 6 times to get it as well, and I'm studying an Engineering degree XD

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

    Great info and solid editing - you gotta make more of these my man! Truly amazing job.

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

    soo well made!

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

      Thank you!! I'm glad you like it, it took quite a while to edit

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

    Aqesome that you also know Acerola. I discovered him this year and his content is awesome. (yours is also really nice)

  • @marc.lepage
    @marc.lepage 8 месяцев назад

    Actually a decent explanation, thanks!

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

    Wow this video is amazing and you are funny. Very well made and fun to watch video.

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

    your vids are the bomb!

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

    Who is this Nekoto and what has he done with my friend? Seriously though love the content my guy it's so impressive, love the editing and finally love you too!!

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

    this video was Junferno meet Acerola meet Godot and i love it

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

      Hehe, they were both inspirations for me

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

    It's like acerola but for godot! And I mean that as a compliment!

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

      Haha thank you! I love Acerola's videos.

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

    THe shader god has return on its glory!!!! Awesome video btw, sad I didnt understood anything xDDDDD just kidding, something I learned here, but Acerola reference I got it!!! a funny story about how I found him: I was surfing on youtube, watching brazilian videos, then youtube recomended me a shader video from acerola, at first I tought it was a brazilian because "Acerola" in portuguese is a name of a fruit LOL!

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

      Hey! Glad you learned something! Acerola's channel is super awesome, I'm glad you got the reference. I didn't know it was a fruit in Portugese!

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

    My answer to that question somewhere before middle or so is "No, I don't know". ;)
    It's a nice video, I didn't catch about anything if I'm not wrong. xD

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

    thanks very useful !

  • @-Name-here-
    @-Name-here- Год назад

    I’m 10 minutes in and you’ve completely lost me 😂
    I am just barely starting to grasp godot shaders normally so they make a bit more sense and it’s not just me randomly coding till it works, so this is way above my head right now

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

      Compute shaders are universal - they could do whatever you want them to do!
      The drawback is that they are MUCH harder to work with xD
      Stick to fragment(also known as pixel) shader and vertex shader for now - they would serve you well for a very long time before you would even need to touch compute shaders at all ;-)

    • @-Name-here-
      @-Name-here- Год назад

      @@igorthelight yeah lol

  • @jordan.rushing
    @jordan.rushing Год назад

    My brain melted, nice job

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

      Mine melted as well when I had to code this project 😵‍💫

    • @jordan.rushing
      @jordan.rushing Год назад

      @@NekotoArts I legit cannot fathom trying to do what you did here.

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

    Yay! you gained a.. new subscriber 🎉

    • @NekotoArts
      @NekotoArts  11 месяцев назад +1

      Thank you so much!!

  • @Thomason1005
    @Thomason1005 6 месяцев назад

    thank you for the tutorial, there is sure quite some boilerplate needed to get it running. somehow godot likes to crash every now and then, unsure if it is realated to my compute shader usage... still, they are fun!

  • @faru-music
    @faru-music 2 года назад +2

    Made me laugh several time. Hope you didn‘t lose a (cat)life during the research 😉

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

      FaRu!! Thank you so much! Learning about raytracing was quite fun, I think my implementation is still incorrect but I'll fix it soon

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

    Very informative and well explained, however the loud background makes it difficult to understand. Cheers

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

    Sheesh Godot youtubers are getting huge these days!

  • @Xotchkass
    @Xotchkass Год назад +3

    music so loud i can barely hear you

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

    Hey I see a fellow Eve fan right here! Also, Godot 4 looks lit!

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

      Hello!!! I'm new to Eve's music, the only one I knew before was Kaikai Kitan but recently I've been listening to more!
      When I heard Dramaturgy and Last Dance I just knew I had to put them in the video hehe

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

      @@NekotoArts That was me half a year ago, I have listened many of his songs (not even close to finishing his playlist.) If you find any confusion which song u want to listen first, go with the more popular ones, they are popular for a very good reason.

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

      @@extremehyperventilation4377 thank you! I'll listen to those ones then!

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

      @@NekotoArts and, another thing, I am just a 17 year old student prepping to get into college, so u can drop the formalities since u are technically older.

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

      @@extremehyperventilation4377 good luck on your college applications! I will still use formalities with you though :D

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

    LET'SA FUCKING GO ACEROLAAAAAAAAAAAAAAAAAAA

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

    amaing

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

    Quality

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

    Well, now I feel stupid. Still really cool stuff!

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

    This is amazing.......Ill stick with fragment and vertex shaders😂

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

    Fun video! You really stuck it to Twitter! 😐Now do one for GPU based cloth sim...pls...

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

      Haha, perhaps I could try that in a game sometime. If I ever get around to doing it I'll make sure its in a video!
      Still have to finish up that other article I promised Twitter I'd make though

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

      Ok, cool.👍

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

    dang.. i mean, i am a software engineer and always had outsmarted my teachers, friends and surroundings since I was a kid.. but when it comes to the complexity of shaders especially raytracing, I feel like a special dummy ;))

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

      I think compute shaders are one of the hardest ones (as far as I know).
      One small advise: don't be discouraged when you didn't grasp something momentarily - it's totally ok to repeat and retry something a few times. Human brain has it's limits, so the harder the question - the more often you would hit it's limitations.
      It's totally fine!

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

    Theres not yet a way to pass the buffer straight to the main rendering device is there? Having to readback to the CPU really limits some of the cool stuff you can do.

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

      Yeah :/ that's whats limiting us from doing indirect rendering using compute shaders right now.
      AFAIK, it is a planned feature though. So eventually we will be able to do that too!

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

    Hi!
    What musics are you using in the video? And, I don't know if it's just my problem, but aren't they a bit too high?
    Thank you!

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

      List of music in order:
      Eve - Last Dance
      Persona 3 - Iwatodai Dorm
      Legend of Zelda: Wind Waker - Dragon Roost Island Theme
      Ace Attorney Investigations - Pursuit: Lying Coldly
      Persona 5 - Life Goes On
      Legend of Zelda: Breath of the Wild - Korok Forest (Night)
      Phoenix Wright: Ace Attorney - Jingle
      Persona 3 - During the Test
      Eve - Dramaturgy
      Persona 5 - Wake Up, Get Up, Get Out There (Instrumental)
      Outro Song is made by me
      Also yes, someone else also mentioned that the music might be bit too high. I'll lower it next time

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

    I'am absoluetly unable to focus on the actual content becasue of the J-RPG music in the background. But I'll get over it someday, I'm sure.

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

    Wouldn't a fragment shader work just as well for this?

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

      If Godot supported uniform structs and variable size uniform arrays then yes, you could probably just do this with a fragment shader.
      I think raytracing is a good way to showcase compute shaders though. It seems that many people use raytracing as an example for compute shaders too.

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

    What's the benefit of writing your ray tracing shader in a compute shader over a vertex shader operating on a mesh like a box? It seems quite a bit simpler, but I guess I'm imagining it's not as flexible as the computer shader method.

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

      Apologies, I'm not sure I understand your question. Vertex shaders are not designed to do any kind of path tracing / ray tracing calculations at all.
      Vertex shaders run once for every vertex on a mesh, but raytracing requires you to compute the path of a ray for every pixel on your screen.
      Also vertex shaders output vertex information like vertex position and normal information. But for raytracing you need to find the final color on screen after all physical effects have been applied to the ray.

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

    How do you animate those math equations? Its so smooth.

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

      Its from the open-source python library made by the math RUclipsr 3Blue1Brown! Its called "Manim", you can check it out here: docs.manim.community/en/stable/
      P.S. Little helper note to get you started that gave me a big nightmare when setting this up. "Manim community" edition is a completely different thing from just "Manim", make sure you setup the community version

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

      @@NekotoArts Oi thanks!😊

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

    Can you use glsl files in Godot natively? If not, it would be great if you mentioned how to get them to work. Sorry if it's a dumb question, I'm new to shaders.

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

      There is no such thing as a dumb question!
      Basically, in Godot 4 the .glsl files are used only for storing compute shaders (at the moment), and all other shaders are stored as .gdshader or .shader files. However, all shaders written for Godot (compute, vertex, fragment, etc.) are written in GLSL.
      Hope that helps!

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

    my brain hurts

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

      Me too ;-; I took months to get the raytracing working

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

    "Invalid pipelines cache header" when creating rendering device. Any ideas?

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

    What fps you've achieved? Have you done any optimization?

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

      Rendering the spheres gives me 60 FPS no problem. Like I mentioned in the video, I've optimized the shader for warp sizes of 64 plus I tried to write generally efficient code

  • @darkodosen1025
    @darkodosen1025 8 месяцев назад

    Can you link the original video for the stylized bush, at 1:34, Thanks!

    • @NekotoArts
      @NekotoArts  8 месяцев назад

      It's a screen recording I took for this project: github.com/FaRu85/Godot-Foliage

    • @darkodosen1025
      @darkodosen1025 8 месяцев назад

      @@NekotoArtsThanks you so much for anwsering! I'm new to Godot and 3d gamedev. Can I download the bush project from Github and import it into Godot 4, or is the link not about that? I'm not sure what Github actually does tbh. I see a bunch of files, but not a download link.
      You said you took a screen recording for the project, did you make a video of it here on youtube? If not, would you consider making one? I would love to learn how to create those beautiful Ghibly Studio stylized trees and bushes. I searched around, but all the examples are for Unreal Engine and unity.

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

    I have a maybe stupid question but I don't understand why we use compute shaders for raytracing. Don't fragment shader fire for each pixel? Wouldn't that be a better candidate? I'm a total noob when it comes to shaders but it's something that's been bothering me for a while.

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

      That's not a stupid question at all! While there are implementations of raytracers that use only fragment shaders, using compute shaders actually unlocks a few extra benefits for us.
      Namely: the ability to pass multiple variable size arrays to the shader (with fragment shader it has to be fixed size array), and also the ability to communicate between shader invocations (impossible to do in fragment shader).
      On top of that, in Godot you currently cannot use custom structs as uniforms for a fragment shader, but compute shaders allow us to use structs in the storage buffers.

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

      @@NekotoArts Hi and thanks for answering! Ok so it would still be perfectly possible with fragment shaders, simply way less convenient to do so, got it! Thanks!

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

    The zoomer editing.... :D
    (^._.^)ノ

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

    i'm trying to make a compute shader that modifies image pixels, but i cant get it to work... could you tell me how?

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

      I actually wrote an article on exactly how to do that, as well as reading textures from compute shaders: nekotoarts.github.io/teaching/compute-shader-textures
      Hope that helps!

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

      @@NekotoArts thanks!

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

      @@NekotoArts i have one question: what is the difference between a image2D and a sampler2D?

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

      @@pvini07BR you can write out colors and read colors from an image2D, but you have to access all the pixels of the inage2D using integer coordinates / texel coords.
      A sampler2D is only for reading a texture and comes with multiple sampler types, mipmaps, and filtering. You read samplers using UV coords.

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

    8:33 The reason is the that the feature is too new :>

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

    Hey, what anime is that 1:55?

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

      Ore Monogatari Episode 6.
      More importantly, what song is being played at: 02:43?

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

      @@Omnibus4Everyone Thanks!. It is Ace Attorney Investigations - Pursuit: Lying Coldly, it says so in video description.
      Most importantly 0:20, what is an Idoit?

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

      @@zenzen4982 Idoit would be referring to me :)
      More importantly, what was I going to say at 1:02 ?

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

      @@NekotoArts Ebola (/ω\)

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

    Are you some kind of a son of ElectroBOOM? Your editing and style is exactly like his. ^^

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

      HAHA omg, yes I love ElectroBOOM's channel!! I guess his style has really rubbed off on me.
      Is it really that noticeable? I'm surprised! Your comment made me smile :D

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

    8 cores can crunch only eight pixels at any given time? That's utter nonsense? What about pipelining? SSE? AVX? Don't exist?

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

      Fair point!
      Still, not as much as GPU could ;-)

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

    AAAA bro it seems like u is Indian cuz the accent is a lil similar am I mistaken?

  • @ИванИсайков-я5с
    @ИванИсайков-я5с 9 месяцев назад

    "Compute Shaders" huh... How can you call them "compute" when they can't even "compute" GLSL version of FastNoiseLite, it freeses the entire engine at `compute_list_begin` call... Guess I have to split GLSL FastNoiseLite into sub-shaders, to make it work as expected, and not ruin the system...
    Compute Shaders are good at computing simple paralel tasks, but can ruin everything if task is too hard to complete...

  • @thanatosor
    @thanatosor 6 месяцев назад

    Now let Godot RT by default 😂

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

    bro you just stole the main music theme acerola

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

    Few seconds in and a BLASPHEMY - unnecessary. Absolutely ridiculous.

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

    wtf

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

    content is ok, but too much cringe

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

    @NekotoArts Hey Nekoto, is it alright if I ask you a question about shader optimization for mobile? What's the best way to contact you?

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

      Yeah of course anytime! Discord: Nekoto#2266

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

    I never tryied Compute Shaders so It's even better moment to start with.. but.. what does mean that "gl_GlobalInvocationID.x" on reading writing data to buffers? If there is x on end then there would be y or z in other scenerious? Or its just stupid Shader thingy that nobody knows why but everyone do it the same?

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

      As far as I understand, it's a Vector3. So any Vector3 MUST have 3 parameters. X, Y, and Z are their "default" names. They are not always represent actual coordinates. Same with Vector4 and RGBA - if that's a color, then those floats represent Red, Green, Blue and Alpha. If that's not a color - those are just four float with default names.

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

      Like @IgorTheLight mentioned, gl_GlobalInvocationID is a Vector3, its basically the global position of the current invocation.
      Now, imagine I dispatch a compute shader with the dimensions (8, 1, 1). That means there are 8 invocations lined up in a row on the x-axis.
      So, when I read or write using "data[gl_GlobalInvocationID.x]", I'm basically accessing an array from whatever my current x-coordinate is! Since the invocations is just a line of 8 invocations as mentioned earlier, we're basically just accessing the first 8 elements of the array!
      Hope that helps!

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

      @@igorthelight hi! This is correct. gl_GlobalInvocationID is a uvec3 (basically means its a Vector3 where all of the values are positive integers).
      It represents the global coordinate of the current invocation we are working on, so if my shader says that the invocation size is (8, 1, 1) for example, that just makes a 1D line of 8 invocations.
      Using gl_GlobalInvocationID.x then allows us to access the first 8 elements of the array in our shader!

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

      @@NekotoArts ooh.. Ok now.. this actually makes a lot of sense to me Big thanks ;D

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

      @@bartusew764 glad I could help!

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

    disliked