I have the following CG pixel shader:
float4 main(
float2 texCoord : TEXCOORD0,
float4 position : TEXCOORD2,
float4 color : COLOR,
uniform sampler2D texture_sample : TEX1,
uniform sampler2D stipple_sample : TEX2,
uniform float camera_target_distance) : COLOR
{
float4 OUT;
float2 vpos= position.xy / position.w;
if (tex2D(stipple_sample, vpos).x > 0.5f)
{
discard;
}
OUT= tex2D(texture_sample, texCoord) * color;
return OUT;
}
However, if I comment out/remove the discard, or the first tex2D access using stipple_sample (and the discard), my texture lookup against texture_sample always yields black instead of red/yellow.