# OBS ShaderFilter Plus



## Limeth (Apr 17, 2020)

Limeth submitted a new resource:

OBS ShaderFilter Plus - Apply custom effects to video sources using this filter via hand-crafted fragment shaders.



> This is successor to obs-shaderfilter, but rewritten from the ground up.
> See the README.md at GitHub for more information.



Read more about this resource...


----------



## hmeneses (Apr 18, 2020)

Can I use the same shaders as the old obs shader filter?


----------



## Limeth (Apr 18, 2020)

hmeneses said:


> 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.


----------



## hmeneses (Apr 18, 2020)

do you have any example?


----------



## lioran (Apr 18, 2020)

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.


----------



## hmeneses (Apr 18, 2020)

the old shader filter freezes my OBS, im hoping this one doesn't


----------



## Limeth (Apr 18, 2020)

Limeth updated OBS ShaderFilter Plus with a new update entry:

Bug Fixes



> Fix UI elements being reordered unpredictably
> Fix UI "freezing" when interacting with it
> Improve feedback about success of loading a shader



Read the rest of this update entry...


----------



## Limeth (Apr 18, 2020)

Limeth updated OBS ShaderFilter Plus with a new update entry:

Better error feedback.



> Display error messages in the UI.



Read the rest of this update entry...


----------



## Limeth (Apr 20, 2020)

Limeth updated OBS ShaderFilter Plus with a new update entry:

v0.1.3



> Do not recreate the effect when the properties are changed only through the UI
> Fix potential property conflicts
> Update UI when only `#pragma shaderfilter` macros are changed



Read the rest of this update entry...


----------



## Surn (Apr 22, 2020)

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 (Apr 26, 2020)

Surn said:


> 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.
> 
> ...


@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 (May 1, 2020)

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.


----------



## Surge42 (May 13, 2020)

Could not get it to work at all. Shader not found at the specified path: ""


----------



## Limeth (May 14, 2020)

Surge42 said:


> 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 (Jun 7, 2020)

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:


```
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?


----------



## seabass9 (Jun 10, 2020)

Any way to make this run on OBS for MacOS Catalina?


----------



## Limeth (Jun 18, 2020)

MaJiC79 said:


> 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:
> 
> 
> ```
> ...


Thanks, I will attempt to reproduce this.



seabass9 said:


> 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 (Jul 7, 2020)

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 (Sep 14, 2020)

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 (Oct 2, 2020)

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.


----------



## Surge42 (Oct 3, 2020)

Limeth said:


> 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.


Thanks man I'll give it a try.


----------



## Spinball (Oct 10, 2020)

Errr.  So the .dll is in the correct folder, I go to add a filter and I presumably click the Browse button to pick a shader?  What to do next isn't explained in the guide.  Where would I find a shader?
Could you add a FAQ, maybe, please?  To explain what to do next?  I want to add a drop shadow filter.
Thanks


----------



## Surge42 (Oct 20, 2020)

I have the plugin installed correctly but every time I select a GLSL script from GLSL Sandbox the scripts are never allowed to run. Has anyone here successfully run a GLSL script using this plugin? If yes, could you reply with instructions?  Much thanks


----------



## Scottmac327 (Oct 26, 2020)

I get the following error message when I try to add fft.hlsl - 


Could not create the effect due to the following error: C:/Users/Scott/OneDrive/obs/plugins/fft.hlsl (27, 1): Expected 'type'

C:/Users/Scott/OneDrive/obs/plugins/fft.hlsl (1258, 138): Expected 'type'

C:/Users/Scott/OneDrive/obs/plugins/fft.hlsl (1283, 147): Expected 'type'

C:/Users/Scott/OneDrive/obs/plugins/fft.hlsl (1410, 41): Expected 'type'

C:/Users/Scott/OneDrive/obs/plugins/fft.hlsl (1557, 1): Unexpected EOF


----------



## Limeth (Nov 25, 2020)

Limeth updated OBS ShaderFilter Plus with a new update entry:

v0.2.0



> Improvements:
> 
> Add the uniform variable builtin_elapsed_time_since_shown
> Bug fixes:
> ...



Read the rest of this update entry...


----------



## Marcopole11 (Dec 18, 2020)

Hi, I'm kinda new on that shaders stuff and I'm trying to do a shader that makes dark scenes less dark.
The problem is that the render function works for every pixel instead of the whole image. So I can't know if the rest of the screen is dark too.




So Dark scenes look great, but shinny scenes lost his dark areas like the forest on picture 2.
Also when it blends from light to dark, it looks weird and ungly like picture 3.
How can I get the rest of pixels information to avoid that? I tried global variables but it says that global variables are strictly constant.

This is the code I got so far:

```
float4 render(float2 uv) {
    float4 image_color = image.Sample(builtin_texture_sampler, uv);
    float brillo = (image_color[0]+image_color[1]+image_color[2])/3;
    if(brillo < 0.079){
        return lerp(float4(0.0, 0.0, 0.0, 1.0), image_color, 2.5);
    } else if(brillo < 0.099){
        return lerp(float4(0.0, 0.0, 0.0, 1.0), image_color, 2.5-((brillo-0.079)*75));
    } else {
        return lerp(float4(0.0, 0.0, 0.0, 1.0), image_color, 1);
    }
}
```


----------



## thewitt (Feb 4, 2021)

I'm new to OBS and have not looked into the system architecture yet.  Software engineer - though I have not done any serious code development in a decade.

