# obs-shaderfilter



## NLeseul (Oct 8, 2017)

NLeseul submitted a new resource:

obs-shaderfilter - Apply custom shaders to your OBS sources



> A video filter which allows you to apply your own shaders to a source. Several hopefully useful example shaders are included, including basic drop shadow, border, and rounded corner effects.
> 
> Note that this is a prerelease version at this time, and may cause OBS to crash or misbehave. Use at your own risk.



Read more about this resource...


----------



## GiacoAV (Oct 23, 2017)

This actually is a really great start! There is some bug and glitches like the fact that i need to change my effect selection and switch back to the User-defined shader to have the shader options but i can get over that.

I have an idea though : Add blur filters
This could really be an awesome shader to add as for example i would use it as part of my overlay!

Keep up the good work!


----------



## SogeHige (Oct 23, 2017)

Pretty awesome job! Thanks!


----------



## NLeseul (Oct 28, 2017)

Here's a basic blur shader, as described here:


```
// Basic 9-tap Gaussian blur, applied in one direction. Apply in pairs, with blur_vertical set on every other
// instance, to get a two-dimensional blur.
// Based on: https://github.com/mattdesl/lwjgl-basics/wiki/ShaderLesson5

uniform bool blur_vertical;

float4 mainImage(VertData v_in) : TARGET
{
    float4 sum = float4(0, 0, 0, 0);
  
    float hstep = !blur_vertical * uv_pixel_interval.x;
    float vstep = blur_vertical * uv_pixel_interval.y;
  
    sum += 0.0162162162 * image.Sample(textureSampler, float2(v_in.uv.x - 4 * hstep, v_in.uv.y - 4 * vstep));
    sum += 0.0540540541 * image.Sample(textureSampler, float2(v_in.uv.x - 3 * hstep, v_in.uv.y - 3 * vstep));
    sum += 0.1216216216 * image.Sample(textureSampler, float2(v_in.uv.x - 2 * hstep, v_in.uv.y - 2 * vstep));
    sum += 0.1945945946 * image.Sample(textureSampler, float2(v_in.uv.x - 1 * hstep, v_in.uv.y - 1 * vstep));
  
    sum += 0.2270270270 * image.Sample(textureSampler, v_in.uv);
  
    sum += 0.1945945946 * image.Sample(textureSampler, float2(v_in.uv.x + 1 * hstep, v_in.uv.y + 1 * vstep));
    sum += 0.1216216216 * image.Sample(textureSampler, float2(v_in.uv.x + 2 * hstep, v_in.uv.y + 2 * vstep));
    sum += 0.0540540541 * image.Sample(textureSampler, float2(v_in.uv.x + 3 * hstep, v_in.uv.y + 3 * vstep));
    sum += 0.0162162162 * image.Sample(textureSampler, float2(v_in.uv.x + 4 * hstep, v_in.uv.y + 4 * vstep));
  
    return sum;
}
```


You'll need to apply two of them to your source, one horizontal and one vertical.

This is a fixed-size blur with a radius of 4 pixels, so the effect isn't very strong. You should be able to apply multiple pairs to strengthen the effect, but watch your GPU usage.


----------



## Paul of Tw (Oct 31, 2017)

It doesn't work in OBS version 20.1.0 .....


----------



## NLeseul (Nov 1, 2017)

Hmm. I just upgraded my installation to 20.1.1, and I don't see any problems there.

What issue are you seeing in 20.1.0? Was this previously working for you in 20.0.1 and stopped working after you upgraded?


----------



## Paul of Tw (Nov 3, 2017)

NLeseul said:


> Hmm. I just upgraded my installation to 20.1.1, and I don't see any problems there.
> 
> What issue are you seeing in 20.1.0? Was this previously working for you in 20.0.1 and stopped working after you upgraded?



Nothing happened ....  It didn't show the shaderfilter in filter menu, even though I put all required files into the correct obs file directory...  I also reinstalled OBS studio to newest version 20.1.1. But the problem still goes on...

I'm using Windows 10 64-bit . I was wondering, maybe it's locale problem, because I'm using chinese language in OBS and this plug-in  only have english now.  

I tried to change full english in OBS, but nothing appeared.

I'm so glad and excited about this plug-in, wish this problem can be find out and fixed in the future. Thank you!!


