Learn GODOT 4 Compute Shaders with RAYTRACING!!

  Рет қаралды 28,524

NekotoArts

NekotoArts

Күн бұрын

Source Code:
github.com/nekotogd/Raytracin...
List of people in the video (in order of appearance):
‪@NagiDev‬
‪@mohsregTV‬
‪@leonstansfield‬
‪@fabianvelander‬
also technically ‪@Acerola_t‬ ?
Intro Background from ‪@Gamescapes‬ :
• Sunrise at the Temple ...
David Kuri Raytracing Articles:
blog.three-eyed-games.com/2018...
Memory Qualifiers and Atomic Functions:
www.khronos.org/opengl/wiki/S...
Why 32/64 are optimal invocation sizes for GPUs:
vkguide.dev/docs/gpudriven/co...
Scratchapixel Cow Mesh Raytracing:
www.scratchapixel.com/lessons...
Official Minimal Compute Example by Clay John:
github.com/godotengine/godot-...
Conway's Game of Life in Godot 4 with Compute Shaders:
github.com/snailrhymer/Comput...
Support me on Ko-Fi!
ko-fi.com/nekoto
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
References:
Kuri, D. (2018, May 3). GPU Ray Tracing in Unity - Part 1. Three Eyed Games. blog.three-eyed-games.com/2018...
Möller, T., & Trumbore, B. (1997). Fast, Minimum Storage Ray-Triangle Intersection. Program of Computer Graphics. fileadmin.cs.lth.se/cs/Person...
Scratchapixel. (2014, August 15). Ray-Tracing a Polygon Mesh (Ray-Tracing a Polygon Mesh (Part 2)). www.scratchapixel.com/lessons...
Whitaker, R. B. (2009, January 21). Creating a Specular Lighting Shader. RB Whitaker’s Wiki. rbwhitaker.wikidot.com/specula...
Chapters:
0:00 Intro
1:06 Introduction to Compute Shaders
1:28 Regular Shaders vs Compute Shaders
1:55 Why even use a Compute Shader?
2:43 How do Compute Shaders work?
4:05 Creating a Compute Shader
4:22 Storage Buffers
5:29 The "main" function
6:08 Binding the Compute Shader in GDScript
7:36 Raytracing Theory
9:48 Anime OP
10:02 Improving the Raytracer
11:03 Implementation Caveats
12:07 Some other uses for Compute Shaders
12:15 Outro

