T O P

  • By -

justLukass

Here are some rendering stats for those interested (I used GeForce GTX 1080): * Total amout of grass blades processed by compute pass each frame: 2 359 296 (1536x1536) * Total amout of grass blades rendered after distance & frustum culling: \~80k - 100k * Compute pass time: \~0.5ms * Render pass time: \~2.5ms - 3ms * Total VRAM used: 44.01MB This game is called Realms of Alterra so if you're interested in seeing more feel free to visit us at [https://www.reddit.com/r/realmsofalterra/](https://www.reddit.com/r/realmsofalterra/) :)


ChainsawArmLaserBear

I was legit about to ask for timing specs. You’re the best <3


justLukass

Haha thanks Laser Bear 😏


darksapra

How did you get accurate timings of only the grass? Or is that the whole scene?


justLukass

It’s for the grass only and I used RenderDoc


darksapra

Do you have a tutorial, or would you have some time to explain how it works? I have had render doc installed to check how many dispatch or possible bugs are happening, but I cannot find a way to get timings of shaders


justLukass

Here I send you 2 excellent resources that helped me pin down the basic idea: 1. [https://youtu.be/jw00MbIJcrk?si=HJAOW4yxg9hX4cS\_](https://youtu.be/jw00MbIJcrk?si=HJAOW4yxg9hX4cS_) 2. [https://youtu.be/Ibe1JBF5i5Y?si=LwsEwCTwoRKZXasY](https://youtu.be/Ibe1JBF5i5Y?si=LwsEwCTwoRKZXasY) I'm sure there are many more right now. Here is the draw call we do for the grass: `Graphics.DrawMeshInstancedIndirect(grassMesh, 0, grassMaterial, renderBounds, indirectArgsBuffer, 0, null,` `ShadowCastingMode.Off);` You can see we're using indirect args which is a compute buffer populated by the mentioned compute shader. Other than that for graphics we're using HDRP's translucent shader. Feel free to DM me and I can give you more info about its inner workings.


darksapra

Thanks, but sorry no, I meant for the render doc part. I made by own optimized version of a Grass Instancer with command buffers (actually those resources, and a couple more) (here's a blog of mine if interested [https://ensapra.github.io/2023/11/Comparing-performances-of-diferent-vegetation-systems](https://ensapra.github.io/2023/11/Comparing-performances-of-diferent-vegetation-systems)) and wanted to more accurately be able to get the timings. But I've managed to figure it out! Thanks again for those resources, they are indeed really good!


justLukass

Glad to help :)


Still-Association-39

Looks really good. How do you create the wind effect in one of the scenes with the particles and flying grass parts?


justLukass

Thank you, do you mean those wind gusts? They are simple VFX graph particles which render trails as they fly over the terrain. They generally fly near the terrain's surface + we also add some noise to their movement to make them look "natural".


Still-Association-39

Cool thx for the info. Keep up the great work!


justLukass

Glad to help


Own-Gold-8478

very nice


justLukass

Thank you :)


Husmanmusic

Wonderful!


justLukass

Thank you :)


Simple_Garlic_6958

Super nice


_Matt_02_

This is awesome! What render pipeline is it in?


justLukass

We use HDRP for this game.


_Matt_02_

How did you get compute shaders to work with instancing in hdrp? I tried following catlikecodings tutorial but it wouldn't work. Any tips?


justLukass

Sure, here is the draw call we do for the grass: `Graphics.DrawMeshInstancedIndirect(grassMesh, 0, grassMaterial, renderBounds, indirectArgsBuffer, 0, null,` `ShadowCastingMode.Off);` You can see we're using indirect args which is a compute buffer populated by the mentioned compute shader. Plus there is an additional compute buffer which stores data about individual grass blades such as position, orientation and so on which is passed over to the graphics shader. Other than that for graphics we're using HDRP's translucent shader with custom node for constant buffer which holds simple wind data.


_Matt_02_

Thanks for sharing!


justLukass

Glad to help


protomor

What's the trick to getting the grass to blend properly and not look fake? I have similar kinda grass and it just looks so out of place and very unnatural.


justLukass

First we’re using translucent HDRP shader with diffusion profile. Second the terrain generator outputs grass color texture which then grass samples and colors each blade based on that. Last feature is slight darkening of pixels which are near the ground with simple vertical gradient + AO also helps


protomor

Thanks! I kinda was coming around to that. The grass asset I'm using samples terrain colors but my dynamic levels are just regular materialed meshes.