texture quality
could anyone point me to a good tutorial on HLSL texturing. i have a *slight* problem:
sd
could anyone point me to a good tutorial on HLSL texturing. i have a *slight* problem:
sd
In your shader you will want to setup a sampler state.
Example:
uniform extern float4x4 WorldViewProj : WORLDVIEWPROJECTION;
uniform extern texture UserTexture;
struct VS_OUTPUT
{
float4 position : POSITION;
float4 textureCoordinate : TEXCOORD0;
};
sampler textureSampler = sampler_state
{
Texture = <UserTexture>;
mipfilter = LINEAR;
magfilter = LINEAR;
minfilter = LINEAR;
};
VS_OUTPUT Transform(
float4 Position : POSITION,
float4 TextureCoordinate : TEXCOORD0 )
{
VS_OUTPUT Out = (VS_OUTPUT)0;
Out.position = mul(Position, WorldViewProj);
Out.textureCoordinate = TextureCoordinate;
return Out;
}
float4 ApplyTexture(float2 textureCoordinate : TEXCOORD0) : COLOR
{
return tex2D(textureSampler, textureCoordinate).rgba;
}
technique TransformAndTexture
{
pass P0
{
AlphaBlendEnable = TRUE;
SrcBlend = SRCALPHA;
DestBlend = INVSRCALPHA;
vertexShader = compile vs_2_0 Transform();
pixelShader = compile ps_2_0 ApplyTexture();
}
}