-
-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A guide for rewriting Shadertoy shaders #6
Comments
Hello, thank you for the question! I think that it would be helpful to create a wiki page comparing shadertoy and OBS ShaderFilter Plus shaders and about how to adapt the shaders. In your particular example, the uniforms would have to be renamed according to the README and void main() {
vec2 st = gl_FragCoord.xy/u_resolution.xy; would be replaced with float4 render(float2 st) { or vec4 render(vec2 st) { depending whether you use DirectX or OpenGL, respectively. |
After playing a while, I could make it work:
Since we are talking about shaders, let me ask you something: Can I create/use a shader that overlap some image/video over another with "Add" or "Screen" blending? |
This plugin currently does not let you combine multiple sources, though I would definitely like to see this functionality added in the future. I assume it would not be facilitated using "Effect Filters", but rather a new source that combines other sources. |
Your solution didn't work for me as it said that vec[1-4] was an unrecognized identifier. What worked for me was
Also, this might be a naive question, but what exactly is being passed to render (st)? Is it just the equivalent of |
@josephyooo The issue with vec not working is related to which graphics API is in use. On Windows, obs-shaderfilter-plus uses DirectX and HLSL by default (as opposed to GLSL), which uses the syntax you responded with. You can read more about the graphics APIs in the README.md: https://github.com/Limeth/obs-shaderfilter-plus#what-are-shaders
The usage guide may be ambiguous on what the parameter is, so let me clear this up -- the st parameter of the render function are the UV texture coordinates of the source this filter is being applied to. Its components range from 0 to 1. In order to access the resolution (size) of the source, you can use the builtin_uv_size uniform. |
Hi @Limeth , thanks for a great plugin :) While we're on the shadertoy topic, what would be the equivalent of I guess it's still a planned feature? |
Hello @opyate, glad you find it useful. |
I would like to use shaders in OBS, but I know Python, not shaders language.
Can I use shaders from pages as shadertoy, shaderfrog, etc? How should I do the code conversion to use with obs-shaderfilter-plus? For example, this is a simple one: https://thebookofshaders.com/edit.php
I know that it has to has
float4 render(float2 uv) {
to work, but I don' know how... 👍I know this is not a bug, if it doesn't correspond here, you can delete this issue. Thanks.
The text was updated successfully, but these errors were encountered: