Download

Applying multiple shaders to a single mesh - Terrain Generation

First, some backstory. I’m generating a terrain at runtime. The terrain is divided into chunks. These chunks can have multiple biomes they represent. I’ve been creating different Material Attributes for each biome, then I layer them together using runtime generated texture masks. However, this requires me to create several additional runtime masks and just gets messy to deal with.

What I want to try is to create some custom vertex data. This data could be as simple as a uint8 and would be assigned to each vertex just like the vertex color information is. It would just be used to id a Material Attribute in the layered material and then some logic in the material would assign the Material Attribute to that vertex. That’s a high level overview at least. Is that possible? If so, how would I go about implementing this?

I know I can assign a vertex color to each vertex and I think use that as a mask, but this only gives me 4 possible mask values (right?). I need at least double that.