Six Grass Rendering Techniques in Unity

preview_player
Показать описание
Ever wanted to add grass to your game? There are many ways of implementing grass in Unity, and while one technique could be great at one thing, it might suck at another. In this video, I'll go over six grass rendering methods and explore what makes each one great in certain situations.
Made with Unity 2021.3.0f1 and URP 12.1.6.
------------
------------
------------
------------
------------
00:00 Introduction
01:22 Method 1: Mesh Grass
04:33 Method 2: Geometry & Tessellation Grass
07:32 Method 3: Procedural Rendering & Compute Shaders
15:30 Method 4: Billboarding
17:54 Method 5: Terrains
19:39 Method 6: Impostors

#gamedev #shaders #madewithunity
Рекомендации по теме
Комментарии
Автор

The king returns. You and Ben Cloward are Shader geniuses

LowLevelLemmy
Автор

This is a great overview of grass rendering methods. It's important to note that you can combine multiple solutions for near vs. far grass, but you have to get the colors/lighting to match and make the transition incremental. I like to use a pixel dissolve effect when transitioning from geometry to billboards, or when switching between imposter images at different angles.

The approach I used that works well is to generate some number of square grass patches (I use 32) and randomly select from one of these for each terrain tile/chunk. Then these are drawn across the terrain using hardware instancing. I also generated several lower LODs by recursively finding the nearest pair of grass blades and merging them into a new blade with the sum of the surface area, the average of the color, and the average of the height. Each LOD is half the size, and they're all stored in the same buffer. Then for 4 different LODs you have up to 32*4 draw calls for each mesh of each LOD.

In addition, I use hardware tessellation shaders to curve the grass blades when close to the player and apply a wind effect that scales with distance from the base to the tip so that the ends move more in the wind. This system can support a field of grass that stretches to the horizon at about 300 FPS on a GTX 1070.

FrankGennari
Автор

EXCELLENT video! This is quality right here!

It would have been cool to see the mixing of mesh, imposters, and billboard at different LODs implemented just to fully observe the effects - but what you DID show was also very helpful!

Thanks for this, gonna look at your other videos now!

CodexHere
Автор

Such an amazing tutorial. The procedural geometry way I can only get to render in one eye though for VR, trying to search how to fix this, seems ill need to add lines to the shader

ayayrawnnn
Автор

You are a God send. I have your book and was about to look at the computer shader grass section for a mobile VR project, but now here's a lovely video on multiple ways!

Chris-jozr
Автор

Thanks Daniel, this is exactly what I needed, love the detail you go into, thank you for creating this content!

shane
Автор

This helped me a lot. Thank you for the video!

samivanni
Автор

thank you for your amazing grass assets, it was just what I was looking for. It's also really fun to play around with the settings

iDabbl
Автор

Thank You brother again for teaching me something new :), Keep posting

subhradipmajumder
Автор

TIL you can enter functions into the transform position inspector!

samhblackmore
Автор

i love grass, man. i work in win32 so not the same, i was figuring on using shells next time i want grass, and an abstraction (several layers of squares like uninterpolated wind positions). i don't know if i missed it, a good tip i herd was to mix the terrain normal for specular at a distance to reduce aliasing. anyway, here's hoping some folks out there get the good word about the abstract.

atomictraveller
Автор

Very clear and informative, I took some notes ! thanks :)

AlexandreCoulonOldChannel
Автор

this was a great video, instructional enough for me to be able to choose what style would work for a world im making, spent days making multiple different meshes but painting the terrain with a grass texture worked great

SincerestSawa
Автор

Cool video, I have known something new!
What about others Terrain grass methods? (Instanced mesh, Grass mesh). I think they are somehow related to batching approach?
Thanks for your work!

hulponot
Автор

Great tutorial. is there a chance you could cover Mesh Shaders sometime? (Mesh shaders/meshlets?)

Memeieli
Автор

WOW! Where I can read more about "math functions" that you typed in the transform component in 3:50? I never heard about it! :O

TheMrPawolo
Автор

Hey awesome video. The audio is quiet though, sound far away

Massive-D
Автор

this was so informative thanks, just curious what grass do they use in top-down games, I noticed that recent top-down city builder games such as Manor Lords or Farthest Frontier are literally littered in the grass, how is that not slowing the performance? in the past top-down games never had any actual grass just texture ...

Berndr
Автор

You should really lower the sound of music in your video. Great video though!

omelette
Автор

Amazing content! Unfortunately procedural+compute grass crashes Unity 2021 and 2022 without console errors

day_that_i_die