Closed filiphanes closed 1 year ago
it works now, only conditions in shader needs to be correctly adjusted
Assuming this is meant to work the way I think, you can just copy the gradient pixel shader to normalize the texture coordinate to the range [0, 1]. i.e. something like this:
float4 PSRange(VertGrad vert_in) : TARGET
{
float4 color = float4(1.0, 0.0, 0.0, 1.0); // Default to red
float ratio = saturate((distance(vert_in.tex.y, grad_center) - grad_offset) / grad_height);
if (ratio < 0.75)
color = float4(0.0, 1.0, 0.0, 1.0); // Green
else if (ratio < 0.9)
color = float4(1.0, 1.0, 0.0, 1.0); // Yellow
return color;
}
Shader vars are set here.
The gradient case pretty much does everything you need, except you probably want to set grad_height
like this:
gs_effect_set_float(grad_height, cpos - channel_offset);
How do you debug shader faster than recompiling and reinstalling whole package and restarting obs?
ok, now I am happy with it, if you have any more ideas or expectations, I can update it
Looks good, thanks!
Hi, I am trying to create audio meter similar to sound mixer in obs and other software: green, yellow, red. In obs log there is shader compilation problem, but I dont see problem. Could you help me?
Maybe I am not properly reinstalling new compilation? Thanks