How do I generate Submeshes based on a texture?
I'm currently playing around with procedurally generated terrain, and now I've come to the part where I want to add grass to some of the biomes. For reference, I'm using the grass shader from MinionsArts video here: https://www.youtube.com/watch?v=xKJHL8nQiuM
Basically, the shader renders grass, based on a mesh. So what I currently do is to use the same mesh as I generated for my terrain, to show the grass, and that works somewhat. If we take a look at the picture below, it shows a few problems. Notice the height difference, that is where there's a border to a new mesh. (This is not my main concern right now though) The interesting part is the grass. The one I pointed out seems to have some color bias from the terrain it is on. I've seen this in multiple biomes, but I'm not sure if this is relevant. My goal is to basically render grass, in certain biomes, based on the color of that biome, and this is where my knowledge gets a bit messy.
My idea is to make a copy of the corresponding terrain mesh and then manipulate the copy, by removing parts of the mesh where I don't want grass. Then I want to create sub-meshes based on the Biome Map (A runtime generated texture that also is used to paint the terrain), which would likely leave me with a few sub-meshes per 'chunk'. From there I plan on assigning a material to each sub-mesh so that I can correctly color the grass. The shader has color properties that I can either predefine or simply pickup based on the color of the biome.
So what I'm looking for is some input on how to do the whole sub-meshing part. I've still come up short with a solution that I understand. Alternatively, if there's a smarter way of doing this, I am of course all ears :-) I should add my shader skills are very very basic, but I have a hunch there may be a solution in that direction, but haven't been able to find it/ask the right questions to google yet ;-)
Thanks for your time, I hope I was clear enough, I do tend to struggle a bit about the level of info I need to put into questions like this :-)
Your answer
Follow this Question
Related Questions
Apply Material (with custom texture) on procedural mesh 0 Answers
Different textures on different meshes but same material 0 Answers
Procedural Mesh issues after trying to clean up code. 0 Answers
Procedural generating - generating trees at given mesh - vertices/height 0 Answers
How can I reference a specific set of triangles or quads in a procedurally generated mesh? 0 Answers