Hey there! I have a bit of an open-ended question that I was hoping I could get some answers on.
I’m currently in the process of stepping up my terrain game. For reference, at the moment it’s just a big set of chunks in the usual manner with instanced grass blades attached, see attached pic.
The dark spots here are related to what I’m working on now / to my question:
I’ve added a grid system that, to make a long story short, just tracks things like burning/ice/charred/cut flowers/etc.
That part is all well and good. What’s caught me up is that these grid cells render to a custom render texture, which I then pass to the chunk’s material and to the grass material to show the effects. Well, say I’d like to have more than 4 effects- burning, ice, charred, wet, and cut flowers, just for this hypothetical.
If I pack these into one texture (R0-1 → burning, R1-2 → charred, etc.), I can fit practically as many as I want, but then I have to branch a lot in the resulting shader. I’d have to check if R > 1 and < 2, or R > 2 and < 3, and so on, for every channel.
The alternative to this (as far as I can tell) is to pack a second or third texture alongside the first and check that, but even then it seems like it’d be performance heavy.
Would you guys mind lending me some advice here? On one hand, maybe it’s alright to just lerp between colors/textures as I do with the terrain splatmaps. It’s possible that that number of branches won’t matter? But I’m not sure. I don’t know enough about low-level shader workings to know if this is going to bite me in the ass later or be completely irrelevant performance-wise.
I realize I should evaluate performance once issues crop up, also, but in this case I’m mostly trying to learn while I set up this system since I’m critically unaware otherwise. Here’s a final pic of the terrain shader graph (the current setup for the red channel is purely a hack to get this to work for now, please don’t judge me):

