I am new to HLSL and shaders. I can't seem to replace the color I retrieve. It's for use in 2D text, i.e. subtitles. The problem is if I set osd_color outside main() it doesn't display anything. I am using Shazzam Shader Editor 1.4 to quickly see the effect, however same thing happens in the program..
sampler2D texture0 : register(s0);
float4 osd_color = float4(0,0,0,1);
struct PixelShaderInput
{
float2 uv0: TEXCOORD0;
float4 color: COLOR;
};
float4 main(PixelShaderInput input): COLOR {
float4 color = tex2D(texture0, input.uv0) * osd_color;
return color;
}
Hope you can help.
Edit:
While I'm at it, if I'd want to add a shadow/outline and returns its color as well, how would I do that? Let's say every variable works. And osd_color is white and a float4 outline is black. I've tried:
float4 outline = tex2D(texture0, (input.uv0 * 1.1) ) * outline_color;
return color + outline;
With this all I get is a white color (osd_color)..