How to Render MILLIONS of Blades of Grass Efficiently in Godot (godot 3.X)

  Рет қаралды 53,396

Leon Stansfield

Leon Stansfield

Күн бұрын

In this video, I discuss how the godot engine can render millions of blades of grass efficiently using multiple techniques and plugins. We explore how GPU instancing, multi mesh instancing, particle shaders and the scatter plugin works, similar to Breath of the Wild in Godot
This is a Godot tutorial not Brackeys 2022.1 game jam indie devlog It is an indie game devlog tutorial with indie games like Breath of the wild 2. Godot is a open source game engine like unity and Godot tutorial how much money did my indie game make!? it is a game made by 1 person - a solo devlog! This indie game unity devlog is a unity 3D tutorial devlog. Godot
Grass project files:
github.com/LeonStansfield/god...
The grass shader I used:
godotshaders.com/shader/styli...
Acerolas grass series:
• How Do Games Render So...
Follow me on Twitter:
/ leonstansfield0
And check out the game on Itch.io:
leon-stansfield.itch.io/
Don't forget to like and subscribe if you liked the video!
kzbin.info/door/Myg...

Пікірлер: 37
@leonstansfield
@leonstansfield 2 жыл бұрын
Hi I recently noticed something about the scatter plugin which is pretty important. It seems to store each blade of grasses transform in the scene file, making larger scenes (like the one in my repo) absolutely massive... like over 100MB massive. It is still a great solution for smaller scenes though. In other news I saw this new plugin called spatial gardener which is a great solution for larger scenes. I haven't tried it out much yet, but it looks like it has automatic chunking of multi mesh instances and has built in LOD switching as well... It can be used for more than just grass as well, with the demo showing off an entire forest instanced using the plugin. It seems like a really good option and the demo runs smoothly in a large scene, make sure to check it out! Link: github.com/dreadpon/godot_spatial_gardener
@norodix6857
@norodix6857 Жыл бұрын
I was also missing these features from scatter so I decided to make them. The chunking was done a couple months ago and its called split multimesh in scatter. Just yesterday I also created a PR that enables you to not save the transforms of the instances to disk but generate them on the fly when loading the scene so they only live in ram. This obviously means it is only practical in case of modifiers that are quck to generate, like random distribution. Separating the chunking to a different thread is a good idea, maybe Ill implement it later! For now, it doesnt seem to impact the game much. A nice way to deal with the blocky edge of the chunks is to lower the grass blades in shader by the time they are about to be culled. That leads to a quite nice effect where the grass blends into the texture below it.
@psuw
@psuw 2 жыл бұрын
You can speed up the chunking system at the end of the video by using math and hashmaps/dictionaries. Assign each chunk with a chunk position.(0,0),(1,0)... Then keep a small list of all active chunks. (Chunks around the player). So if the player is at global 12.5,5.4 and the chunk size is 10 -> 12.5/10 = 1, 5.4/10= 0 => (1,0). Then get the all chunks with in that area (x+cull ->x -cull,y+cull->y-cull) and update the active map. This way time complexity remains constant (O(1) per chunk and total O(4*(cull**2)). This way you dont need a timer to check for the grass but rather have to check if the players chunk position changed. This technically also works for infinite worlds. Edit : this should work if i didnt do a thinking mistake.
@davidmurphy563
@davidmurphy563 2 жыл бұрын
You can also do it with draw passes. It's quite good for clouds too. You start on the surface of the mesh and put a load of green dots surrounded with alpha. Then in the next pass you raise it a bit and add a little movement. Repeat until you have grass. As long as you're not looking sideways on it looks pretty good and it's dirt cheap.
@tehcookiemon
@tehcookiemon 2 жыл бұрын
is there a video of this technique in action?
@danyCD17
@danyCD17 2 жыл бұрын
Isn't that also used for fur in games, also called "alpha shell"
@KillahMate
@KillahMate 2 жыл бұрын
@@danyCD17 yes. It's called shells because usually the dots are an alpha texture on concentric polygonal shells that surround the object.
@addmix
@addmix Жыл бұрын
Just in the past few days someone contributed multimesh splitting to Scatter, so now it will automatically "chunk" the multimesh nodes.
@leonstansfield
@leonstansfield Жыл бұрын
That is super cool! Thanks for letting me know!
@boerbol9422
@boerbol9422 2 жыл бұрын
Thanks so much for this great tutorial. This is the kind of tutorials we need in the Godot community. It was so helpful.
@Uwishiii
@Uwishiii 2 жыл бұрын
Awesome video! Really entertaining on top of being helpful :)
@avivshvitzky2459
@avivshvitzky2459 2 жыл бұрын
The bg music is perfect. I can sit down with a cup of coffee, relax, and listen to your explanation
@leonstansfield
@leonstansfield 2 жыл бұрын
Thank you so much!
@AnnCatsanndra
@AnnCatsanndra 8 ай бұрын
Excellent video! Thank you!
@ThiccestMayo
@ThiccestMayo 2 жыл бұрын
you are almost at 1k! Good job!
@leonstansfield
@leonstansfield 2 жыл бұрын
So close! Thanks!
@HeyItsDoodler
@HeyItsDoodler 2 жыл бұрын
Just noticed the description engineering 🤣
@HeyItsDoodler
@HeyItsDoodler 2 жыл бұрын
Subscribed! Race to a thousand
@Snikur
@Snikur 2 жыл бұрын
Instead of looping through all the grass and cull per timeout, you could do 1 (or more) chunk per frame to smooth it out.
@leonstansfield
@leonstansfield 2 жыл бұрын
This is true and would be optimal. However I could not be bothered haha. This is the best solution tho
@warsin8641
@warsin8641 10 ай бұрын
I like how grass has been one of the most unexpectidly hardest things I've had to do 🤣
@lecloutpanda
@lecloutpanda 2 жыл бұрын
well made
@narrenschlag
@narrenschlag 2 жыл бұрын
Good video
@leonstansfield
@leonstansfield 2 жыл бұрын
Glad you enjoyed
@Aragubas
@Aragubas Жыл бұрын
raccoons are so cute!
@user-og6hl6lv7p
@user-og6hl6lv7p Жыл бұрын
You really should be using "distance_squared_to" instead of "distance_to" for this particular scenario. It is even recommended by the documentation if you have read it. Precision doesn't matter because you're just activating/de-activating giant "chunks, you don't need to calculate collision or anything. You will most likely need to scale the resulting value. You should seriously do this straight away, because although it may run well initially, you're gonna have problems when you start adding AI and collision. Use "distance_squared_to". Do it.
@leonstansfield
@leonstansfield Жыл бұрын
Yeah good idea!
@sanaysspace
@sanaysspace 4 ай бұрын
A Short Hike? ❤
@Asteinkai
@Asteinkai 2 жыл бұрын
what's the music in background uwu ?
@leonstansfield
@leonstansfield 2 жыл бұрын
Mix between animal crossing, Zelda and a short hike in this one!
@Allen-cx6yi
@Allen-cx6yi Жыл бұрын
where can i get the grass blades?
@leonstansfield
@leonstansfield Жыл бұрын
I just made them in blender, they are also in the github repo in the description.
@yudi8204
@yudi8204 2 жыл бұрын
📌
@sakamotoshinonome
@sakamotoshinonome 2 жыл бұрын
Am I first ?
@davidmurphy563
@davidmurphy563 2 жыл бұрын
No, that was Neil Armstrong.
@leonstansfield
@leonstansfield 2 жыл бұрын
No it was yuri gagarin
@davidmurphy563
@davidmurphy563 2 жыл бұрын
@@leonstansfield I was going to say we were both wrong and it was Ernest Shackleton but it turns out it was Billy Simmons in third grade behind the bike sheds.
13 ADDONS to SPEED UP your game creation in GODOT!
11:23
MrEliptik
Рет қаралды 104 М.
I Made the Same Game in 8 Engines
12:34
Emeral
Рет қаралды 3,9 МЛН
LOVE LETTER - POPPY PLAYTIME CHAPTER 3 | GH'S ANIMATION
00:15
New model rc bird unboxing and testing
00:10
Ruhul Shorts
Рет қаралды 23 МЛН
Beautiful gymnastics 😍☺️
00:15
Lexa_Merin
Рет қаралды 12 МЛН
Дарю Самокат Скейтеру !
00:42
Vlad Samokatchik
Рет қаралды 8 МЛН
Giving Personality to Procedural Animations using Math
15:30
t3ssel8r
Рет қаралды 2,4 МЛН
How Do Computers Render 3D Graphics?
12:52
Leon Stansfield
Рет қаралды 1,9 М.
Godot - Terrain Prototype Test
3:21
Polygarden
Рет қаралды 19 М.
MORE VFX Shader Techniques ft. Godot
8:43
onetupthree
Рет қаралды 21 М.
How Do Games Render So Much Grass?
15:52
Acerola
Рет қаралды 322 М.
How do Major Video Games Render Grass?
9:33
SimonDev
Рет қаралды 398 М.
how grass is made in games
2:38
pixelzio
Рет қаралды 9
The Best FREE Software for Game Development! (In my Opinion)
11:06
Why Making Multiplayer Games SUCKS
6:46
Tom Weiland
Рет қаралды 412 М.
10 Дней в мире Страшных Мобов в майнкрафт
44:16