Performance Q - Texture Sample vs Material Instructions

I’ve been running into a problem frequently: When presented with the option to draw out shapes using shader math, or painting a texture, which one tends to be more performant? I’ve included an example image. Would the end result of these nodes be more performant if they were just a texture map that I painted instead?

Probably the simplest way to check it is by looking at the instruction count, because texture sampler is also adding instructions, but I’m sure that’s not the whole picture, and some technical people can go deeper. I personally prefer to create my masks using math, because most of them are simple gradients that can be made using a channel from UVs, as you did, allowing for easy modification of the mask over time. Additionally, each node has a different cost, so I prefer to simplyfy it as much as possible by using negative numbers in the “add” node instead of “subtract,” multiplying values by themselves instead of using the power of 2, etc.

1 Like

Yes, I also agree that everything depends on the number of instructions, and if we are talking about the option shown in the screenshot, then it is significantly better, since it is not complicated, (although I also avoid sinuses on mobile devices) and does not burden complex calculations, at the same time, it reduces texture in memory, but there are cases, for example, complex noises, there, in my opinion, everything is the opposite, the texture is more preferable, especially if it is on mobile devices.

1 Like