Пікірлер: 144
@NekotoArts
@NekotoArts Жыл бұрын
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 8 ай бұрын
You talk about gles if I understand correctly, but how about vulkan? Can you raytrace with vulkan in godot?
@NekotoArts
@NekotoArts 8 ай бұрын
@@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 Жыл бұрын
I sure do love compute shaders
@Acerola_t
@Acerola_t Жыл бұрын
also I followed the same tutorial series 2 years ago. Great resource! glad you adapted it for godot
@NekotoArts
@NekotoArts Жыл бұрын
@@Acerola_t ikr! David Kuri's raytracing articles are a goldmine of knowledge
@LucyLavend
@LucyLavend Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
@@NekotoArts shader big brain time let's gooooo
@mohsregTV
@mohsregTV Жыл бұрын
Honestly your best work yet. Good job Nekoto 💟
@NekotoArts
@NekotoArts Жыл бұрын
♥ Moshi
@babarmehta1007
@babarmehta1007 Жыл бұрын
Great info and solid editing - you gotta make more of these my man! Truly amazing job.
@NekotoArts
@NekotoArts Жыл бұрын
Thank you! I will!
@leonstansfield
@leonstansfield Жыл бұрын
This is my new favourite video about Godot it is so good. Well done neko!
@NekotoArts
@NekotoArts Жыл бұрын
Thank you so much Leon!!!
@Ombarus
@Ombarus Жыл бұрын
Amazingly well presented and very useful info!
@NekotoArts
@NekotoArts Жыл бұрын
Thank you so much Ombarus!!!
@KevinWho
@KevinWho Жыл бұрын
Wowza that was really good! It has to be your best video yet. Well done!
@NekotoArts
@NekotoArts Жыл бұрын
Thank you Kevin!! I'm quite happy with how this one turned out too!
@Daverinoe
@Daverinoe Жыл бұрын
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 Жыл бұрын
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 :)
@tomobodo
@tomobodo Жыл бұрын
thanks very useful !
@nyeeesss2424
@nyeeesss2424 Жыл бұрын
I can't even comprehend the work went into making this!
@NekotoArts
@NekotoArts Жыл бұрын
Editing this one took quite a while! Thank you for appreciating the editing :D
@marc.lepage
@marc.lepage 4 ай бұрын
Actually a decent explanation, thanks!
@dbatdev
@dbatdev Жыл бұрын
your vids are the bomb!
@NekotoArts
@NekotoArts Жыл бұрын
Thank you so much!
@DaddyRaiden
@DaddyRaiden Жыл бұрын
soo well made!
@NekotoArts
@NekotoArts Жыл бұрын
Thank you!! I'm glad you like it, it took quite a while to edit
@fabianvelander
@fabianvelander Жыл бұрын
my brain started logging out when all the math formulas came up on screen 💀
@NekotoArts
@NekotoArts Жыл бұрын
LMAO. I had to read the Wikipedia page like 6 times to get it as well, and I'm studying an Engineering degree XD
@qubitx64
@qubitx64 Жыл бұрын
You have my "Raytraced" respect. Great introduction to compute shaders.
@NekotoArts
@NekotoArts Жыл бұрын
Thank you so much!
@crigz
@crigz Жыл бұрын
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 Жыл бұрын
Oh hey! I saw your video halfway through editing, I really appreciate that you took the time to explain texture uniforms too!!
@TokisanGames
@TokisanGames Жыл бұрын
Thanks. Complex, but good reference.
@NekotoArts
@NekotoArts Жыл бұрын
Thank you so much! ♥
@WiLDbEAsTGameSHere
@WiLDbEAsTGameSHere 7 ай бұрын
Yay! you gained a.. new subscriber 🎉
@NekotoArts
@NekotoArts 7 ай бұрын
Thank you so much!!
@crow4277
@crow4277 Жыл бұрын
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 Жыл бұрын
Thank you so much! I try to keep things light hearted and fun when teaching, otherwise it gets boring to learn anything.
@owenlloyd2528
@owenlloyd2528 Жыл бұрын
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!
@jordan.rushing
@jordan.rushing 10 ай бұрын
My brain melted, nice job
@NekotoArts
@NekotoArts 10 ай бұрын
Mine melted as well when I had to code this project 😵‍💫
@jordan.rushing
@jordan.rushing 10 ай бұрын
@@NekotoArts I legit cannot fathom trying to do what you did here.
@kaawan3201
@kaawan3201 Жыл бұрын
this video was Junferno meet Acerola meet Godot and i love it
@NekotoArts
@NekotoArts Жыл бұрын
Hehe, they were both inspirations for me
@Doppledor
@Doppledor Жыл бұрын
Wow this video is amazing and you are funny. Very well made and fun to watch video.
@NekotoArts
@NekotoArts Жыл бұрын
Thank you so much!!
@aeleequis
@aeleequis Жыл бұрын
Aqesome that you also know Acerola. I discovered him this year and his content is awesome. (yours is also really nice)
@Thomason1005
@Thomason1005 2 ай бұрын
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!
@NonUnknownDev
@NonUnknownDev Жыл бұрын
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 Жыл бұрын
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
@HeraldOD
@HeraldOD Жыл бұрын
Quality
@dialectricStudios
@dialectricStudios 10 ай бұрын
amaing
@Extner4
@Extner4 Жыл бұрын
It's like acerola but for godot! And I mean that as a compliment!
@NekotoArts
@NekotoArts Жыл бұрын
Haha thank you! I love Acerola's videos.
@faru-music
@faru-music Жыл бұрын
Made me laugh several time. Hope you didn‘t lose a (cat)life during the research 😉
@NekotoArts
@NekotoArts Жыл бұрын
FaRu!! Thank you so much! Learning about raytracing was quite fun, I think my implementation is still incorrect but I'll fix it soon
@itsjase92
@itsjase92 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
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
@Carkoon
@Carkoon Жыл бұрын
Well, now I feel stupid. Still really cool stuff!
@WeirdBrainGoo
@WeirdBrainGoo Ай бұрын
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 Ай бұрын
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!
@kevinwilson_16
@kevinwilson_16 Жыл бұрын
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!!
@_vofy
@_vofy 8 ай бұрын
"Invalid pipelines cache header" when creating rendering device. Any ideas?
@awesomedude70
@awesomedude70 Ай бұрын
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 Ай бұрын
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.
@williamwallace234
@williamwallace234 Жыл бұрын
Wouldn't a fragment shader work just as well for this?
@NekotoArts
@NekotoArts Жыл бұрын
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.
@Chevifier
@Chevifier Жыл бұрын
This is amazing.......Ill stick with fragment and vertex shaders😂
@darkodosen1025
@darkodosen1025 4 ай бұрын
Can you link the original video for the stylized bush, at 1:34, Thanks!
@NekotoArts
@NekotoArts 4 ай бұрын
It's a screen recording I took for this project: github.com/FaRu85/Godot-Foliage
@darkodosen1025
@darkodosen1025 4 ай бұрын
@@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.
@Survivalist_Redo
@Survivalist_Redo Жыл бұрын
LET'SA FUCKING GO ACEROLAAAAAAAAAAAAAAAAAAA
@Survivalist_Redo
@Survivalist_Redo Жыл бұрын
just finished vid, thx for good vid
@NekotoArts
@NekotoArts Жыл бұрын
ACEROLAAAA YAAAAAAAAAA
@Telokis
@Telokis Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
@@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!
@pvini07BR
@pvini07BR Жыл бұрын
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 Жыл бұрын
@@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.
@extremehyperventilation4377
@extremehyperventilation4377 Жыл бұрын
Hey I see a fellow Eve fan right here! Also, Godot 4 looks lit!
@NekotoArts
@NekotoArts Жыл бұрын
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 Жыл бұрын
@@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 Жыл бұрын
@@extremehyperventilation4377 thank you! I'll listen to those ones then!
@extremehyperventilation4377
@extremehyperventilation4377 Жыл бұрын
@@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 Жыл бұрын
@@extremehyperventilation4377 good luck on your college applications! I will still use formalities with you though :D
@vicfic_
@vicfic_ Жыл бұрын
How do you animate those math equations? Its so smooth.
@NekotoArts
@NekotoArts Жыл бұрын
Its from the open-source python library made by the math KZfaqr 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_ Жыл бұрын
@@NekotoArts Oi thanks!😊
@NagiDev
@NagiDev Жыл бұрын
Sheesh Godot youtubers are getting huge these days!
@pro_rookie_gamedev
@pro_rookie_gamedev Жыл бұрын
Hi!
@NekotoArts
@NekotoArts Жыл бұрын
I'm coming for that number one spot baby
@-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
@nordup
@nordup Жыл бұрын
What fps you've achieved? Have you done any optimization?
@NekotoArts
@NekotoArts Жыл бұрын
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
@lordseptomus441
@lordseptomus441 Жыл бұрын
my brain hurts
@NekotoArts
@NekotoArts Жыл бұрын
Me too ;-; I took months to get the raytracing working
@Xotchkass
@Xotchkass Жыл бұрын
music so loud i can barely hear you
@pro_rookie_gamedev
@pro_rookie_gamedev Жыл бұрын
Fun video! You really stuck it to Twitter! 😐Now do one for GPU based cloth sim...pls...
@NekotoArts
@NekotoArts Жыл бұрын
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 Жыл бұрын
Ok, cool.👍
@Not_Even_Wrong
@Not_Even_Wrong 10 ай бұрын
The zoomer editing.... :D (^._.^)ノ
@zenzen4982
@zenzen4982 Жыл бұрын
Hey, what anime is that 1:55?
@Omnibus4Everyone
@Omnibus4Everyone Жыл бұрын
Ore Monogatari Episode 6. More importantly, what song is being played at: 02:43?
@zenzen4982
@zenzen4982 Жыл бұрын
@@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 Жыл бұрын
@@zenzen4982 Idoit would be referring to me :) More importantly, what was I going to say at 1:02 ?
@zenzen4982
@zenzen4982 Жыл бұрын
@@NekotoArts Ebola (/ω\)
@bhBlacky82
@bhBlacky82 Жыл бұрын
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!
@SodaImpact
@SodaImpact 11 ай бұрын
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.
@ChrisD__
@ChrisD__ Жыл бұрын
8:33 The reason is the that the feature is too new :>
@TheAwesomeShaz
@TheAwesomeShaz 10 ай бұрын
AAAA bro it seems like u is Indian cuz the accent is a lil similar am I mistaken?
@thanatosor
@thanatosor 2 ай бұрын
Now let Godot RT by default 😂
@DivineOwl
@DivineOwl Жыл бұрын
Are you some kind of a son of ElectroBOOM? Your editing and style is exactly like his. ^^
@NekotoArts
@NekotoArts Жыл бұрын
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 Жыл бұрын
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 ;-)
@user-in4ij7cs1z
@user-in4ij7cs1z 5 ай бұрын
"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...
@samangolahmadi2710
@samangolahmadi2710 Жыл бұрын
wtf
@astrahcat1212
@astrahcat1212 Жыл бұрын
@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 Жыл бұрын
Yeah of course anytime! Discord: Nekoto#2266
@jarrybolterbros933
@jarrybolterbros933 Жыл бұрын
bro you just stole the main music theme acerola
@flannelbeard4621
@flannelbeard4621 10 ай бұрын
Few seconds in and a BLASPHEMY - unnecessary. Absolutely ridiculous.
@adsick_ua
@adsick_ua Жыл бұрын
content is ok, but too much cringe
@bartusew764
@bartusew764 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
@@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 Жыл бұрын
@@NekotoArts ooh.. Ok now.. this actually makes a lot of sense to me Big thanks ;D
@NekotoArts
@NekotoArts Жыл бұрын
@@bartusew764 glad I could help!
@oso_estudioso
@oso_estudioso Жыл бұрын
disliked
What Is A Graphics Programmer?
30:21
Acerola
Рет қаралды 398 М.
The MOST IMPORTANT Shader Method | Godot Shader Beginners!
7:13
ПРОВЕРИЛ АРБУЗЫ #shorts
00:34
Паша Осадчий
Рет қаралды 6 МЛН
Зачем он туда залез?
00:25
Vlad Samokatchik
Рет қаралды 3,2 МЛН
Каха и суп
00:39
К-Media
Рет қаралды 6 МЛН
choosing a game engine is easy, actually
15:08
samyam
Рет қаралды 359 М.
3 Devs Make An FPS - Godot vs Unity vs Unreal || GameDev Battles
12:39
How I Created a Voxel Raycaster in Python...
5:47
Gpopcorn
Рет қаралды 6 М.
HACKING UNITY GAMES (FOR NOOBS)
16:11
cazz
Рет қаралды 72 М.
An introduction to Raymarching
34:03
kishimisu
Рет қаралды 128 М.
I made a better Ray-Tracing engine
17:38
NamePointer
Рет қаралды 248 М.
The Most Legendary Programmers Of All Time
11:49
Aaron Jack
Рет қаралды 538 М.
100 Hours Of Graphics Programming
6:48
Tantan
Рет қаралды 149 М.
An introduction to Shader Art Coding
22:40
kishimisu
Рет қаралды 945 М.
Why GODOT 4.3 is going to be wild!
9:50
Saas
Рет қаралды 120 М.
My Hero Brother‼️ How to Survive Swimming Pool😎 Like a Boss💕❤️😘 | JJaiPan #Shorts
0:49
Машина Жириновского.  #shorts Лиса рулит
0:52
Лиса рулит shorts
Рет қаралды 5 МЛН
他们在说什么,不能当面说。#海贼王#路飞
0:15
路飞与唐舞桐
Рет қаралды 11 МЛН
20 июля 2024 г.
0:58
Моби Салон
Рет қаралды 3,1 МЛН