Hello sorry for my bad english
im thried to try a compile this shader.
In my older XNA no have problem, now try to convert in monogame i get this error:
X3206 (60,9-73): implicit truncation of vectory type
X3576 (55,29-58): semantics in type overridden by variable/function on enclosing type
X3576 (55,29-58): semantics in type overridden by variable/function on enclosing type
X3206 (60,9-73): implicit truncation of vectory type
float screenWidth;
float screenHeight;
float4 ambientColor;
float lightStrength;
float lightDecay;
float3 lightPosition;
float4 lightColor;
float lightRadius;
float specularStrength;
Texture NormalMap;
sampler NormalMapSampler = sampler_state {
texture = <NormalMap>;
magfilter = LINEAR;
minfilter = LINEAR;
mipfilter = LINEAR;
AddressU = mirror;
AddressV = mirror;
};
Texture ColorMap;
sampler ColorMapSampler = sampler_state {
texture = <ColorMap>;
magfilter = LINEAR;
minfilter = LINEAR;
mipfilter = LINEAR;
AddressU = mirror;
AddressV = mirror;
};
struct VertexToPixel
{
float4 Position : POSITION;
float2 TexCoord : TEXCOORD0;
float4 Color : COLOR0;
};
struct PixelToFrame
{
float4 Color : COLOR0;
};
VertexToPixel MyVertexShader(float4 inPos: POSITION0, float2 texCoord: TEXCOORD0, float4 color: COLOR0)
{
VertexToPixel Output = (VertexToPixel)0;
Output.Position = inPos;
Output.TexCoord = texCoord;
Output.Color = color;
return Output;
}
PixelToFrame PointLightShader(VertexToPixel PSIn) : COLOR0
{
PixelToFrame Output = (PixelToFrame)0;
float4 colorMap = tex2D(ColorMapSampler, PSIn.TexCoord);
float3 normal = (2.0f * (tex2D(NormalMapSampler, PSIn.TexCoord))) - 1.0f;
float3 pixelPosition;
pixelPosition.x = screenWidth * PSIn.TexCoord.x;
pixelPosition.y = screenHeight * PSIn.TexCoord.y;
pixelPosition.z = 0;
float3 lightDirection = lightPosition - pixelPosition;
float3 lightDirNorm = normalize(lightDirection);
float3 halfVec = float3(0, 0, 1);
float amount = max(dot(normal, lightDirNorm), 0);
float coneAttenuation = saturate(1.0f - length(lightDirection) / lightDecay);
float3 reflect = normalize(2 * amount * normal - lightDirNorm);
float specular = min(pow(saturate(dot(reflect, halfVec)), 10), amount);
Output.Color = colorMap * coneAttenuation * lightColor * lightStrength + (specular * coneAttenuation * specularStrength);
return Output;
}
technique DeferredPointLight
{
pass Pass1
{
VertexShader = compile vs_4_0_level_9_1 MyVertexShader();
PixelShader = compile ps_4_0_level_9_1 PointLightShader();
}
}
Anyone can help me plase.