----------



## NLeseul (Nov 3, 2017)

Yeah, the locale difference shouldn't be an issue. I believe OBS will fall back on the default locale configured in the plugin (usually en-US) if it can't find your current locale. And even if that disappeared somehow, I think it would just show the unlocalized string IDs in the interface.

I'm also on Windows 10 64-bit, so there probably isn't anything odd there either.

If you don't even see an option to add this filter, that seems like the plugin DLL isn't being found by OBS for some reason. Can you check your OBS startup log ("Help" -> "Log Files" -> "View Current Log" immediately after starting OBS) and see if there's any reference to obs-shaderfilter.dll, error or otherwise? In mine, for example, I see this:


```
00:29:15.701: Required module function 'obs_module_load' in module '../../obs-plugins/64bit/chrome_elf.dll' not found, loading of module failed
00:29:15.737: [CoreAudio encoder]: Adding CoreAudio AAC encoder
00:29:15.929: [AMF] Encountered Exception during AMF initialization: Unable to load 'amfrt64.dll', error code 126.
00:29:15.929: Failed to initialize module 'enc-amf.dll'
00:29:16.215: Required module function 'obs_module_load' in module '../../obs-plugins/64bit/gsdll64.dll' not found, loading of module failed
00:29:16.224: Required module function 'obs_module_load' in module '../../obs-plugins/64bit/libcef.dll' not found, loading of module failed
00:29:16.225: Required module function 'obs_module_load' in module '../../obs-plugins/64bit/libEGL.dll' not found, loading of module failed
00:29:16.226: Required module function 'obs_module_load' in module '../../obs-plugins/64bit/libGLESv2.dll' not found, loading of module failed
00:29:16.296: Required module function 'obs_module_load' in module '../../obs-plugins/64bit/lua53.dll' not found, loading of module failed
00:29:16.297: Failed to load 'en-US' text for module: 'obs-browser.dll'
00:29:16.297: [browser_source: 'Version: 1.29.0']
00:29:16.916: LoadLibrary failed for 'nvEncodeAPI64.dll': The specified module could not be found.
00:29:16.916:  (126)
00:29:19.265: Failed to load 'en-US' text for module: 'tsuki-studio.dll'
00:29:19.358: VLC found, VLC video source enabled
00:29:19.636: No blackmagic support
00:29:20.544: ---------------------------------
00:29:20.544:   Loaded Modules:
00:29:20.544:     win-wasapi.dll
00:29:20.544:     win-mf.dll
00:29:20.544:     win-dshow.dll
00:29:20.544:     win-decklink.dll
00:29:20.544:     win-capture.dll
00:29:20.544:     vlc-video.dll
00:29:20.544:     tsuki-studio.dll
00:29:20.544:     text-freetype2.dll
00:29:20.544:     rtmp-services.dll
00:29:20.544:     obs-x264.dll
00:29:20.544:     obs-vst.dll
00:29:20.544:     obs-transitions.dll
00:29:20.544:     obs-text.dll
00:29:20.544:     obs-shaderfilter.dll
00:29:20.544:     obs-qsv11.dll
00:29:20.544:     obs-outputs.dll
00:29:20.544:     obs-ghostscript.dll
00:29:20.544:     obs-filters.dll
00:29:20.544:     obs-ffmpeg.dll
00:29:20.544:     obs-browser.dll
00:29:20.544:     image-source.dll
00:29:20.544:     frontend-tools.dll
00:29:20.544:     enc-amf.dll
00:29:20.544:     coreaudio-encoder.dll
00:29:20.544: ---------------------------------
```

Basically, there's some text in there about every DLL in the folder OBS is scanning, even the ones that can't be loaded as plugins. If OBS is failing to load the plugin for some reason, you should see an error about it there. If you don't see that, then OBS is probably looking in a different place for plugins than where you put the file.


----------



## Paul of Tw (Nov 4, 2017)

Thanks for your suggestion! This time I use 32-bit version, and I open the log file,  it did show the error message as follows:

Required module function 'obs_module_load' in module '../../obs-plugins/32bit/chrome_elf.dll' not found, loading of module failed
 [CoreAudio encoder]: CoreAudio AAC encoder not installed on the system or couldn't be loaded
