- Home /
[SOLVED] Which is faster and more efficient?
Just wondering which you think would be the most efficient in terms of processing in order to improve the speed of a game.
Would it be better to use Unity's grass system, where you just paint the grass on? I've found that to be incredibly slow if you're using a lot of it, although an advantage would be that it reacts with the wind without the need for animating.
Or would it be better to create a model of some grass, animate it as though it is blowing in the wind, place multiple instances of the grass object in the Unity scene, and have the animation loop?
Is one option faster or 'cleaner' than the other?
Thank you in advance :)
One thing to note, Unity grass is turn-to-face billboard style. Standard "$$anonymous$$$$anonymous$$O" grass is fixed in place.
You may prefer one look over the other.
I'm asking based on performance rather than aesthetics, but thank you
Answer by markfm · Jan 07, 2013 at 07:01 PM
The most honest answer anyone can give you is to try it yourself. Reason being is that we don't know how full you want it. The grass may seem heavy, but that is because you over indulged with your settings. Try lower the settings, we all wish to have a lush full grass field... but the reality is, you can't at this time. The one implemented in unity on a grass blade by grass blade basis is far lighter then the time you have to code.
But then again I could be proven wrong, every implementation as good as it is can be beaten, but not in the way you are saying.
i.e. Stick to unity's grass system and save yourself a headache.
$$anonymous$$ore on the built-in grass settings: the default settings are just silly high, like crabgrass in a pasture, at least on Unity3.5.5. If you play with the settings, it still gives that same solid mass of billboards. So, you figure grass is always that way.
You have to drop both Opacity and TargetStrength to almost nothing before it thins out to where you can even see the ground.
I think neither of you are grasping the point of the question. This is not about settings or how the grass is used, i am merely hypothetically asking if i had a field of a modest amount of grass using the unity system, then another field of the same amount of grass but instances of a grass object- which would be faster or better in terms of performance? When using the unity grass system- even VERY sparingly with the settings, i always find it to dramatically slow the game. Hence this question
Your question does not have an answer, thus we are trying to guide you. The question lies on how many blades of grass you will use. It not worth for example to use the inbuilt system for 5 blades of grass. Its no the fact that we are not understand but rather that your question does not have a straight answer. The same question would be, whats hotter an iron rod or a burning wooden stick, it logical to ask the temperature of each before attempting the question.
Using the hypothetical two fields in my previous comment though... Both fields the same size, one field has 200 blades of unity grass, the other field has 200 blades of instanced object grass. In comparison to one another is there any difference in performance? Are you saying for larger areas of grass it would be better to use unity's system but for smaller areas, an instanced grass object? Surely a large amount of unity grass would be slow as hell. Apologies if I am appearing rude or anything, I am just trying to figure out the best way to do this without slowing the game too much. The same question would apply to trees too. Say I wanted a forest with 50 trees- Unity's system or an instanced tree mesh?
I would try it myself but I thought someone on here might have already asked themselves the same question.
Oki looking at the question from a technical point of view:
Unity has an inbuilt system whereby it instantiates the grass as a plane and uses an aplha based texture to show the grass blades. You would most probably do the same thing, but include a script to rotate the blades towards you etc.
If you could program a system which meets your own requirements only, then it would be faster as there aren't all the other parameters, however if you use unity grass and maximize its features then the performance hit would be pretty much the same.
A large amount of grass on any side would be slow, think about his from a Unity developers perspective, if there was an a lighter and better way to implement the system, they would have used that..
The only reason I would use a self created system would be to avoid the terrain performance hit. Grass is expensive, there is no way around that. What is most expsnive is the Draw calls, something which has been solved by another user..
https://www.assetstore.unity3d.com/#/content/582
I suggest you purchase that.
Answer by GXMark · Dec 30, 2014 at 08:08 PM
I've been tackling this same issue in my game. I have noticed that a complete grass redraw occurs even when you change a patch of the terrains height map. You can achieve this using the setHeights and using the offsets in the parameters. Unfortunately, unity still completely redraws the grass system and not the patch of ground under the grass which is really all that needs updating.
I think its an optimisation bug they could easily fix.
The author above mentioned the question of a comparision of a self made grass system versus the unity grass system. Please refer to the advanced foliage shader on the asset store as a benchmark since this system can place good quality foliage as gameobjects. But if i were a betting man i don't see how you are going to really get compariable performance with a native implementation inside unity's terrain engine.
A work around for this issue could be to reduce the detail draw distance or density on application of ground height changes and then for example on mouse release reinstate the density and draw distances. I found this to be a compromise to maintain ground modification performance in my game during gameplay.
Hope this helps someone
Your answer
Follow this Question
Related Questions
Shimmering waves of wind-blown grass possible? 1 Answer
Wind: Detail meshes are moved by wind back and forth, rather than swaying: how do I make them sway? 7 Answers
making grass move at different speeds 0 Answers
Wind blowing over trees and grass in Unity 3 1 Answer
How can I give an object realistic wind? 0 Answers