- Home /
Is is possible to place vegetation on a custom mesh?
Hello, is it possible in Unity to place (or paint) vegetation assets on a custom mesh (NOT a Unity terrain)?
And if so, will they still behave like vegetation should (slowly blowing in the wind)?
Answer by Seith · Jan 15, 2013 at 03:37 PM
The answer to both questions is: yes! Please see here: http://answers.unity3d.com/questions/360854/vegetation-animation-on-non-terrain-mesh.html
Here: http://answers.unity3d.com/questions/360854/vegetation-animation-on-non-terrain-mesh.html
That is the correct URL to what Seith was trying to link. He also had the correct link, but a period was somehow placed at the end of the URL; sending people off to the wrong place.
In the future though, please try to Google rather than bump an Answer from 2012. This was actually the first Google result, and matched.
Oops, hadn't noticed that. I just removed the period from the link. Thanks Gamershaze.
The question is how to place vegetation on a custom mesh. Your link is about how to animate vegetation already on a mesh...
So please answer the question^^!
Answer by Max_Bol · Sep 20, 2018 at 09:35 PM
One often overlooked possibility is to use a Particle (Shuriken) system to generate the grass. People might start think that it's not an optimized way because of X or Y reason, but the true is that the way the particles system works in Unity is relatively the same (if not better) than the Terrain's grass system. Particles can be GPU instantiated, meaning you save quite a bit there. Check this out : Link to the docs
/
It's possible to set the particles system so that it only generate 1 permanent batch of particle that last as long as the scene last per mesh. Just type "Infinity" in the particle Start Lifetime and the particle will last as long as the scene is active.
/
It's not a "click and it's ready" method, but it works as well as the actual Terrain's Grass system. First, ideally, you got to be able to refer the mesh data to the Particle System. If you're making a game that has Voxel-based terrain, you need to create a mesh with the relative triangles on which grass should be instantiated. Also, considering how this system work, if you modify the mesh, the grass position might also change as the position is based on the mesh's triangles (or edges) so if the number of triangles or edges changes, obviously its relevant grass will also move around. If you're using a static permanent modeled terrain, it's a lot more easier. You can either use 1 particle system per "ground" part or, if you got access to the 3d models, you can create bigger or more optimized mesh.
/
The trick is to think that the mesh only need the faces (triangles) that has grass on it. So if your terrain has rocks, sand, water, slopes, etc. that doesn't have grass, you have to remove those triangles. Then, by setting the particle system correctly, you can generate grass (as particles) on the ground object. It does have some adjustment required such as if your mesh are at -90 degrees (Z-up or Y-up) and such, but there's an option to fix it.
Here's an image that display what I'm writing about :
Answer by Eric5h5 · Nov 12, 2012 at 05:13 PM
The Unity terrain vegetation painting can be done on Unity terrain objects only. You'd have to write your own system to do otherwise.
Ok, so you can't paint grass on a custom mesh. That's a bummer. But do you mean that it's impossible to have grass on an overhang ledge in Unity? Or trees/bushes on a big rocky arch?
You can place them manually, or create your own vegetation painting system.
Oh, I see. But if I place them manually on my custom mesh, will they still behave like vegetation with built-in animation?
Or will the fact that I didn't paint them on an "official" terrain mean that they will just be static models, like they're made out of concrete?
Answer by Yourking77 · Feb 20, 2017 at 09:40 AM
bumping this because I tried looking everywhere and could not find a good result online that I was satisfied with. So my solution was to use trees.
I was able to make the main trunk really small (like 0 so its invisible) then attach leaves with my grasses texture applied to them and make it so the wind can bend the leaves but I made it so that it did not move them from the tree trunks position.
The end result for me was some decent looking grass that was easy to place where I needed to and it swayed with unities wind. Of course my grass is not too graphical so I am not sure if this would work for everyone but I am just posting this a sort of reference or idea for people like me who could not find a satisfactory result online.
Your answer
Follow this Question
Related Questions
How to make lag free terrains 1 Answer
Dense foliage on Android seen from above, performance, can it be done? 1 Answer
Hovering trees and grass 0 Answers
Optimizing vegetation. 3 Answers
Multiple terrains and how LoD works 0 Answers