What's generally required to support the Mac with this type of extension?


----------



## Limeth (Jul 26, 2021)

Limeth updated OBS ShaderFilter Plus with a new update entry:

v0.3.1



> See GitHub releases page for changelog.



Read the rest of this update entry...


----------



## Bobby© (Oct 3, 2021)

*Limeth, are you planning to implement transition filter feature powered by HLSL scripts?*


----------



## QmiiProductions (Jan 22, 2022)

Could you use Homebrew to get the Linux file to work on Mac computers? That's how I initially got Spectralizer on my system.


----------



## Yoshimon (Mar 28, 2022)

I'm sorry. I am completely brain dead to all this. I've installed Shaderfilter plus...how do I install the examples and other shaders to use them? (i.e. where do you go to get the examples and other shaders?) I couldn't find a step-by-step tutorial on how to install it. Thanks.


----------



## HenkoHallows (Apr 9, 2022)

Yoshimon said:


> I'm sorry. I am completely brain dead to all this. I've installed Shaderfilter plus...how do I install the examples and other shaders to use them? (i.e. where do you go to get the examples and other shaders?) I couldn't find a step-by-step tutorial on how to install it. Thanks.


I have the examples folder but nothing works it wont even see the files. and if i say show all files and click the shader file it just spits out errors... None of the tutorials I've found give me the .dll files for https://www.youtube.com/watch?v=Q_E0kslc2xE that I tried to start with, nothing seems work :t

This is the examples folder https://github.com/Oncorporation/obs-shaderfilter/tree/master/data/examples
Hope it works for you Yoshimon <3


----------



## heavymetalsara (Apr 11, 2022)

How do you install? I get "this file does not have an app associated with it for performing this action. Please install an app or, if one is already installed, create an association in the Default Apps Settings page." when I click obs_shaderfilter_plus_windows_x64.dll. Thank you!


----------



## Slick_J (Apr 11, 2022)

I have the previous version of the Shaderfilters plugin and it works flawlessly. I am trying to help some friends add the new one to their OBS since the previous version is no longer available. The filter options shows but no actual filters are in the repository. Is there any way to convert the old filters to the new format or do they have to be individually recreated?


----------



## MrX101 (Apr 14, 2022)

Considering  denoising shaders exist in game development, would it be possible to implement one into ShaderFilter? Since it would help a lot of people with shitty webcams or bad lighting.


----------



## ItsCurlyHair (Apr 14, 2022)

I downloaded the plugin but when I added to the plug-in folder I won't show up in OBS the user define filter a my installing it wrong?


----------



## Eclipsebear (Jul 27, 2022)

I need help using the Obs shadier plug in please is any one able to help me please i have followed the instructions of putting it in to my obs plugins and when i go to add the filter and click on the browse button i get nothing in the file can some one please help me thanks you :)


----------



## Tonyturbo78 (Oct 1, 2022)

Same here.  Installed the .dll into the obs-plugins>64bit, but when you hit browse to find the shader you want for the filter, there are no files found.  Anyone help here as I've seen many others ask the same question with absolutely no reply.


----------



## cyberjunk (Nov 22, 2022)

I stumbled upon a Keyer Filter for an older version of the ShaderFilter. It looks pretty awesome, but it doesn't work in the ShaderFilter Plus: https://drive.google.com/drive/folders/1BroWQ7qG0mSdUfo87UFhxOHe-t0C7x7r?usp=sharing    It is by @Eki Halkka here in the forums: 
Eki Halkka​Has anyone taken a stab at converting that to the new file format used by ShaderFilter Plus?


----------



## JusJayD (Dec 8, 2022)

Does anyone know how to create new shade filters?  I've got several that i used to use but can longer use them since the update.


----------



## khaver (Dec 8, 2022)

@JusJayD which shaders were you using. I may be able to port them to stand-alone LUA filter scripts that don't need the ShaderFilter plugin.


----------



## JusJayD (Dec 14, 2022)

khaver said:


> @JusJayD which shaders were you using. I may be able to port them to stand-alone LUA filter scripts that don't need the ShaderFilter plugin.


I was trying to use the rainbow.shader one so that i could setup a rave party filter on my cam


----------



## khaver (Dec 14, 2022)

@JusJayD, here's my port of the ShaderFilter Rainbow effect. Load the shaderfilter-rainbow.lua file and you should now find a Rainbow filter to add to your sources.

Unzip to your scripts folder.


----------



## SkeletonBow (Dec 16, 2022)

MaJiC79 said:


> 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:
> 
> 
> ```
> ...


This crash is actually due to a bug in OBS Studio itself.  The shader parser in OBS has a number of quirks that can cause it to crash hard, and mismatched brackets/parens are one of them.  Another one is putting a pre-processor statement on the first line of a shader file, such as a #define or #include.  I make sure every shader file has at least a one line comment at the very top to avoid that bug.  There are various other bugs in OBS's shader parser also.  All of these bugs will affect every one of the various Shader plugins available for OBS as they all read the shader files, optionally add templated elements to them, and then pass it right to OBS.


----------



## watage (Dec 17, 2022)

hqx-shader/hq2x.glsl at master · CrossVR/hqx-shader
					

GPU shader version of HQx filter. Contribute to CrossVR/hqx-shader development by creating an account on GitHub.




					github.com
				




I would like to port the above shader for this plugin but it does not work.

Can anyone help me?


----------

