r/howdidtheycodeit • • Nov 06 '19

How does BoTW render the grass?

The grass in BoTW is beautiful, and it's very thick and dense, what kind of techniques did they employ to render so much of it?

Example 1

Example 2

121 Upvotes

15 comments sorted by

46

u/[deleted] Nov 06 '19

I can't help you with that, but I can link you to one really short pdf file about how grass was generated and rendered in GRID: Autosport

http://blog.codemasters.com/wp-content/uploads/2014/10/Rendering-Fields-of-Grass-using-DirectX11-in-GRID-Autosport.pdf

7

u/Ziamor Nov 06 '19

Thanks, this looks like a good source!

3

u/[deleted] Nov 06 '19

This is so well thought of. thanks!

8

u/[deleted] Nov 06 '19

This is a guess, but it's probably GPU instancing. Multiple instances of the grass are created within the GPU.

6

u/capedChameleon13 Nov 06 '19

A good approach is to use a combination of tesselation and compute shaders. Tesselation shader uses a single point to generate the vertices of a blade of grass. Compute shaders are for culling, lod, applying forces like wind and gravity.

Check this project, https://github.com/AmanSachan1/Vulkan-Grass-Rendering/blob/master/README.md

Don't remember if I implemented lod culling or not.

9

u/InterimFatGuy Nov 06 '19

Making the LoD distance semi-random is genius.

3

u/Alawliet Nov 09 '19

Could you elaborate on this? What makes this genius? What effect does it produce that it is better than just using a constant lod?

6

u/Lv_InSaNe_vL Mar 17 '20

Sorry to post so long after your comment but it helps hide the divisions in LOD. Since humans are great at seeing straight lines its alot easier to tell when the LOD changes if its at a fixed point.

2

u/Alawliet Mar 17 '20

Ah I see what you mean. Thanks for replying after so long

3

u/Cem_DK Nov 07 '19

Since no one has mentioned it: roystan has a nice grass shader tutorial. I think if you tweak the settings right, you can come very close to botw's grass. If you use this shader imho skip the part where the grass casts shadows.

4

u/[deleted] Nov 06 '19 edited Nov 06 '19

I saw a guy show something very similar on either r/Unity3D or r/gamedev

I'll have a look.

Edit:

https://www.reddit.com/r/Unity3D/comments/cr3ymb/prototyping_some_zelda_style_mechanics/?utm_medium=android_app&utm_source=share

Kinda. I swear I saw a game that looked exactly like that.

1

u/__Cmason__ Nov 06 '19

I remember seeing this a few days ago too

2

u/furiant Nov 07 '19

The thing to keep in mind regarding BotW's grass is you can cut it short, so it's not some simple "fill area with x entity"

I'm not a coder, so I can't give any proper insight, but my guess is something amazing and simple at the same time.

-8

u/toad02 Nov 06 '19

Google Grass Shaders