Thanks for that. As it happens, Evolved kindly sent me the same demo last night and, after a LOT of checking and experimentation (
) I discovered my error. It was the sort of error that doesn't get flagged by the compiler and took me some time to spot.
The error was a simple type casting error. I had written the following line of shader code:
float4 tempUV = (float4) (In.UV, 0, 0);
The float4 version of the UV coordinates is needed by the tex2Dlod intrinsic function which in turn is the only texture lookup function allowed in an SM3 vertex shader. (No texture lookups are allowed at all in the earlier shader models SM1 and SM2.) However, the extra brackets that I had carelessly put in meant that the final value of tempUV was not what I wanted at all
I should have written the following:
float4 tempUV = float4 (In.UV, 0, 0);
With that simple change my demo worked perfectly and I am now adding all the extra stuff I need.
Shader connoisseurs might like to consider what values my original version gave to the four components of tempUV.
They should have been, In.x, In.y, 0.0 and 0.0. The first two are just the UV coordinates of the current vertex and vary from 0.0 to 1.0 from one edge of the object to the other but in fact my original code meant that a constant value was set. Can you see what that value was - and why?
Edit: the casting rules described on this page explain what happened in my original version - see especially the sections about Cast Operator and Comma Operator.