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.
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!!!
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 👀
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 :)
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!!
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!
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
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
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 ;-)
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!
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
@@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 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.
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
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 ;))
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!
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.
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!
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
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.
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.
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.
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
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.
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!
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
@@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.
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.
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.
@@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!
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 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.
@@Omnibus4Everyone Thanks!. It is Ace Attorney Investigations - Pursuit: Lying Coldly, it says so in video description. Most importantly 0:20, what is an Idoit?
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
"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...
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?
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.
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!
@@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!
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.
You talk about gles if I understand correctly, but how about vulkan?
Can you raytrace with vulkan in godot?
@@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
I sure do love compute shaders
also I followed the same tutorial series 2 years ago. Great resource! glad you adapted it for godot
@@Acerola_t ikr! David Kuri's raytracing articles are a goldmine of knowledge
hello year old comment from the goat of all time
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
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!!!
@@NekotoArts shader big brain time let's gooooo
Honestly your best work yet. Good job Nekoto 💟
♥ Moshi
I can't even comprehend the work went into making this!
Editing this one took quite a while! Thank you for appreciating the editing :D
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 👀
Oh hey! I saw your video halfway through editing, I really appreciate that you took the time to explain texture uniforms too!!
This is my new favourite video about Godot it is so good. Well done neko!
Thank you so much Leon!!!
You have my "Raytraced" respect. Great introduction to compute shaders.
Thank you so much!
Amazingly well presented and very useful info!
Thank you so much Ombarus!!!
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 :)
Thank you so much! I try to keep things light hearted and fun when teaching, otherwise it gets boring to learn anything.
Watched this twice. First time was entertained. Second time was educated. Thank you.
Thank you! I like to have fun while teaching, otherwise it gets boring to teach. Glad you enjoyed the video!
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!
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 :)
Wowza that was really good! It has to be your best video yet. Well done!
Thank you Kevin!! I'm quite happy with how this one turned out too!
Gold, I was actually looking for an explanation like this.
Thanks. Complex, but good reference.
Thank you so much! ♥
my brain started logging out when all the math formulas came up on screen 💀
LMAO. I had to read the Wikipedia page like 6 times to get it as well, and I'm studying an Engineering degree XD
Great info and solid editing - you gotta make more of these my man! Truly amazing job.
Thank you! I will!
soo well made!
Thank you!! I'm glad you like it, it took quite a while to edit
Aqesome that you also know Acerola. I discovered him this year and his content is awesome. (yours is also really nice)
Actually a decent explanation, thanks!
Wow this video is amazing and you are funny. Very well made and fun to watch video.
Thank you so much!!
your vids are the bomb!
Thank you so much!
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!!
this video was Junferno meet Acerola meet Godot and i love it
Hehe, they were both inspirations for me
It's like acerola but for godot! And I mean that as a compliment!
Haha thank you! I love Acerola's videos.
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!
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!
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
thanks very useful !
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
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 ;-)
@@igorthelight yeah lol
My brain melted, nice job
Mine melted as well when I had to code this project 😵💫
@@NekotoArts I legit cannot fathom trying to do what you did here.
Yay! you gained a.. new subscriber 🎉
Thank you so much!!
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!
Made me laugh several time. Hope you didn‘t lose a (cat)life during the research 😉
FaRu!! Thank you so much! Learning about raytracing was quite fun, I think my implementation is still incorrect but I'll fix it soon
Very informative and well explained, however the loud background makes it difficult to understand. Cheers
Sheesh Godot youtubers are getting huge these days!
Hi!
I'm coming for that number one spot baby
music so loud i can barely hear you
Hey I see a fellow Eve fan right here! Also, Godot 4 looks lit!
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
@@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.
@@extremehyperventilation4377 thank you! I'll listen to those ones then!
@@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.
@@extremehyperventilation4377 good luck on your college applications! I will still use formalities with you though :D
LET'SA FUCKING GO ACEROLAAAAAAAAAAAAAAAAAAA
just finished vid, thx for good vid
ACEROLAAAA YAAAAAAAAAA
amaing
Quality
Well, now I feel stupid. Still really cool stuff!
This is amazing.......Ill stick with fragment and vertex shaders😂
Fun video! You really stuck it to Twitter! 😐Now do one for GPU based cloth sim...pls...
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
Ok, cool.👍
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 ;))
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!
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.
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!
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!
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
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.
Wouldn't a fragment shader work just as well for this?
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.
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.
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.
How do you animate those math equations? Its so smooth.
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
@@NekotoArts Oi thanks!😊
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.
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!
my brain hurts
Me too ;-; I took months to get the raytracing working
"Invalid pipelines cache header" when creating rendering device. Any ideas?
What fps you've achieved? Have you done any optimization?
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
Can you link the original video for the stylized bush, at 1:34, Thanks!
It's a screen recording I took for this project: github.com/FaRu85/Godot-Foliage
@@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.
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.
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.
@@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!
The zoomer editing.... :D
(^._.^)ノ
i'm trying to make a compute shader that modifies image pixels, but i cant get it to work... could you tell me how?
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!
@@NekotoArts thanks!
@@NekotoArts i have one question: what is the difference between a image2D and a sampler2D?
@@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.
8:33 The reason is the that the feature is too new :>
Hey, what anime is that 1:55?
Ore Monogatari Episode 6.
More importantly, what song is being played at: 02:43?
@@Omnibus4Everyone Thanks!. It is Ace Attorney Investigations - Pursuit: Lying Coldly, it says so in video description.
Most importantly 0:20, what is an Idoit?
@@zenzen4982 Idoit would be referring to me :)
More importantly, what was I going to say at 1:02 ?
@@NekotoArts Ebola (/ω\)
Are you some kind of a son of ElectroBOOM? Your editing and style is exactly like his. ^^
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
8 cores can crunch only eight pixels at any given time? That's utter nonsense? What about pipelining? SSE? AVX? Don't exist?
Fair point!
Still, not as much as GPU could ;-)
AAAA bro it seems like u is Indian cuz the accent is a lil similar am I mistaken?
"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...
Now let Godot RT by default 😂
bro you just stole the main music theme acerola
Few seconds in and a BLASPHEMY - unnecessary. Absolutely ridiculous.
wtf
content is ok, but too much cringe
@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?
Yeah of course anytime! Discord: Nekoto#2266
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?
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.
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!
@@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!
@@NekotoArts ooh.. Ok now.. this actually makes a lot of sense to me Big thanks ;D
@@bartusew764 glad I could help!
disliked