GSLS shaders

FFGL, OSC, GLSL. If you like abbreviations, this is the forum for you
Post Reply
rdpozo
Is taking Resolume on a second date
Posts: 15
Joined: Sat Jan 13, 2018 15:11

GSLS shaders

Post by rdpozo »

Hi there,

I'm relativ new to Resolume, but I have been developing my own VJ tools in Max/msp-jitter for some years now.
I have been using a lot of the GSLS shaders from vade and the built in shaders in max. Some of these effects I have grown to depend upon, and as much as I can gather, there is a way of porting some of this code to FFGL plugin effects in Resolume.

I saw one thread that links to GitHub: https://github.com/resolume/ffgl , where, as I understand, you find the Xcode framework for making the plugin. Issue is I have never used Xcode, and I'm not a shader programmer.

Can anyone of you tell me if there is a tutorial on how to create a plugin using Xcode? I understand that explaining shader programming is well beyond what I can ask, but as long as get som idea of how to make a plugin using the linked framework and Xcode, I can always do some trail and errors porting the shaders from jitter. Also, it might be that I misunderstand all of this and to you developers, this is just gibberish.

This is one of the shaders I would like to port to Resolume and make a plugin of: (just for reference).

Thanks for any feedback :)

<jittershader name="contrast-interp">
<description>Shader for for modifying image contrast by interpolation and extrapolation</description>
<param name="image" type="int" default="0" />
<param name="avgluma" type="vec3" default="0.62 0.62 0.62" />
<param name="contrast" type="float" default="1.0" />
<param name="brightness" type="float" default="1.0" />
<param name="saturation" type="float" default="1.0" />
<param name="alpha" type="float" default="1.0" />
<language name="glsl" version="1.0">
<bind param="image" program="fp" />
<bind param="avgluma" program="fp" />
<bind param="contrast" program="fp" />
<bind param="brightness" program="fp" />
<bind param="saturation" program="fp" />
<bind param="alpha" program="fp" />
<program name="vp" type="vertex">
<![CDATA[
//
// Vertex shader for modifying image contrast by
// interpolation and extrapolation
//
// Author: Randi Rost
//
// Copyright (c) 2003-2005: 3Dlabs, Inc.
//
// See 3Dlabs-License.txt for license information
//

varying vec2 texcoord;

void main (void)

{
gl_Position = ftransform();
texcoord = vec2(gl_TextureMatrix[0] * gl_MultiTexCoord0);
}
]]>
</program>
<program name="fp" type="fragment">
<![CDATA[
//
// Fragment shader for modifying image contrast by
// interpolation and extrapolation
//
// Author: Randi Rost
//
// Copyright (c) 2002: 3Dlabs, Inc.
//
// See 3Dlabs-License.txt for license information
//

const vec3 LumCoeff = vec3 (0.2125, 0.7154, 0.0721);

varying vec2 texcoord;
uniform sampler2DRect image;

uniform vec3 avgluma;
uniform float saturation;
uniform float contrast;
uniform float brightness;
uniform float alpha;

void main (void)
{
vec3 texColor = texture2DRect(image, texcoord).rgb;
vec3 intensity = vec3 (dot(texColor, LumCoeff));
vec3 color = mix(intensity, texColor, saturation);
color = mix(avgluma, color, contrast);
color *= brightness;
gl_FragColor = vec4 (color, color.g*alpha);
}
]]>
</program>
</language>
</jittershader>

Joris
Doesn't Know Jack about VJ'ing or Software Development and Mostly Just Gets Coffee for Everyone
Posts: 5185
Joined: Fri May 22, 2009 11:38

Re: GSLS shaders

Post by Joris »

You can wrap GLSL shaders in an FFGL plugin. The Add/Subtract example in the Git repo uses a shader to do most of its work.

Unfortunately, declaring the control parameters is not so straightforward if you don't have any c++ and OpenGL experience. It requires you first to create the parameters and implement their callbacks for communication with Resolume, and then to pass these values to the shader.

If you know what you're doing, it shouldn't take you more than half an hour to implement the shader you've linked. If you're new to c++, it could end up being a very frustrating day or two.

rdpozo
Is taking Resolume on a second date
Posts: 15
Joined: Sat Jan 13, 2018 15:11

Re: GSLS shaders

Post by rdpozo »

Hi Joris,

Thank you for your answer. I see that I have a lot to get into.
I do not know any C++ or OpenGL, so I guess I'm stuck. I'll better download some books and start reading first.
Thanks for the input.

rdpozo
Is taking Resolume on a second date
Posts: 15
Joined: Sat Jan 13, 2018 15:11

Re: GSLS shaders

Post by rdpozo »

OK, I'm giving up. This is to complicated for me.

I guess it is no way that you would consider porting 2 effects for me? Eh.....

Joris
Doesn't Know Jack about VJ'ing or Software Development and Mostly Just Gets Coffee for Everyone
Posts: 5185
Joined: Fri May 22, 2009 11:38

Re: GSLS shaders

Post by Joris »

Post the code. Who knows, you might get lucky :)

rdpozo
Is taking Resolume on a second date
Posts: 15
Joined: Sat Jan 13, 2018 15:11

Re: GSLS shaders

Post by rdpozo »

Thank you, I'll try my luck

Post Reply