[AMF] Encountered Exception during AMF initialization: Unable to load 'amfrt32.dll', error code 126.
Failed to initialize module 'enc-amf.dll'
Required module function 'obs_module_load' in module '../../obs-plugins/32bit/libcef.dll' not found, loading of module failed
Required module function 'obs_module_load' in module '../../obs-plugins/32bit/libEGL.dll' not found, loading of module failed
Required module function 'obs_module_load' in module '../../obs-plugins/32bit/libGLESv2.dll' not found, loading of module failed
Failed to load 'en-US' text for module: 'obs-browser.dll'
 [browser_source: 'Version: 1.29.0']
LoadLibrary failed for 'nvEncodeAPI.dll': The specified module could not be found.
(126)
*LoadLibrary failed for '../../obs-plugins/32bit/obs-shaderfilter.dll': The specified module could not be found.
(126)
Module '../../obs-plugins/32bit/obs-shaderfilter.dll' not found*
 ---------------------------------
Loaded Modules:
 win-wasapi.dll
win-mf.dll
win-dshow.dll
win-decklink.dll
win-capture.dll
vlc-video.dll
text-freetype2.dll
rtmp-services.dll
obs-x264.dll
obs-vst.dll
obs-transitions.dll
obs-text.dll
obs-qsv11.dll
obs-outputs.dll
obs-filters.dll
obs-ffmpeg.dll
obs-browser.dll
image-source.dll
frontend-tools.dll
enc-amf.dll
coreaudio-encoder.dll
-----------------------------------------------
I re-checked again. Strangely I put all the needed files into correct position...  Somehow OBS can't find it...


----------



## NLeseul (Nov 4, 2017)

Paul of Tw said:


> *LoadLibrary failed for '../../obs-plugins/32bit/obs-shaderfilter.dll': The specified module could not be found.
> (126)
> Module '../../obs-plugins/32bit/obs-shaderfilter.dll' not found*



Thanks for checking that. That probably means Windows couldn't load the DLL due to a missing dependency. I checked the dependencies of the DLLs using the Dependency Walker (an excellent tool), and it looks like they are depending on some libraries from the latest Visual C++ Redistributable. I'd rather not rely on that, since none of the other DLLs in OBS Studio seem to, so I changed my build settings to prevent that dependency. Can you try installing from the attached archive and seeing if that resolve your problem? If so, I'll probably update the release on GitHub with this build, just in case anyone else is being affected by this.


----------



## Paul of Tw (Nov 5, 2017)

*It works !!!  Thanks a lot !!!  *





Another suggestion, would that be possible to create a filter just like the "text outline" 
(or can be described like border around texts ??) 
Just like this example picture:



Although it's built in text source, but I want to insert outer source to make this effect. (using other application. After filtering, I can overlay dynamic texts in OBS )


----------



## NLeseul (Nov 5, 2017)

NLeseul updated obs-shaderfilter with a new update entry:

Rebuilt without Visual C++ Redistributable dependency



> The original binary release was built with a dependency on the Visual C++ Redistributable, and Windows doesn't really give errors on that very well. I've rebuilt the binary without that dependency. If you had problems with this source completely failing to show up in the source menu, this update may help you.



Read the rest of this update entry...


----------



## NLeseul (Nov 5, 2017)

No problem. Thanks for reporting the issue. 

I think outline effects should be possible with a pixel shader, but it's not something I've tried myself. This article suggests one approach to doing it, if you want to experiment. "Step 4" in that article is all you'd need for a purposes of filtering a texture in OBS Studio, I think. Note that their code is written in Cg, not HLSL, so it wouldn't directly work in OBS Studio.


----------



## Paul of Tw (Nov 6, 2017)

NLeseul said:


> No problem. Thanks for reporting the issue.
> 
> I think outline effects should be possible with a pixel shader, but it's not something I've tried myself. This article suggests one approach to doing it, if you want to experiment. "Step 4" in that article is all you'd need for a purposes of filtering a texture in OBS Studio, I think. Note that their code is written in Cg, not HLSL, so it wouldn't directly work in OBS Studio.



Got it. Thank you so such !


----------



## keylist (Dec 27, 2017)

NLeseul said:


> NLeseul submitted a new resource:
> 
> obs-shaderfilter - Apply custom shaders to your OBS sources
> 
> Read more about this resource...


