Godot 4: Grid shader tutorial (all details explained)

preview_player
Показать описание

#godot #godot4 #godotengine #shaders

Hi everybody! In this video, we will create a shader that displays a grid. It may sound simple, but such a grid is a very useful element, whether for debugging or its use in various effects.
Рекомендации по теме
Комментарии
Автор

I enjoyed this, it may seem like a kinda redundant concept to render a grid when a texture could do, but we have to remember this is generated on the GPU, and we have far more control over it then a texture, not to mention learning to code shaders are a critical step in understanding how the GPU works, plus you add animation and rotation something that a texture wouldn't handle as smoothly...and finally because its on the GPU we can do it efficiently and leave more room for the CPU to handle the games' logic. 10/10 all the way.

mouseteck
Автор

Thank you for taking the time to teach and demonstrate the basic algebra and trig parts on a graph. In this way we can guess or think more purposefully toward the effect we want beyond the bounds of the tutorial here.

spectre.garden
Автор

Huge thanks for such detailed explanation, I was able to adapt this to Bevy and wgsl. For anyone looking to have this as an "overlay", change color's alpha value instead of multiplying color itself

omglynx
Автор

I am really loving this information its few and far between to find a tutorial that covers this simple of a topic without introducing unnecessary information while also being so critical for a game developer to understand and master. I have really searched for years on just this simple topic lol Thank you so much!

purplepixeleater
Автор

Thanks for the video.
Would have been good to have a background color and a grid color.

Just subbed.

TheMrSnipey
Автор

GODOT не может Direct X 11 поддерживать под WIN 7, это единственный момент, который может стимулировать свой движок создавать.

darkhunter
Автор

Really cool video! One thing for me is I could follow this and get the grid, but I wouldn't feel like I truly undershoot things. I'm guessing reading the book of shaders is the quickest way to start getting some of the basics?

Just a bit left to go in this video, but I want to see if you have any videos on making things have a glow a la Geometry Wars. I know the Glow function can be a good starting point, but it seems to effect everything in game. Unsure if I can/should do that via a shader. Any thoughts/tips or a video you'd recommend?

MichaelGame_Dev
Автор

Hello Fencer I realize that this video is a year old now. But how would we account for grids that are not even, for instance 3 and 5. In this current implementation any odd number for the zoom results in the outer part of the grid getting cut off. Thank you if you have time.
Update: I went to the drawing board and came up with a solution.
We simply add this function to the shader:
bool is_odd(float number){
if (mod(number/ 2.0, number/ 2.0) == 0.0){
return true;
}
return false;
}

Then add this line to the fragment shader:
if (is_odd(zoom) == true){
uv += zoom/2.0;
}

wolfrage
Автор

This is very nice and interesting, but wouldn't it be simpler and efficient to use simple texture?

aresnir
visit shbcf.ru