0 votes

I am using multimesh to render a lot of grass and everything is working well. The performance is acceptable but I want to have some kind of lod system where when you are far from the grass the visible instances of the multi mesh are lowered.

There are two ways to do that. One is set MultiMesh instance count to a lower number and the other is to set MultiMesh visible instance count to a lower number.

I want to use the latter as it does not force update of the buffer. The problem is if I just set MultiMesh visible instance count to a number, the MultiMesh does not update.

I don't want to update instance count because it will update the buffer. The reason for that is I am setting the grass strands positions to random locations and I don't want their locations to be updated when I hide some instances. I just want to hide some strands without rebuilding the MultiMesh.

Any help will be appreciated.

Godot version Godot 4 beta 3
in Engine by (2,017 points)

1 Answer

0 votes

None of these will help to make this system, because reducing any instance count will start removing instances from recently created instances, so it will not reduce mesh density. You may need to use instancecustomdata and set ALPHA of given instance to 0 using its shader. You will have to keep track of mesh indexes, and set these indexes invisible following some calculation ( for example every 3rd index, and when You are even more far from the grass - every 2nd index )

by (8,101 points)

Actually godot 4 currently has a bug that's why visibleinstancecount does nothing.
But thanks for your answer.

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.