Excuse me, this filter can realize HQ2x ?

For example:




If it is possible, are LQ2x, ScaleX, 2xSaI, Super2xSaI, SuperEagle, Scanline, and xBRZ filters possible?
My English is not good, sorry.


----------



## NLeseul (Dec 31, 2017)

keylist said:


> Excuse me, this filter can realize HQ2x ?



I don't know of any reason why it couldn't, as long as the HQ2x algorithm or any of the others can be implemented in an HLSL shader. Someone will have to write or adapt the shader code for them, though. 

This project on GitHub seems to offer HLSL/Cg implementations of several of those algorithms that you or someone else might be able to use as a starting point.


----------



## Matyugovich (Jan 26, 2018)

It would be awesome if someone could adapt motion blur shader to this. My skills in coding is pretty low, the best that i can do is basic HTML. Could actually donate some bucks $ to the person who does this for me.


----------



## NLeseul (Jan 27, 2018)

As far as I can tell from here and here, generalized motion blur isn't particularly easy and would pretty much need to be built into your game engine rather than applied after the fact. 

Are you hoping to apply motion blur to the contents of a game capture, or do you just want there to be motion blur on a graphic that is moving around in OBS Studio's workspace?


----------



## Matyugovich (Jan 29, 2018)

On game capture.


----------



## regidark (Apr 29, 2018)

Hello! I downloaded your plugin but when i unzip i don´t see the same folders as in your youtube video. Did you change anything? Is there any other place where i can download the full version?
Thanks a lot in advance


----------



## RamSh (May 5, 2018)

regidark said:


> Hello! I downloaded your plugin but when i unzip i don´t see the same folders as in your youtube video. Did you change anything? Is there any other place where i can download the full version?
> Thanks a lot in advance



I'm facing the same issue... I'd really like to use this as currently for dropping shadow for text I'm using a Browser to load html file with drop shadow using css... I guess that this is a better solution, thx much in advance


----------



## Janbert (May 14, 2018)

I can't find the obs-shaderfilter.dll !?!?


----------



## NLeseul (May 27, 2018)

Unsure why people would be having this issue? I just re-downloaded the release from GitHub, and it still seems to be intact. You are downloading the obs-shaderfilter-win.zip archive (the Windows binary release) and not the "Source code" archive, right?


----------



## mike2003 (May 29, 2018)

This all time add ugly black stroke around
why?


----------



## BOLL (Aug 16, 2018)

I'm using this for a distortion shader, I'm still quite the nub and I've been using Shadron to tweak my shader. Some things I wonder though...

1. Is it possible to get the source width and height as global variables?
2. Is it possible to set a default value and/or range for the sliders?

In any case, very happy this exists, hard to use but with that crazy flexible ;)


----------



## gart24 (Oct 4, 2018)

How to use shaders for denoise video?


----------



## Trenaldi (Oct 23, 2018)

Anyone know how to make an inner shadow/glow? I really just am having a hard time wrapping my head around this shader code.


----------



## Surn (Feb 26, 2019)

I loved this plugin so much, it got branched and developed.

https://github.com/Oncorporation/OBS-shaderfilters
I have written and rewritten several filters for the current version of this plugin. 

A branch with upgrades for this plugin will also be released soon, it will have new effects and some new capabilities.


----------



## DJFrANKyEHP (Aug 7, 2022)

Thanks a lot for all the people who is involved in the creation and development of this wonderful plugin and its shaders because they are all really really good for to give personality and originality.

I use it in all my 'Streams' for very much effects and things, so a really big thanks a lot for the hardwork put on it.

NOTE: All are credited as 'Plug-ins Creator' at the credits of my 'Streams' at the end of them. ;)


----------



## AdmiralBeluga (Oct 31, 2022)

on OBS 27 perfect, on OBS 28 it failed on me :( so hopefully I did something wrong or soon a fix? (for multiple plug-ins its an issue for me)


----------



## Connorses (Jan 2, 2023)

Sorry but I can't find the file with the .dll either. On the github page I could only find a download of the source code. Can someone point me towards the compiled downloads?


----------



## Connorses (Jan 2, 2023)

Connorses said:


> Sorry but I can't find the file with the .dll either. On the github page I could only find a download of the source code. Can someone point me towards the compiled downloads?





Found it.


----------

