How Do Games Render So Much Grass?

preview_player
Показать описание
An overview of my grass rendering explorations and an implementation of billboard grass, a common technique used in nearly every single video game.

Support me on Patreon!

References:

Music:
Gold Falls Casino - HuniePop OST
Joy - Persona 3 OST
Bad Bully - Kizumonogatari 2 OST

Chapters:
00:00 Intro
01:36 Getting Started
03:37 GPU Instancing
06:51 Improving Appearance
10:07 Finishing Touches
11:50 Optimizations
14:04 Conclusion

Thanks for watching!

This video is dedicated to my friend, Alotryx.

also please subscribe haha please man please just subscribe dude please just like one sub I swear I'm not addicted please man please just one sub please

#acerola #gamedev #graphics #unity #indiegame #unity3d #madewithunity #indiedev #unity2d
Рекомендации по теме
Комментарии
Автор

Just wanted to address one point about using GPU Instancing:

Without GPU Instancing mesh data isn't copied from the CPU to the GPU every frame. That's why the GPU has its own memory.
The mesh data is loaded to the GPU once, only a small amount of data which tells the GPU how to render that mesh is updated constantly.
For example data about where the mesh should be rendered. (uniforms)

The performance problems thus don't stem from having to load too much data to the GPU, but by bad scheduling.
When rendering each instance of an object separately, the GPU and CPU are constantly in a dialogue and have to wait for each other.
With GPU Instancing the CPU combines all of that data, sends it to the GPU and then lets the GPU vroom vroom through the workload without any interruptions.
Whats also nice is that with GPU Instancing you can just keep that data around on the GPU for as long as you like.
So you have the flexibility of updating it every frame, only sometimes or only once.

Updating a complete mesh every frame is sometimes referred to as streaming and only done in very specific circumstances. Constantly shapeshifting terrain maybe. Though even then other methods are usually preferred when possible.

spwwww
Автор

1970: people in 2020 will have flying cars
2021: in order to render grass you need grass

levelfeeders
Автор

Best video I’ve seen on the topic, love how you give detail over the whole process and explain the theory behind it… gained a subscriber

joewilliams
Автор

You could randomize the y-axis rotation, randomly darken it with a very low frequency noise for more color variation, use material ambient occlusion to further improve the definition of the grass, use an atlas of grass textures for even more variation, implement basic specular reflection for a more pbr look and some basic sub-surface scattering. Regardless, this is a nice explanation.

AlexTuduran
Автор

Hi, fellow tech artist here: Overall nice look. I would add some additional effects. Grass should animate a little more in zones of related movements, and in waves.
Then there is lighting. Calculate a standard fresnel effect (dot(pos-cam, viewDir) as uv in a fresnel LUT), and use the sky color as a tint where grass is seen very heads on. It will highlight the curves of the terrain. Also grass is a 3D structure in a vertical position, so calculating some light based on viewing direction (dot(pos-cam, lightDir)) would work wonders. As grass animates, it changes how it faces light, so could also do something here, to make it change lighting as it waves.
Lastly: grass is shiny, so adding some soft specularity (again use the pos-camPos as a pseudo normal) is a nice final touch

HKragh
Автор

That was surprisingly enjoyable to watch ... and informative ... Thank you !

adelAKAdude
Автор

4:30 I don't think storing a huge buffer of positions on the GPU is by itself instancing. The way I understand it is if you have say a 50 vertex mesh and you need to draw this say 50, 000 times, you could get the CPU to create a buffer of 50 vertices * 50, 000 and submit that large buffer to the GPU. You would still only need to do that once because the grass does not move, so you incur the hit one frame only. However that still means you are using a large amount of GPU memory on repeated mesh data and also some performance as the GPU has to process that large buffer.

So instead of duplicating all 50 identical (non-transformed) grass mesh vertices 50, 000 times, why not simply store a single instance of the grass mesh vertices on the GPU, then get the CPU to create just a position (and possibly rotation, color vertices) for each 50, 000 grass object instead of the full 50 vertex grass mesh. So instead of 50, 000 * 50 * vertex_size you are submitting and storing 50, 000 * vertex_size on the GPU (simplification but the general idea).

The GPU still needs to process this 50, 000 buffer but it is now much smaller using far less GPU memory and the GPU spends less time doing so. It then takes that single mesh instance and transforms it when rendering each instance to the correct location using the single vertex position data. Of course this means that GPU instancing is only useful for world objects such as grass where the mesh is identical for all instances. Providing a per instance rotation vector (and possibly color vector) can make this duplication much less noticeable.

Ash_
Автор

Never would I have expected HuniePop and Kizumonogatari backing music to a technical topic like this

heyjakeay
Автор

Fantastic video ! I knew everything about instancing, but for an unknown reason, I stayed until the end of the video ! Please continue to make such great content

MrWaketeu
Автор

Just discovered your channel and it's exactly what I needed, so thank you for the great content. Please don't change 🙂 the low budget 2000s look and effects is a breath of fresh air. Keep up the good work.

AndreCastel
Автор

That was great, thank you for all of the details too. I will be tackling this problem soon and so it was nice to have a direction on it.

DreamPharaoh
Автор

Underrated stuff! Was looking into grass rendering and stumbling across this was very helpful, Gonna check out the rest of the grass stuff and also the rest of the channel since your presentation on topics is great!

TacoTechnica
Автор

I love the entire way that you explain everything, I honestly learnt enough that I will remember most of it while it was entertaining - I could watch these for fun for ages

antonynepgen
Автор

Just want to inform you that both me and a friend were recommended one of your videos today despite never seeing you before.
This could be about to hit the algorithm.

Watched a few of your vids now, extremely well done content

icedude_
Автор

2:01 "In order to render grass, you need grass to render" fucking love it

ktz
Автор

Another wonderful video, Acerola. I have seen this technique used before in games I've played. Your grass looks amazing! I love the yellowing effect you added related to the height. It's amazing!

Apes-With-Computers
Автор

I love everything about this video, lmao. Super knowledgeable, funky detective and retail store style beats, intriguing kitchen/living room ted talks - instant sub.

soul-candy-music
Автор

This is an amazing video! I learned almost nothing because I already knew this stuff, but you explained it so well!

mariovelez
Автор

Dude your voice with that BGM is addictively great. It helps me sleep lol

layapps
Автор

The editing is on point. I enjoyed the video as a casual viewer and also enjoyed it as a legitimate tutorial

KoshakiDev