I am working on Silverlight app. I am trying to render floor covered with tiles. Although I am using mip maps I am still getting awful Moire patterns, when trying to render big area.
What I am doing is creating cuboid and then cover it with single tile:
In my pixel shader I am multiplying texture coordinates in order to create tiled floor (otherwise I would get one tile stretched over my cuboid). Pixel shader code:
float Width : register(c3); //Width of cuboid
float Height : register(c4); //Height of cuboid
texture texTexture;
sampler textureSampler : register(s0) = sampler_state {
Texture = (texTexture);
};
struct VsOutput
{
float4 position : POSITION;
float3 dirLightPosition : COLOR;
float2 texCoord : TEXCOORD0;
float3 normal : TEXCOORD1;
float3 view : TEXCOORD2;
};
float4 main(VsOutput IN) : COLOR
{
float2 texCoord = float2(IN.texCoord.x * Width / 4.0f,
IN.texCoord.y * Height / 4.0f); //multiplying texture coordinates
float4 texColor = tex2D(textureSampler, texCoord);
return float4(color.r, color.g, color.b, 1.0f);
}
My output is:
What else can I do to prevent from creating Moires patterns on texture?