I took a step back and picked up my backup of the shader when I was only using the command texCube to sample the cube map. It compiles perfectly as 2_a and 3_0. It doesn't compile as 2_0 because it exceeds the instruction limit (both DBP and FXComposer say so). FXComposer reports the shader as having
// approximately 59 instruction slots used (15 texture, 44 arithmetic)
float4x4 wvp : WorldViewProjection;
float4x4 WorldI : WorldInverse;
float4 Cam : CameraPosition;
float4 lightDir = {1.0f, -0.25f, 0.0f, 1.0f};
float4 ambiColor = {0.2f, 0.2f, 0.2f, 1.0f};
float specLevel = 0.5;
float specExpon=10.0;
Texture Mask1 <string ResourceName = "" ;>;
sampler2D Mask1Sampler = sampler_state
{
texture = <Mask1>;
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
AddressU = Wrap;
AddressV = Wrap;
};
texture Mask2 <string ResourceName = "" ;>;
sampler2D Mask2Sampler = sampler_state
{
texture = <Mask2>;
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
AddressU = Wrap;
AddressV = Wrap;
};
texture cubeTexture
< string Type = "cube"; string ResourceName = ""; >;
sampler cubeSample = sampler_state
{ texture = <cubeTexture>;
magFilter = linear;
minFilter = linear;
mipFilter = linear;
addressU = wrap;
addressV = wrap;
addressW = wrap;
};
texture cubeBump
< string Type = "cube"; string ResourceName = ""; >;
sampler bumpSample = sampler_state
{ texture = <cubeBump>;
magFilter = linear;
minFilter = linear;
mipFilter = linear;
addressU = wrap;
addressV = wrap;
addressW = wrap;
};
texture LightMap <string ResourceName = "" ;>;
sampler2D LMSampler = sampler_state
{
texture = <LightMap>;
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
AddressU = Wrap;
AddressV = Wrap;
};
struct VSInput
{
float4 pos : position;
float2 UV0 : texcoord0;
float2 UV1 : texcoord1;
float4 Diffuse : color;
float3 Tangent : tangent;
float3 Binormal : binormal;
float3 Normal : normal;
};
struct VSOutput
{
float4 pos : position;
float2 UV0 : texcoord0;
float2 UV1 : texcoord1;
float4 Diffuse : color;
float3 Light : texcoord2;
float3 View : texcoord3;
};
VSOutput VShader(VSInput In, VSOutput Out)
{ Out.pos = mul(In.pos, wvp);
Out.UV0 = In.UV0;
Out.UV1 = In.UV1;
Out.Diffuse=In.Diffuse;
float3x3 TSM = {In.Tangent,In.Binormal,In.Normal};
TSM = transpose (TSM);
float3 temp=-mul(lightDir.xyz,WorldI);
Out.Light=mul(temp,TSM);
temp=mul(Cam,WorldI)-In.pos;
Out.View=mul(temp,TSM);
return Out;
}
struct PSInput
{
float4 pos : position;
float2 UV0 : texcoord0;
float2 UV1 : texcoord1;
float4 Diffuse : color;
float3 Light : texcoord2;
float3 View : texcoord3;
};
struct PSOutput
{
float4 colour: color;
};
PSOutput PShader(PSInput In, PSOutput Out)
{
float3 Mask1 = tex2D( Mask1Sampler ,In.UV0 );
float3 Mask2 = tex2D( Mask2Sampler ,In.UV0 );
float4 LM = tex2D( LMSampler ,In.UV0 );
float2 Temp_UV= frac(In.UV1);
float3 UVW1 ={(Temp_UV.x*2)-1,1,(Temp_UV.y*2)-1};
float3 UVW2 ={(Temp_UV.x*2)-1,-1,(Temp_UV.y*2)-1};
float3 UVW3 ={(Temp_UV.x*2)-1,(Temp_UV.y*2)-1,1};
float3 UVW4 ={(Temp_UV.x*2)-1,(Temp_UV.y*2)-1,-1};
float3 UVW5 ={1,(Temp_UV.x*2)-1,(Temp_UV.y*2)-1};
float3 UVW6 ={-1,(Temp_UV.x*2)-1,(Temp_UV.y*2)-1};
float4 Temp_map1=texCUBE(cubeSample, UVW1);
float4 Temp_map2=texCUBE(cubeSample, UVW2);
float4 Temp_map3=texCUBE(cubeSample, UVW3);
float4 Temp_map4=texCUBE(cubeSample, UVW4);
float4 Temp_map5=texCUBE(cubeSample, UVW5);
float4 Temp_map6=texCUBE(cubeSample, UVW6);
float4 Temp_bump1=2*texCUBE(bumpSample, UVW1)-1;
float4 Temp_bump2=2*texCUBE(bumpSample, UVW2)-1;
float4 Temp_bump3=2*texCUBE(bumpSample, UVW3)-1;
float4 Temp_bump4=2*texCUBE(bumpSample, UVW4)-1;
float4 Temp_bump5=2*texCUBE(bumpSample, UVW5)-1;
float4 Temp_bump6=2*texCUBE(bumpSample, UVW6)-1;
Temp_map1 = lerp( Temp_map1, Temp_map2, Mask1.r );
Temp_map1 = lerp( Temp_map1, Temp_map3, Mask1.g );
Temp_map1 = lerp( Temp_map1, Temp_map4, Mask1.b );
Temp_map1 = lerp( Temp_map1, Temp_map5, Mask2.r );
Temp_map1 = lerp( Temp_map1, Temp_map6, Mask2.g );
Temp_bump1 = lerp( Temp_bump1, Temp_bump2, Mask1.r );
Temp_bump1 = lerp( Temp_bump1, Temp_bump3, Mask1.g );
Temp_bump1 = lerp( Temp_bump1, Temp_bump4, Mask1.b );
Temp_bump1 = lerp( Temp_bump1, Temp_bump5, Mask2.r );
Temp_bump1 = lerp( Temp_bump1, Temp_bump6, Mask2.g );
float3 normal=Temp_bump1;
float4 baseColour=Temp_map1;
float3 tempLightDir = normalize(In.Light);
float3 tempViewDir = normalize(In.View);
float diffuse = saturate(dot(normal, tempLightDir));
float3 reflect = 2 * diffuse * normal - tempLightDir;
float specular = diffuse * specLevel * pow(saturate(dot(reflect, tempViewDir)),specExpon);
Out.colour = (baseColour * (ambiColor + diffuse*LM) + specular*LM);
return Out;
}
technique simpleCube
{ pass one
{ VertexShader = compile vs_2_0 VShader();
PixelShader = compile ps_2_a PShader();
}
}
Next step, I only alter the first texCUBE(cubeSample, UVW1); instruction with a texCUBEgrad(cubeSample,UVW1,ddx(UVW1),ddy(UVW1));
The shader still compiles as 2_a and 3_0; FXC reports it as having
// approximately 68 instruction slots used (15 texture, 53 arithmetic)
float4x4 wvp : WorldViewProjection;
float4x4 WorldI : WorldInverse;
float4 Cam : CameraPosition;
float4 lightDir = {1.0f, -0.25f, 0.0f, 1.0f};
float4 ambiColor = {0.2f, 0.2f, 0.2f, 1.0f};
float specLevel = 0.5;
float specExpon=10.0;
Texture Mask1 <string ResourceName = "" ;>;
sampler2D Mask1Sampler = sampler_state
{
texture = <Mask1>;
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
AddressU = Wrap;
AddressV = Wrap;
};
texture Mask2 <string ResourceName = "" ;>;
sampler2D Mask2Sampler = sampler_state
{
texture = <Mask2>;
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
AddressU = Wrap;
AddressV = Wrap;
};
texture cubeTexture
< string Type = "cube"; string ResourceName = ""; >;
sampler cubeSample = sampler_state
{ texture = <cubeTexture>;
magFilter = linear;
minFilter = linear;
mipFilter = linear;
addressU = wrap;
addressV = wrap;
addressW = wrap;
};
texture cubeBump
< string Type = "cube"; string ResourceName = ""; >;
sampler bumpSample = sampler_state
{ texture = <cubeBump>;
magFilter = linear;
minFilter = linear;
mipFilter = linear;
addressU = wrap;
addressV = wrap;
addressW = wrap;
};
texture LightMap <string ResourceName = "" ;>;
sampler2D LMSampler = sampler_state
{
texture = <LightMap>;
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
AddressU = Wrap;
AddressV = Wrap;
};
struct VSInput
{
float4 pos : position;
float2 UV0 : texcoord0;
float2 UV1 : texcoord1;
float4 Diffuse : color;
float3 Tangent : tangent;
float3 Binormal : binormal;
float3 Normal : normal;
};
struct VSOutput
{
float4 pos : position;
float2 UV0 : texcoord0;
float2 UV1 : texcoord1;
float4 Diffuse : color;
float3 Light : texcoord2;
float3 View : texcoord3;
};
VSOutput VShader(VSInput In, VSOutput Out)
{ Out.pos = mul(In.pos, wvp);
Out.UV0 = In.UV0;
Out.UV1 = In.UV1;
Out.Diffuse=In.Diffuse;
float3x3 TSM = {In.Tangent,In.Binormal,In.Normal};
TSM = transpose (TSM);
float3 temp=-mul(lightDir.xyz,WorldI);
Out.Light=mul(temp,TSM);
temp=mul(Cam,WorldI)-In.pos;
Out.View=mul(temp,TSM);
return Out;
}
struct PSInput
{
float4 pos : position;
float2 UV0 : texcoord0;
float2 UV1 : texcoord1;
float4 Diffuse : color;
float3 Light : texcoord2;
float3 View : texcoord3;
};
struct PSOutput
{
float4 colour: color;
};
PSOutput PShader(PSInput In, PSOutput Out)
{
float3 Mask1 = tex2D( Mask1Sampler ,In.UV0 );
float3 Mask2 = tex2D( Mask2Sampler ,In.UV0 );
float4 LM = tex2D( LMSampler ,In.UV0 );
float2 Temp_UV= frac(In.UV1);
float3 UVW1 ={(Temp_UV.x*2)-1,1,(Temp_UV.y*2)-1};
float3 UVW2 ={(Temp_UV.x*2)-1,-1,(Temp_UV.y*2)-1};
float3 UVW3 ={(Temp_UV.x*2)-1,(Temp_UV.y*2)-1,1};
float3 UVW4 ={(Temp_UV.x*2)-1,(Temp_UV.y*2)-1,-1};
float3 UVW5 ={1,(Temp_UV.x*2)-1,(Temp_UV.y*2)-1};
float3 UVW6 ={-1,(Temp_UV.x*2)-1,(Temp_UV.y*2)-1};
float4 Temp_map1=texCUBEgrad(cubeSample, UVW1,ddx(UVW1),ddy(UVW1));
float4 Temp_map2=texCUBE(cubeSample, UVW2);
float4 Temp_map3=texCUBE(cubeSample, UVW3);
float4 Temp_map4=texCUBE(cubeSample, UVW4);
float4 Temp_map5=texCUBE(cubeSample, UVW5);
float4 Temp_map6=texCUBE(cubeSample, UVW6);
float4 Temp_bump1=2*texCUBE(bumpSample, UVW1)-1;
float4 Temp_bump2=2*texCUBE(bumpSample, UVW2)-1;
float4 Temp_bump3=2*texCUBE(bumpSample, UVW3)-1;
float4 Temp_bump4=2*texCUBE(bumpSample, UVW4)-1;
float4 Temp_bump5=2*texCUBE(bumpSample, UVW5)-1;
float4 Temp_bump6=2*texCUBE(bumpSample, UVW6)-1;
Temp_map1 = lerp( Temp_map1, Temp_map2, Mask1.r );
Temp_map1 = lerp( Temp_map1, Temp_map3, Mask1.g );
Temp_map1 = lerp( Temp_map1, Temp_map4, Mask1.b );
Temp_map1 = lerp( Temp_map1, Temp_map5, Mask2.r );
Temp_map1 = lerp( Temp_map1, Temp_map6, Mask2.g );
Temp_bump1 = lerp( Temp_bump1, Temp_bump2, Mask1.r );
Temp_bump1 = lerp( Temp_bump1, Temp_bump3, Mask1.g );
Temp_bump1 = lerp( Temp_bump1, Temp_bump4, Mask1.b );
Temp_bump1 = lerp( Temp_bump1, Temp_bump5, Mask2.r );
Temp_bump1 = lerp( Temp_bump1, Temp_bump6, Mask2.g );
float3 normal=Temp_bump1;
float4 baseColour=Temp_map1;
float3 tempLightDir = normalize(In.Light);
float3 tempViewDir = normalize(In.View);
float diffuse = saturate(dot(normal, tempLightDir));
float3 reflect = 2 * diffuse * normal - tempLightDir;
float specular = diffuse * specLevel * pow(saturate(dot(reflect, tempViewDir)),specExpon);
Out.colour = (baseColour * (ambiColor + diffuse*LM) + specular*LM);
return Out;
}
technique simpleCube
{ pass one
{ VertexShader = compile vs_2_0 VShader();
PixelShader = compile ps_2_a PShader();
}
}
So i then alter the next texCUBE with a texCUBEgrad instruction (plus its ddx/ddy components) and it no longer compiles as 2_a. It it only compiles as 3_0. FXC reports it has having
// approximately 76 instruction slots used (15 texture, 61 arithmetic)
float4x4 wvp : WorldViewProjection;
float4x4 WorldI : WorldInverse;
float4 Cam : CameraPosition;
float4 lightDir = {1.0f, -0.25f, 0.0f, 1.0f};
float4 ambiColor = {0.2f, 0.2f, 0.2f, 1.0f};
float specLevel = 0.5;
float specExpon=10.0;
Texture Mask1 <string ResourceName = "" ;>;
sampler2D Mask1Sampler = sampler_state
{
texture = <Mask1>;
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
AddressU = Wrap;
AddressV = Wrap;
};
texture Mask2 <string ResourceName = "" ;>;
sampler2D Mask2Sampler = sampler_state
{
texture = <Mask2>;
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
AddressU = Wrap;
AddressV = Wrap;
};
texture cubeTexture
< string Type = "cube"; string ResourceName = ""; >;
sampler cubeSample = sampler_state
{ texture = <cubeTexture>;
magFilter = linear;
minFilter = linear;
mipFilter = linear;
addressU = wrap;
addressV = wrap;
addressW = wrap;
};
texture cubeBump
< string Type = "cube"; string ResourceName = ""; >;
sampler bumpSample = sampler_state
{ texture = <cubeBump>;
magFilter = linear;
minFilter = linear;
mipFilter = linear;
addressU = wrap;
addressV = wrap;
addressW = wrap;
};
texture LightMap <string ResourceName = "" ;>;
sampler2D LMSampler = sampler_state
{
texture = <LightMap>;
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
AddressU = Wrap;
AddressV = Wrap;
};
struct VSInput
{
float4 pos : position;
float2 UV0 : texcoord0;
float2 UV1 : texcoord1;
float4 Diffuse : color;
float3 Tangent : tangent;
float3 Binormal : binormal;
float3 Normal : normal;
};
struct VSOutput
{
float4 pos : position;
float2 UV0 : texcoord0;
float2 UV1 : texcoord1;
float4 Diffuse : color;
float3 Light : texcoord2;
float3 View : texcoord3;
};
VSOutput VShader(VSInput In, VSOutput Out)
{ Out.pos = mul(In.pos, wvp);
Out.UV0 = In.UV0;
Out.UV1 = In.UV1;
Out.Diffuse=In.Diffuse;
float3x3 TSM = {In.Tangent,In.Binormal,In.Normal};
TSM = transpose (TSM);
float3 temp=-mul(lightDir.xyz,WorldI);
Out.Light=mul(temp,TSM);
temp=mul(Cam,WorldI)-In.pos;
Out.View=mul(temp,TSM);
return Out;
}
struct PSInput
{
float4 pos : position;
float2 UV0 : texcoord0;
float2 UV1 : texcoord1;
float4 Diffuse : color;
float3 Light : texcoord2;
float3 View : texcoord3;
};
struct PSOutput
{
float4 colour: color;
};
PSOutput PShader(PSInput In, PSOutput Out)
{
float3 Mask1 = tex2D( Mask1Sampler ,In.UV0 );
float3 Mask2 = tex2D( Mask2Sampler ,In.UV0 );
float4 LM = tex2D( LMSampler ,In.UV0 );
float2 Temp_UV= frac(In.UV1);
float3 UVW1 ={(Temp_UV.x*2)-1,1,(Temp_UV.y*2)-1};
float3 UVW2 ={(Temp_UV.x*2)-1,-1,(Temp_UV.y*2)-1};
float3 UVW3 ={(Temp_UV.x*2)-1,(Temp_UV.y*2)-1,1};
float3 UVW4 ={(Temp_UV.x*2)-1,(Temp_UV.y*2)-1,-1};
float3 UVW5 ={1,(Temp_UV.x*2)-1,(Temp_UV.y*2)-1};
float3 UVW6 ={-1,(Temp_UV.x*2)-1,(Temp_UV.y*2)-1};
float4 Temp_map1=texCUBEgrad(cubeSample, UVW1,ddx(UVW1),ddy(UVW1));
float4 Temp_map2=texCUBEgrad(cubeSample, UVW2,ddx(UVW2),ddy(UVW2));
float4 Temp_map3=texCUBE(cubeSample, UVW3);
float4 Temp_map4=texCUBE(cubeSample, UVW4);
float4 Temp_map5=texCUBE(cubeSample, UVW5);
float4 Temp_map6=texCUBE(cubeSample, UVW6);
float4 Temp_bump1=2*texCUBE(bumpSample, UVW1)-1;
float4 Temp_bump2=2*texCUBE(bumpSample, UVW2)-1;
float4 Temp_bump3=2*texCUBE(bumpSample, UVW3)-1;
float4 Temp_bump4=2*texCUBE(bumpSample, UVW4)-1;
float4 Temp_bump5=2*texCUBE(bumpSample, UVW5)-1;
float4 Temp_bump6=2*texCUBE(bumpSample, UVW6)-1;
Temp_map1 = lerp( Temp_map1, Temp_map2, Mask1.r );
Temp_map1 = lerp( Temp_map1, Temp_map3, Mask1.g );
Temp_map1 = lerp( Temp_map1, Temp_map4, Mask1.b );
Temp_map1 = lerp( Temp_map1, Temp_map5, Mask2.r );
Temp_map1 = lerp( Temp_map1, Temp_map6, Mask2.g );
Temp_bump1 = lerp( Temp_bump1, Temp_bump2, Mask1.r );
Temp_bump1 = lerp( Temp_bump1, Temp_bump3, Mask1.g );
Temp_bump1 = lerp( Temp_bump1, Temp_bump4, Mask1.b );
Temp_bump1 = lerp( Temp_bump1, Temp_bump5, Mask2.r );
Temp_bump1 = lerp( Temp_bump1, Temp_bump6, Mask2.g );
float3 normal=Temp_bump1;
float4 baseColour=Temp_map1;
float3 tempLightDir = normalize(In.Light);
float3 tempViewDir = normalize(In.View);
float diffuse = saturate(dot(normal, tempLightDir));
float3 reflect = 2 * diffuse * normal - tempLightDir;
float specular = diffuse * specLevel * pow(saturate(dot(reflect, tempViewDir)),specExpon);
Out.colour = (baseColour * (ambiColor + diffuse*LM) + specular*LM);
return Out;
}
technique simpleCube
{ pass one
{ VertexShader = compile vs_2_0 VShader();
PixelShader = compile ps_2_a PShader();
}
}
So, regardless of what DBP, FXC and DarkShader report its most definatelly a instruction count problem and I have decided to "upgrade" the shader to 3_0 as it will not work as any previous shader model.
Agreed?
So here is the "final" version of the shader
float4x4 wvp : WorldViewProjection;
float4x4 WorldI : WorldInverse;
float4 Cam : CameraPosition;
float4 lightDir = {1.0f, -0.25f, 0.0f, 1.0f};
float4 ambiColor = {0.2f, 0.2f, 0.2f, 1.0f};
float4 lightColor = {1.0f, 1.0f, 1.0f, 1.0f};
float specLevel = 0.5;
float specExpon=10.0;
float temp_scale=1.0;
Texture Mask1 <string ResourceName = "" ;>;
sampler2D Mask1Sampler = sampler_state
{
texture = <Mask1>;
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
AddressU = Wrap;
AddressV = Wrap;
};
texture Mask2 <string ResourceName = "" ;>;
sampler2D Mask2Sampler = sampler_state
{
texture = <Mask2>;
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
AddressU = Wrap;
AddressV = Wrap;
};
texture cubeTexture
< string Type = "cube"; string ResourceName = ""; >;
sampler cubeSample = sampler_state
{ texture = <cubeTexture>;
magFilter = linear;
minFilter = linear;
mipFilter = linear;
addressU = wrap;
addressV = wrap;
addressW = wrap;
};
texture cubeBump
< string Type = "cube"; string ResourceName = ""; >;
sampler bumpSample = sampler_state
{ texture = <cubeBump>;
magFilter = linear;
minFilter = linear;
mipFilter = linear;
addressU = wrap;
addressV = wrap;
addressW = wrap;
};
texture LightMap <string ResourceName = "" ;>;
sampler2D LMSampler = sampler_state
{
texture = <LightMap>;
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
AddressU = Wrap;
AddressV = Wrap;
};
struct VSInput
{
float4 pos : position;
float2 UV0 : texcoord0;
float2 UV1 : texcoord1;
float4 Diffuse : color;
float3 Tangent : tangent;
float3 Binormal : binormal;
float3 Normal : normal;
};
struct VSOutput
{
float4 pos : position;
float2 UV0 : texcoord0;
float2 UV1 : texcoord1;
float4 Diffuse : color;
float3 Light : texcoord2;
float3 View : texcoord3;
};
VSOutput VShader(VSInput In, VSOutput Out)
{ Out.pos = mul(In.pos, wvp);
Out.UV0 = In.UV0;
Out.UV1 = In.UV1;
Out.Diffuse=In.Diffuse;
float3x3 TSM = {In.Tangent,In.Binormal,In.Normal};
TSM = transpose (TSM);
float3 temp=-mul(lightDir.xyz,WorldI);
Out.Light=mul(temp,TSM);
temp=mul(Cam,WorldI)-In.pos;
Out.View=mul(temp,TSM);
return Out;
}
struct PSInput
{
float4 pos : position;
float2 UV0 : texcoord0;
float2 UV1 : texcoord1;
float4 Diffuse : color;
float3 Light : texcoord2;
float3 View : texcoord3;
};
struct PSOutput
{
float4 colour: color;
};
PSOutput PShader(PSInput In, PSOutput Out)
{
float3 Mask1 = tex2D( Mask1Sampler ,In.UV0 );
float3 Mask2 = tex2D( Mask2Sampler ,In.UV0 );
float4 LM = tex2D( LMSampler ,In.UV0 );
float2 Temp_UV= frac(In.UV1);
float3 UVW1 ={(Temp_UV.x*2)-1,1,(Temp_UV.y*2)-1};
float3 UVW2 ={(Temp_UV.x*2)-1,-1,(Temp_UV.y*2)-1};
float3 UVW3 ={(Temp_UV.x*2)-1,(Temp_UV.y*2)-1,1};
float3 UVW4 ={(Temp_UV.x*2)-1,(Temp_UV.y*2)-1,-1};
float3 UVW5 ={1,(Temp_UV.x*2)-1,(Temp_UV.y*2)-1};
float3 UVW6 ={-1,(Temp_UV.x*2)-1,(Temp_UV.y*2)-1};
float3 dx1 =ddx(UVW1); float3 dy1 =ddy(UVW1);
float3 dx2 =ddx(UVW2); float3 dy2 =ddy(UVW2);
float3 dx3 =ddx(UVW3); float3 dy3 =ddy(UVW3);
float3 dx4 =ddx(UVW4); float3 dy4 =ddy(UVW4);
float3 dx5 =ddx(UVW5); float3 dy5 =ddy(UVW5);
float3 dx6 =ddx(UVW6); float3 dy6 =ddy(UVW6);
float4 baseColour=texCUBEgrad(cubeSample, UVW1,dx1,dy1);
float4 Temp_map2=texCUBEgrad(cubeSample, UVW2,dx2,dy2);
float4 Temp_map3=texCUBEgrad(cubeSample, UVW3,dx3,dy3);
float4 Temp_map4=texCUBEgrad(cubeSample, UVW4,dx4,dy4);
float4 Temp_map5=texCUBEgrad(cubeSample, UVW5,dx5,dy5);
float4 Temp_map6=texCUBEgrad(cubeSample, UVW6,dx6,dy6);
float4 normal=2*texCUBEgrad(bumpSample, UVW1,dx1,dy1)-1;
float4 Temp_bump2=2*texCUBEgrad(bumpSample, UVW2,dx2,dy2)-1;
float4 Temp_bump3=2*texCUBEgrad(bumpSample, UVW3,dx3,dy3)-1;
float4 Temp_bump4=2*texCUBEgrad(bumpSample, UVW4,dx4,dy4)-1;
float4 Temp_bump5=2*texCUBEgrad(bumpSample, UVW5,dx5,dy5)-1;
float4 Temp_bump6=2*texCUBEgrad(bumpSample, UVW6,dx6,dy6)-1;
baseColour = lerp( baseColour, Temp_map2, Mask1.r );
baseColour = lerp( baseColour, Temp_map3, Mask1.g );
baseColour = lerp( baseColour, Temp_map4, Mask1.b );
baseColour = lerp( baseColour, Temp_map5, Mask2.r );
baseColour = lerp( baseColour, Temp_map6, Mask2.g );
normal = lerp( normal, Temp_bump2, Mask1.r );
normal = lerp( normal, Temp_bump3, Mask1.g );
normal = lerp( normal, Temp_bump4, Mask1.b );
normal = lerp( normal, Temp_bump5, Mask2.r );
normal = lerp( normal, Temp_bump6, Mask2.g );
float3 tempLightDir = normalize(In.Light);
float3 tempViewDir = normalize(In.View);
float diffuse = saturate(dot(normal, tempLightDir));
float3 reflect = 2 * diffuse * normal - tempLightDir;
float specular = diffuse * specLevel * pow(saturate(dot(reflect, tempViewDir)),specExpon);
Out.colour = baseColour * (ambiColor + diffuse*LM) + specular*LM;
return Out;
}
technique simpleCube
{ pass one
{ VertexShader = compile vs_2_0 VShader();
PixelShader = compile ps_3_0 PShader();
}
}
GG, when u finally get your new computer that allows you to play around with shader model 3 can u help me get rid of those nasty seams? I haven't been sucessfull at all in removing them
Did u get around to doing the 16 texture+normal + roads you said you'd try to?
Take care
AtomR