Hi,
I need to impose a specific texture on the triangle primitives.
So, I have a texture file: [attachment=13225:256colour3.png]
And I have a list of triangle primitives. I build a surface of these triangles. Each of triangle point contain data:
1) position
2) texture coordinate
Depands of texture coordinate on each point, I want to make color transition on the surface, like this:[attachment=13226:Capture1234.PNG]
But, using this shader
Texture ColorTexture;
sampler ColorTextureSampler =
sampler_state
{
texture = <ColorTexture> ;
magfilter = NONE;
minfilter = NONE;
mipfilter = NONE;
AddressU = wrap;
AddressV = wrap;
};
struct VertexShaderInput
{
float4 Position : POSITION;
float2 texCoord : TEXCOORD0;
};
struct VertexShaderOutput
{
float4 Position : POSITION;
float2 texCoord : TEXCOORD0;
};
float4x4 worldViewProj;
VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
VertexShaderOutput output = (VertexShaderOutput)0;
output.Position = mul(input.Position, worldViewProj);
output.texCoord = input.texCoord;
return output;
}
float4 PixelShaderFunction(VertexShaderOutput input) : COLOR
{
return tex1D( ColorTextureSampler, input.texCoord.x);
}
technique Technique1
{
pass Pass1
{
VertexShader = compile vs_2_0 VertexShaderFunction();
PixelShader = compile ps_2_0 PixelShaderFunction();
}
} I receive this: [attachment=13227:Capture1236.PNG]
So, how should I modificate shader to receive such kind of color transition? Or, maybe, I should modificate texture file?