Hi, I need to pass lets say 32 textures to a shader and choose the 4 best colors for each pixel according to a certain cost function.
I tried to use 32 sampler2Ds in my shader and Unity complains about “maximum ps_4_0 sampler register index” saying that the max number of textures is 16.
I was thinking about splitting the shader in two “passes”. In the first one, I run a shader feeding it with the first 16 images and then I run the second one passing the other 16 left. The problem with that is that I will have to make space for 4 additional textures that will correspond to the 4 best colors from the first pass, having to run and additional 3rd pass for the 4 textures left.
When I refer to “passes” I mean to activate a shader through its material, set its parameters and submit a draw call (not necessarily having only one shader with multiples passes defined). I was wondering if that can be done by using Unity’s shader passes (having everything in a single shader file). What is the difference between having multiple shaders (each of them defining a shader pass) and having only one with multiple passes. How can I pass the 4 best colors (calculated for each pixel) to the next pass? Is there a way to directly communicate those values without having to waste 4 render textures?
btw, using Texture2DArray is not an option