Why does making a surface shader have alpha enable me to use more texture coords?

I’ve recently been working on a surface shader that needed a main texture, auxiliary texture, bump mapping and cube mapping.

So that’s quite a lot of features, my Input struct looks like this:

float2 uv_MainTex;
float2 uv_AuxTex;
float2 uv_BumpMap;		
float3 worldRefl;
INTERNAL_DATA

Now, if I have all these in an opaque shader, I run out of texture co-ordinates, the shader throws up an error about not having enough co-ordinates to use for shadows.

cannot locate suitable resource to bind parameter “_ShadowCoord”

If I change this:

#pragma surface surf MyLighting

to this:

#pragma surface surf MyLighting alpha

suddenly it does have enough resources for all of the features I need. Why is this? I thought I would have to sacrifice UV co-ordinates for the bump map to get this to work, but it seems I’m on the verge of getting this to work properly if I can just figure out what to disable.

I’ve tested my model under various conditions with both versions to try and find a visual difference, and I’ve tried to decipher the difference between the compiled shaders with and without. The only real differences I can see is that the version without alpha has keywords that seem to describe turning shadows off (even though they do work), and the version with alpha testing has vertex lighting in a few places, but neither of these have really helped me figure out the problem.

I’d really like to get my shader to work without having to make it use alpha blending, that just seems like a compete hack and an un-necessary performance hit. Any help is appreciated.

one method I often use to reduce the size of my input structures is to share coords. For example, most of the diffuse and normal maps i tend to see use the same uv coords, and the textures are often the same size as well. in situations like this you can just use one set of uv coords for both. (so uv_MainTex or uv_BumpTex for both). This only works really if the textures are the same in terms of value of scale offset and tilling.