I was trying to figure out how to pass textures into a compute shader, and now that I see how it's done... I definitely wasn't close to figuring it out, lol. This is gold, thanks mate!
Excellent tutorial! Thank you for taking the time to explain compute shaders. I wish Godot had more documentation about them because they're such a powerful tool for advanced effects.
A wonderfull tutorial! There is so little information about any of this online, it's great to see somebody taking their time to investigate what's possible.
Thank you. You actually cared to explain what each segment of code did. I was getting very frustrated trying to understand compute shaders, but this video helped me understand it better.
Turns out RGBA8 is required to use a texture in a sampler. If it doesn't have an alpha channel then the rendering device will throw an error. To fix this, you can use `image.convert(Image.FORMAT_RGBA8)` to convert its format first.
Thank you for this amazing tutorial! : D It is a very nice intro to compute shaders in Godot! PS: For future reference, if anyone is getting nonsensical counts, remember to wrap the output with floor().
Great video, lots of stuff learned watching this! I'm hoping to have the time at some point to try a water shader using compute shaders and use the outputs for water physics.
I dont normaly give comments to youtube videos but this one actually got me to my solution i needed and to avoid using unity. Thank you so much for helping so i can make my idea using the godot 4 with compute shaders utlizing the cpu and the gpu for my ai architecture design :D
Just to say I have indeed been doing non-game stuff, now on Godot 4.2, and working on sharing my non-visual data (processed by compute shader) with a graphics shader without going through the CPU, so I can visualize the data but maintain framerate.
Very dope video! You definitely deserve more attention. It would be cool to see trails (particle trails or if there are other types of trails) explained, as i just cant get them working right!
@@crigz Somehow whenever i tried particle trails i couldnt get them to render properly. They always were a random mess of stretched triangles or whatever. Also sometimes they became super large or the actual particles didnt even render (just the trails, but those buggy)
hey, as much as i love the computer shader solution, i can't help but to feel it's over engineered, a simpler solution would had to been to use a viewport to downscale the 2048x2048 texture to 32x32 and then calculate based on that, could be done even in the main cpu thread without much of performance impact. it's obviously not fun solution but solves the issue without having to taxs the GPU or a entire thread, i still would like more content about computer shaders.
Killer video! I'm having doubts that Splatoons is used compute shaders for Wii U (Splatoon 1 in 2015) & Switch. My guess is that it's just a collision system + some approximate area calculation based on collision position.
Ooh, do the compute shaders support doubles? I tried to do some fractal stuff in Godot before because of the ease of setting up ui and input, but you very quickly hit precision limits... Also, can it only do compute shaders through GL? How about OpenCL (would be nice since I've already written some OCL stuff now...)
Out of interest, in the performance comparison. Is the CPU version completely single threaded? E.g. no usage of threads on the system etc? Likely you would still not get close to the gpu perf but it would make for a slightly more 'fair' comparison potentially.
as someone who uses a lot of compute shaders in unity, this looks absolutley horrendous. Good video, but man, I really hope I just dont understand it yet, or that compute shaders in godot will get significantly better in the future. Edit: Well, thats way to harsh to say to a small team of developers working on, and open sourcing a pretty good piece of software for free for everyone. I'd like to formally retract that statement, its not horrendous, but I do hope that they'll be able to make it as simple, easy, and structured as unity compute shaders with future updates.
I was watching your previous splatoon tutorial and was thinking of a way to get rid of the seams. Regardless of the way the texture is unwrapped. This would only work on a compute shader because of the search space, but it should be massively parallel. I'm not 100% sure how to do this. In blender is there a way to generate a texture that matches the XYZ coordinates of a 3D surface using the same unwrap as the painting texture. This would give you a texture where paint can be splashed, and a lookup table for all splashable surfaces in 3D. In this way, we have a texture that matches the unwrapped texture, but we have XYZ coordinates for the entire level. Then when a splash happens you feed in this texture, the coordinate of the splash and the output is a texture of said splash. The way it works is ... if a 3D texture lookup triplet is inside the 3d radius of this splash sphere, it would fill in the output texture with the splash color. This should work quite flawlessly.
@@crigz I was looking into this myself and quickly realized you can easily paint through walls and backfaces, so there's a technical thing there to sort out. Seems similar issues would happen in your version too.
@@prozacgodgamedev Painting through walls and back-faces aren't an issue in this system, it's mostly painting over into other UV's if you don't leave enough margin, and there's not a proper wrap around on corners unless you perfectly place the UV map (not always possible). I've got a few ideas I'm experimenting with to fix this though.
@@crigz I'm setting up to attempt to build something akin to your splatoon level and a godot fps scene to attempt a real go at it. I'm not ... that well versed in ... well anything here, I'm winging it :D It'll be fun!
I was trying to figure out how to pass textures into a compute shader, and now that I see how it's done... I definitely wasn't close to figuring it out, lol. This is gold, thanks mate!
Excellent tutorial! Thank you for taking the time to explain compute shaders. I wish Godot had more documentation about them because they're such a powerful tool for advanced effects.
This is great, thanks! Info on compute shaders are so rare, hopefully it becomes more mainstream.
I hope so too! You can do some incredible things with them, it's a tool everyone should have in their belt.
amazing video, i wish there was more content like this, Godot 4 is truly a step up from Godot 3
A wonderfull tutorial! There is so little information about any of this online, it's great to see somebody taking their time to investigate what's possible.
Wow, you’ve quickly become one of my favorite Godot resources!
Thank you. You actually cared to explain what each segment of code did. I was getting very frustrated trying to understand compute shaders, but this video helped me understand it better.
Godot 4 tutorials are comin in!! Great video! Its a cool thing to show off that the engine can do! You definitely earned a subscriber 😊
Turns out RGBA8 is required to use a texture in a sampler. If it doesn't have an alpha channel then the rendering device will throw an error. To fix this, you can use `image.convert(Image.FORMAT_RGBA8)` to convert its format first.
this was helpful, thank you
I have been banging my head on this issue until I came across your comment. As an addendum the PNG also can not have mipmaps.
damn was looking for a compute shader tutorial, just to get an idea how it would work. definitely earned a sub 👍
Thank you for this amazing tutorial! : D
It is a very nice intro to compute shaders in Godot!
PS: For future reference, if anyone is getting nonsensical counts, remember to wrap the output with floor().
Wait, wtf, that makes no sense - there shouldn't be any difference?
Can anyone try this in Godot 4.3 and confirm?
Great video, lots of stuff learned watching this! I'm hoping to have the time at some point to try a water shader using compute shaders and use the outputs for water physics.
Another vid so quick! Amazing stuff.
I dont normaly give comments to youtube videos but this one actually got me to my solution i needed and to avoid using unity. Thank you so much for helping so i can make my idea using the godot 4 with compute shaders utlizing the cpu and the gpu for my ai architecture design :D
Your video has been super useful and came at the exact right time for my project. Thanks! Subscribed.
Thinking of doing some non-game stuff in Godot 4 and this will come in very handy!
Just to say I have indeed been doing non-game stuff, now on Godot 4.2, and working on sharing my non-visual data (processed by compute shader) with a graphics shader without going through the CPU, so I can visualize the data but maintain framerate.
This is great, thank you. Would love to see what IS a more efficient way to do it. :)
Very dope video! You definitely deserve more attention.
It would be cool to see trails (particle trails or if there are other types of trails) explained, as i just cant get them working right!
Cool idea! What in particular did you struggle to get right with them?
@@crigz Somehow whenever i tried particle trails i couldnt get them to render properly. They always were a random mess of stretched triangles or whatever. Also sometimes they became super large or the actual particles didnt even render (just the trails, but those buggy)
@@arez-dev is that in Godot 4.0? I had to scrap the splash particles I set up because they're currently so buggy in the beta.
@@crigz Yep it is!
Beastly content, and appreciated
hey, as much as i love the computer shader solution, i can't help but to feel it's over engineered, a simpler solution would had to been to use a viewport to downscale the 2048x2048 texture to 32x32 and then calculate based on that, could be done even in the main cpu thread without much of performance impact.
it's obviously not fun solution but solves the issue without having to taxs the GPU or a entire thread, i still would like more content about computer shaders.
Killer video!
I'm having doubts that Splatoons is used compute shaders for Wii U (Splatoon 1 in 2015) & Switch. My guess is that it's just a collision system + some approximate area calculation based on collision position.
I can't figure out how to clean after submitting. The memory is bulking (Godot 4.1.1.stable)
Super helpful! Thanks
Do we have to use external editor for writing compute shaders?
Thank you!
How do you make the fancy operators, like merging >= and ==?
Ooh, do the compute shaders support doubles? I tried to do some fractal stuff in Godot before because of the ease of setting up ui and input, but you very quickly hit precision limits...
Also, can it only do compute shaders through GL? How about OpenCL (would be nice since I've already written some OCL stuff now...)
Currently the `RenderDevice` class uses only a Vulkan backend for compute
My brain is basically fried right now xD
Out of interest, in the performance comparison. Is the CPU version completely single threaded? E.g. no usage of threads on the system etc? Likely you would still not get close to the gpu perf but it would make for a slightly more 'fair' comparison potentially.
lezgooooooooooooooooooooooooooo thank u so much
Nice video
as someone who uses a lot of compute shaders in unity, this looks absolutley horrendous. Good video, but man, I really hope I just dont understand it yet, or that compute shaders in godot will get significantly better in the future.
Edit: Well, thats way to harsh to say to a small team of developers working on, and open sourcing a pretty good piece of software for free for everyone. I'd like to formally retract that statement, its not horrendous, but I do hope that they'll be able to make it as simple, easy, and structured as unity compute shaders with future updates.
would it be possible to take in an image and change the colors around a bit? like if i wanted to change color1 to color2?
Yes, you can do something like that.
@@crigz Do you have any idea on how to get started on doing that? Cause there's no documentation for compute shader stuff xd
I was watching your previous splatoon tutorial and was thinking of a way to get rid of the seams. Regardless of the way the texture is unwrapped.
This would only work on a compute shader because of the search space, but it should be massively parallel.
I'm not 100% sure how to do this. In blender is there a way to generate a texture that matches the XYZ coordinates of a 3D surface using the same unwrap as the painting texture.
This would give you a texture where paint can be splashed, and a lookup table for all splashable surfaces in 3D.
In this way, we have a texture that matches the unwrapped texture, but we have XYZ coordinates for the entire level.
Then when a splash happens you feed in this texture, the coordinate of the splash and the output is a texture of said splash.
The way it works is ... if a 3D texture lookup triplet is inside the 3d radius of this splash sphere, it would fill in the output texture with the splash color.
This should work quite flawlessly.
I'll have to look into this for sure!
@@crigz Thanks, I hope my explanation was ... adequate!
@@crigz I was looking into this myself and quickly realized you can easily paint through walls and backfaces, so there's a technical thing there to sort out. Seems similar issues would happen in your version too.
@@prozacgodgamedev Painting through walls and back-faces aren't an issue in this system, it's mostly painting over into other UV's if you don't leave enough margin, and there's not a proper wrap around on corners unless you perfectly place the UV map (not always possible). I've got a few ideas I'm experimenting with to fix this though.
@@crigz I'm setting up to attempt to build something akin to your splatoon level and a godot fps scene to attempt a real go at it. I'm not ... that well versed in ... well anything here, I'm winging it :D
It'll be fun!
Did you manage to draw a triangle with RenderingDevice?
Can you do next anime shader?
*Cuts off head to rub brain*😅
Music.... would love to have it toned down
First