I'm working on a custom Terrain shader, and am hitting the 14 sampler wall. We're stuffing the textures to the gills. Each texture set is 5 textures packed into 2 RGBA maps (Color, Gloss, Derivative, AO, and Displacement all packed into 8 channels.)
Unity has macros that allow you to reuse samplers, for example: "UNITY_DECLARE_TEX2D_NOSAMPLER()" So if i hand edit the shader code, I can get past the limit, but at that point, I can no longer use ASE to modify the shader graph.
Is there any workaround? Texture Arrays are a dealbreaker due to the GPU stalls we've encountered on some of the target hardware.
Apologies for not being clear enough, the Texture Object can only connect to Texture Samples in Object Mode, since when they are set to Reference they are already using the Sampler property from another Texture Sample node.
Both images I shared above are for two distinct scenarios, in the first one a single Texture Sample is used, and referenced by another, while in the second one a Texture Object is connected to two Texture Samples in Object Mode.
To prevent the needless duplication of textures, you can either use a Texture Object and connect it to several Texture Sample nodes in Object Mode, or use one or more Texture Samples in Reference Mode, pointing to an already existing Texture Sample.
My use case is that i have a landscape shader I've written by hand that blends between 9 layers (x2 textures per layer), a world-space normal-map, and a macro color map. That's 21 textures total, which would be impossible to do in a single pass if each texture used a unique sampler. (I don't want to use an add-pass shader since it effectively renders the terrain twice.) I technically only need to use 2 samplers, since the macro textures all share UVs as do the detail maps, but to make the shader a little faster on the GPU, i'm using one sampler for each detail layer and one for the macros. (10 total).
This works great, but since it isn't in ASE, I can't hand it off to an artist to maintain, which is the desired goal.