GLSL blur
-
The Book of Shaders
by Patricio Gonzalez Vivo and Jen Lowe
This is a gentle step-by-step guide through the abstract and complex universe of Fragment Shaders
Best Wishes
Russell
-
@boyexploded you might also want to take an easier route and start with something from shadertoy. Here is a pretty cool motion blur https://www.shadertoy.com/view...
-
@boyexploded
I was about to say the same as @Fred did. ShaderToy is an amazing resource and most of their shaders work in Isadora with little to no modification.
We also did a Guru Session on YouTube about the subject;And we have a Help article about modifying Shaders
-
This thread contains a zip of many Interactive Shader Format shaders (ISF) converted to work with Isadora as GLSL.
https://community.troikatronix...I am not sure there are any motion blur effects in there.. but I thought I remember seeing one that used a persistent buffer.
-
@bonemap Thanks, man. I've been trying to go through the chapters for a minute now; I should've included that in OP. Struggling with it hard but thanks for the rec. Would you say you're proficient in opengl? Would be v grateful to talk w somebody, I learn best with a tutor. Thanks again
-
@fred Thanks Fred. I'm working with some code from glslsandbox right now. I was able to make some intentional changes through trial and error. Any chance you've got a good handle and opengl and would be willing to chat about my project and what I'm trying to do? Thanks for the recommendation regardless <3
-
@juriaan thaanks, Juriaan. I've used some of the suggestions in the Help article to some effect, but even with those, I'm running into errors that I can't figure out. I've also watched the tutorial once but it might be helpful to review it. Otherwise, would you be able to direct me to any tutors in opengl? Would really like to talk in real time with an expert. Thanks for your suggestion, regardless!
-
@dusx I hadn't seen this before thanks, DusX! I will look through and see if I can find any solutions. Would you be able to point me to somebody I could speak with directly in real time about this project? Would be v grateful! Thanks regardless!
-
@boyexploded I would take it slow, it is a lot to learn and do things in steps. It is likely you might not understand everything all at once.
As a simple exercise start with the code in the default GLSL actor and see what you can do with it.uniform sampler2D tex0; void main(void) { vec3 c0 = texture2D(tex0, gl_TexCoord[0].xy).rgb; gl_FragColor = vec4(c0, 1.0); }
This is basically sampling colours from your input texture (tex0 - this comes from what you connect to the vid-gpu input), in the same pixel order that it outputs.
Here are some things to help udnerstand what is happening.uniform sampler2D tex0; void main(void) { vec3 c0 = texture2D(tex0, gl_TexCoord[0].xy).rgb; gl_FragColor = vec4(c0.r, c0.g, c0.b, 1.0); }
This does the same thing as the default but note now we can see the different channels in the output signal (the last value that is set to 1 is the alpha value).
You can do some simple manipulation by swapping the channles in the output like this:
uniform sampler2D tex0; void main(void) { vec3 c0 = texture2D(tex0, gl_TexCoord[0].xy).rgb; gl_FragColor = vec4(c0.b, c0.g, c0.r, 1.0); }
This is a pretty simple maniupulation of just the output channel
uniform sampler2D tex0; void main(void) { vec3 c0 = texture2D(tex0, -gl_TexCoord[0].xy).rgb; gl_FragColor = vec4(c0, 1.0); }
This will turn the image upside down because you sample the colours from the input in the opposite order they are used for output.
void main(void) { vec3 c0 = texture2D(tex0, gl_TexCoord[0].xy).rgb; gl_FragColor = vec4(c0.b / gl_TexCoord[0].x, c0.g/gl_TexCoord[0].x, c0.r/gl_TexCoord[0].x, 1.0); }
This uses the x coordinate of the sampler to change the RGB levels - so what happens is the image fades accross the x axis (left to right)
These all just use the fragment shader (which you can kind of imagine is the bit that decides what colours go where). This is based on just a simple plane, so a square image. A vertex shader will let you perform manipulation on the plane, so it might not be a plane any more but you can move the points around. When we work with GLSL they are not necessarily just points, but can be thought of as points on a mesh of triangles that are connected. You can move points around but keep the connections between them or also break and or rebuild the connections between the points.
So to do something complicated is not a matter of just understanding how GLSL works, you need to be able to imagine the effect you want in terms of what kind of mainpulation of colours, sampling spaces and geometry. So what maths and manipulation would you apply where to get what you want. This is made a little more difficult as Isadora does not have a super logical way to use a buffer. For motion blur a buffer may be important as it would allow you to store the last frame generated and blend it back with the next incoming frame (because motion blur requires you manipulate things over time).
That can all get pretty complicated, so there is of course a shortcut. The shortcut is to find some existing code and work out how to port it to Isadora. This can get complicated as the default lables for input textures and samplers and some default behaivour of each platform is different. This means you need to get some basic understanding of the platforms you are using as a source.
Having said that depending on your needs a motion blur can be just blending some of the last frame with the current frame (in a simple way). Some more advanced motion blur with instead look at the geometry and textures in a frame and specifically understand thier motion vectors and place appropirately faded versions of them in the correct positions. This is likely not so useful as you are probalby feeding the the shader with a flat texture.
As @DusX suggested there is an example of a shader with a persistent buffer somewhere on this forum - it has been discussed and I am sure Mark posted something some time.
Again, there is a lot to learn, and some advice is dont rush in, do some basic steps, set some simple goals like making a GLSL actor where you can control the level of each channel, do some messing around to get familiar first. If you find an example you like on another platform, do the same messing around there so you understand where the texture comes in and out, how it is labelled, how external parameters are setup etc and then try smash everything together.
It may of may not be worth it, I think it is but that depends on you. There are also some platforms like Vuo that you can use to make a composition and then export the composition as an FFLG plugin that can be used inside Isadora.
Hope this helps - happy shading! -
-
@fred said:
sorry to crash you in on this thread, do you have it on hand?
No problem... this is very much related. I believe this is the post you are after: https://community.troikatronix...