OBS ShaderFilter Plus

OBS ShaderFilter Plus v0.3.1

Limeth

New Member
Can I use the same shaders as the old obs shader filter?
Unfortunately, they are not compatible, due to the changes I made to the uniform variable naming scheme and the entry function.
Please refer to the README at GitHub for the variable naming scheme.
 

lioran

Member
If I was to use this over the older ShaderFilter plugin, what extra benefit would I get? I don't see any specification in the description that leads me to believe this is any different than that one.
 

Surn

Member
I like what you are doing with the UI elements, Good job!

My version of OBS Shaderfilter has been awaiting 2 updates to be released. One you have addressed by holding previous frame information. My second update pending release has brought me up against technical limitations that are slow to unravel.

At this point, I have several branches internally and one is UI based. It would be nice to collaborate on features.

I am an old school programmer, and agnostic about programming languages. How do you feel about RUST and can you compare it to any other languages?
 

Limeth

New Member
I like what you are doing with the UI elements, Good job!

My version of OBS Shaderfilter has been awaiting 2 updates to be released. One you have addressed by holding previous frame information. My second update pending release has brought me up against technical limitations that are slow to unravel.

At this point, I have several branches internally and one is UI based. It would be nice to collaborate on features.

I am an old school programmer, and agnostic about programming languages. How do you feel about RUST and can you compare it to any other languages?
@Surn
Thank you for the kind words! Sorry for the delayed response, I do not check this forum very often.
Learning Rust has been a great investment of my time, as it allows for low-level programming comparable to C, as well as high-level programming with features like static typing, generics, lifetimes (compile-time enforced RAII), and more. I like to think of Rust like C++ reinvented from scratch in the last decade. Additionally, it interfaces well with C, and therefore is suitable to be used to develop OBS plugins with.

I chose to rewrite the obs-shaderfilter plugin in Rust, because I am more comfortable with the language, as it allows me to use the powerful type system of Rust to enforce some guarantees about the code (such as the various contexts you need to enable and disable depending on what operations you are doing, be it rendering, or something else).

I noticed some activity in your repository and it made me wonder what you were working on. I am open to collaborating on the plugin, but I basically recreated mine from scratch, so the actual implementations have little in common.

If you would like to exchange some ideas, please send me a DM on Discord, I am in the OBS Discord server, or let me know of some other way we could talk.
 

Limeth

New Member
Just a heads-up for anyone using this plugin across multiple platforms — there is a way to use GLSL on both Windows and Linux, and I have added instructions on how to do so to the GitHub page.
 

Limeth

New Member
Could not get it to work at all. Shader not found at the specified path: ""
That is, admittedly, not a very helpful error message, which is going to be fixed in the next release. This error means that you have not chosen the shader source file using the "Browse" button. You can try downloading one of the example shaders as described in the guide.
 

MaJiC79

New Member
I hit on a bug that lead to OBS crashing whilst I tried to develop a small shader for this plugin. My code had an incorrectly closed { } pair and this lead to the whole of OBS crashing. It's easily reproducible with the following code:

C-like:
float4 render(float2 uv) {
{
    return image.Sample(builtin_texture_sampler, uv);
}

While I could fix my code by removing the spurious { is it possible to report the syntax error without a crash?
 

Limeth

New Member
I hit on a bug that lead to OBS crashing whilst I tried to develop a small shader for this plugin. My code had an incorrectly closed { } pair and this lead to the whole of OBS crashing. It's easily reproducible with the following code:

C-like:
float4 render(float2 uv) {
{
    return image.Sample(builtin_texture_sampler, uv);
}

While I could fix my code by removing the spurious { is it possible to report the syntax error without a crash?
Thanks, I will attempt to reproduce this.

Any way to make this run on OBS for MacOS Catalina?
You would have to figure out how to compile it yourself from source which is available on GitHub.
 

shibetpc

New Member
I am admittedly new to shaders. Not sure where I'm going wrong. I've got it installed, but any .hlsl or .glsl file i load comes up with errors about 'name' and 'var'. Does each shader file need to be specifically created, compiled or modified, or is there a library of files somewhere which should work that I can use? Sorry for such a vague question...
 

Gem4ik

New Member
I'm trying to get Twirl/Vortex Shader for some camera memes.

I'm not a programmer, could you somehow adapt this code for this plugin?

This code:
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
float effectRadius = .5;
float effectAngle = 2. * PI;

vec2 center = iMouse.xy / iResolution.xy;
center = center == vec2(0., 0.) ? vec2(.5, .5) : center;

vec2 uv = fragCoord.xy / iResolution.xy - center;

float len = length(uv * vec2(iResolution.x / iResolution.y, 1.));
float angle = atan(uv.y, uv.x) + effectAngle * smoothstep(effectRadius, 0., len);
float radius = length(uv);

fragColor = texture(iChannel0, vec2(radius * cos(angle), radius * sin(angle)) + center);
}

or this code?

[Vertex_Shader]
void main()
{
gl_Position = ftransform();
gl_TexCoord[0] = gl_MultiTexCoord0;
}

[Pixel_Shader]
// Scene buffer
uniform sampler2D tex0;

// Currently not used in this demo!
uniform float time;

// GeeXLab built-in uniform, width of
// the current render target
uniform float rt_w;
// GeeXLab built-in uniform, height of
// the current render target
uniform float rt_h;

// Swirl effect parameters
uniform float radius = 200.0;
uniform float angle = 0.8;
uniform vec2 center = vec2(400.0, 300.0);

vec4 PostFX(sampler2D tex, vec2 uv, float time)
{
vec2 texSize = vec2(rt_w, rt_h);
vec2 tc = uv * texSize;
tc -= center;
float dist = length(tc);
if (dist < radius)
{
float percent = (radius - dist) / radius;
float theta = percent * percent * angle * 8.0;
float s = sin(theta);
float c = cos(theta);
tc = vec2(dot(tc, vec2(c, -s)), dot(tc, vec2(s, c)));
}
tc += center;
vec3 color = texture2D(tex0, tc / texSize).rgb;
return vec4(color, 1.0);
}

void main (void)
{
vec2 uv = gl_TexCoord[0].st;
gl_FragColor = PostFX(tex0, uv, time);
}
 

GeryB

New Member
Hello. I tried the linux version of this plugin and when I try to open a shader I get the following error:

Could not create the effect due to the following error:
Error compiling shader:
0:17(9): error: no function with name 'render'
0:17(2): error: `return' with wrong type error, in function `builtin_shader_fragment' returning vec4
device_pixelshader_create (GL) failed
Pass (0) <> missing pixel shader!

Thanks your help forefor,
G.
 
Top