Is it possible to blend and / or manipulate Texture Objects

I have a material function that’s neccessary for most of the materials I’m working on, and I’ve stumbled into a problem. It was initially really simple, but after a while I ended up with having to sometimes use a texture object, and sometimes a sampled texture. To make matters worse, I recently had to add different ways to sample a normal map. As you can see from the screenshot below, all of this ended up with lots of boolean inputs and an absolute spaghetti inside the function. Not pictured is having to use this function multiple times for different texture objects.

265496-example.png

If I was able to blend several texture objects without a texture sampler, I’d be able to reduce this function to 4 inputs. Is that possible?

You could try to pack some information on existing non-Boolean varbales or utilize there predictable behavior and use it as toggles.

The vector parameter supports negative numbers (as any float type), but sampled texture never gonna have negative values… or else you got something weird. You can use that fact to detect if pin is connected and sampled color data is delived. Make a Texture Sample parameter default -1 on red (you can set it by extending color property in property editor (not in color editor). Now detect if red is -1, if it is sample data from texture parameter, if not that means we getting sampled color so we gonna use that. Wit this we got automatic toggle and we can remove toggle for texture sampling.

With static and dynamic, you could use alpha on normal map for that, or just use scalar parameter for that to reduce it to single toggle.

Note that nothing bad happen if you gonna have different version with different pin combinations of same node either ;] You can easily do this by just duplicating and modifying assets

Not exactly what I was looking for, but I ended up layering different textures into separate rgba-layers of an image, sampling the texture once, and then blending between layers. This only works if you need grayscale textures, or two textures with two channels, or one rgb texture and a grayscale one.