Custom Grass System - How might I go about optimizing it?

Hey there. I want to make a custom grass system similar to Roblox’s but with more customization. Making a system like this takes many things, and I feel like I know how to do it mostly, I do have one main question:

Here’s some stuff I know:

  • I can use the brushtool plugin to paint my custom grass onto things. This way I don’t have to manually place tons of grass blades.
  • I can use 2 planes of grass instead of 3D modeled grass blades, however the planes of grass isn’t up to modern game standards.
  • I can use the Wind Shake module to move the grass.

Here are some examples of other developers making similar things:

Here’s a video that gave some great info on the topic of grass systems:

Part of this post is me trying to put my knowledge and steps of making this all in one place. This is so if someone else is trying to do this sort of thing, it is very easy to try and make it. Any info on this subject would be great, but currently I’m stumped on the optimization side of things.

1 Like

I guess that you can optimize the grass rendering by only loading grass that is not too far away within the camera’s frustum.

image

4 Likes

In my experience with this on roblox, I’d suggest dropping the frames of the grass the further away they are, and then eventually stashing them into a cache located somewhere out of the “workspace” (As they are already generated, and so are easily reapplied later by dragging them back into the workspace).

Another thing is the amount of random data working at once. If you have a random set of data for every individual grass stem it’ll look better as a simulation, but will be unnecessary as a game asset. It’d be better to make 10 sets of random data changing, and then set the stems to these lists, but change their initial rotations. Then it still looks random and only has 10 sets of data running rather then 100 or 1000.

I hope this helps.

3 Likes

You can make this work for custom grass in roblox, I can confirm from experience.
However, it can and will likely double the script activity, and puts a heavy toll on performance over all.

If you can find a way to do it without impacting performance good on ya!

1 Like

As @DylanD319 mentioned, it is possible to cache the grass. I’m not very good at optimization, and the grass system I made had a lot of flaws, including it being laggy due to beams, though, one thing you definitely could do is instead of making the mistake I made and looping through every grass part in the folder they are present in, you could instead cache them and create them on the client, that way they didn’t take up anything on the server, and you wouldn’t have to worry about them still being present even if they were out of the cameras field of view.

One thing I would note is that I used beams for mine, and although it gives a really nice effect, it can take a lot of performance up. However, another workaround I learned from @boatbomber’s WindShake module, is that you can parent an attachment to the Terrain object, and allow them to be essentially ‘free-floating’ attachments, no parent BasePart neccesary. This would make it more efficient because parts can sometimes be quite inefficient when you have a mass amount of them.

I would play around with grass rendering techniques, and also look on the devforum for more optimization tips, or even look at the source of other peoples creations. It can be really helpful sometimes.
Best of luck on your grass system. I really enjoyed making mine, and also testing out Dylans a while back when I found it. I hope in the future we get better customization for Roblox’s decoration grass, but it is a good learning experience to make your own.

1 Like

That is true, but you will always impact performance someway and it really depends on the implementation. There is probably a way to realize my approach in a performant matter.

Also, your solution is really not too different from mine. In fact, you can combine caching with my solution. The only difference is that you render all the grass within a certain radius from the player and I only render a pizza slice of that circle.