I am new to HLSL and shaders. I can not replace the color that I get. It is intended for use in 2D text, that is, in subtitles. The problem is that if I set osd_color outside of main (), it does not display anything. I use Shazzam Shader Editor 1.4 to quickly see the effect, however 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 in, if I want to add a shadow / path and return its color, how would I do it? Let them say that every variable works. And osd_color is white, and float4 is black. I tried:
float4 outline = tex2D(texture0, (input.uv0 * 1.1) ) * outline_color; return color + outline;
With this, all I get is white (osd_color) ..
source share