The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

Hi All!

What is the recommended way to create grass cells on a 3d grid map without too much performance cost?

I've been experimenting with multimeshes with PNG grass textures on them but performance suffered horribly. I've also tried instancing dozens of those PNG-textured meshes (basically, everywhere I had a 'grass' cell) and it was a little better but still caused huge performance drops. I keep seeing games on Steam with lush grass and other vegetation covering large patches of terrain with seemingly no FPS cost. How is this achieved?

in Engine by (513 points)

2 Answers

0 votes

Have you looked at a MultiMeshInstance? You can create hundreds of copies of something without much of a performance hit.

by (3,164 points)

Yes, as mentioned above, the multimesh instance was my go to method for this as I'm already using multiple multimesh instances for other props in my world. Unfortunately, once a mesh has a transparent texture, performance suffers greatly.

Ah, thanks for the clarification.

There is one method I've seen which utilizes shaders. Here's a video where the author of the video describes how he made fields of grass using shaders.

There's the shader approach, and there's also using 3D models of grass. If your PNG files use transparency, that's what may be causing the slow down. I've used 3D grass models from this pack in some scenes.

+1 vote

I think the problem is not the way you use your png but the fact that you use a png

the transparency of a png is the problem because your gpu has to render pixels that are transparent and if a pixel is transparent your gpu redraws the surface beneath it too and this results in a huge bottleneck

try to avoid tramceparent pices of mesh

by (16 points)

Yeah, I was wondering about the PNG transparency when I wrote one of the comments.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.