Problem with "Your first plugin" instructions

I think I have followed exactly, but have an issue at the last stage. When I try to add the float offset line I get this error:
ERROR: 0:40: ‘*’ does not operate on ‘float’ and ‘int’
followed by:
ERROR: 0:41: Use of undeclared identifier ‘offset’

I’ve tried in both textedit and ISFEditor, with the same result.
Saving leaves the plugin active, with all three parameters, but the thickness one is not operational - which is no surprise!

My coding skills are minimal, so no attempted modifications have worked.

Hi Sokkan,

Can you maybe share your the code inside of your Lines.fs that you have written so far?


Hi Eric,

I progressively made the changes to create BetterLines.amxd, including the ones to make it an effect.

The final version of BetterLines.fs is this:

“DESCRIPTION” : “My First ISF Shader”,
“ISFVSN” : “2”,
“INPUTS” : [
“NAME” : “inputImage”,
“TYPE” : “image”
“NAME” : “radians”,
“TYPE” : “float”,
“NAME” : “density”,
“TYPE” : “float”,
“DEFAULT” : 10
“NAME” : “thickness”,
“TYPE” : “float”,
“DEFAULT” : 0.5

#define TWO_PI 6.283185

void main() {
float aspect = RENDERSIZE.y / RENDERSIZE.x;
float x = (isf_FragNormCoord.x - 0.5);
float y = (isf_FragNormCoord.y - 0.5) * aspect;

float offset = thickness * 4 - 2;

float red = sin((x * cos(radians) + y * sin(radians)) * density) + offset;
float green = sin((x * cos(radians * 2 + TWO_PI * 1/3) + y * sin(radians * 2 + TWO_PI * 1/3)) * density) + offset;
float blue = sin((x * cos(radians * 3 + TWO_PI * 2/3) + y * sin(radians * 3 + TWO_PI * 2/3)) * density) + offset;
float alpha = 1;

vec4 linesResult = vec4(red, green, blue, alpha);
vec4 incoming = IMG_THIS_PIXEL(inputImage);
float dist = distance(vec2(x, y), vec2(0, 0));

gl_FragColor = mix(incoming, linesResult, smoothstep(0.2, 0.3, dist));


The plugin works as it should, except for the thickness parameter, which is displayed as a value in the button, and is able to be modulated, but does not have any effect on the image. Everything else works.

ISF Editor indicates that the error is in “float offset = thickness * 4 - 2;”

and is: ‘*’ does not operate on ‘float’ and ‘int’

Naturally that flows on to ‘offset’ being undeclared, but the colour values are still functioning.

Changing the line to “float offset = thickness * x - y;” for example, ends the error for that line, but now it comes up for the green and blue lines - but not the red, which has no integers.

Replacing “*” with “+” creates the similar error.

So there seems to be an issue with using arithmetical operators with integers on ‘float’ lines?

Perhaps a change in float as a type?

Any suggestions welcome!

Hi Sokkan,

Could you try out this file :

I copied your code and the only thing I changed is some formatting, hope this helps.
Strange thing is I couldn’t really find what was going wrong exactly…I’ll keep looking but for now I hope my edit works for you and you can continue with your work :).


Hi Eric,

I tried your file, and the same errors occurred, so I thought I might see if there was any clue in the Preferences for ISFEditor. I activated “Use OpenGL 4 to render”, and suddenly the errors disappeared, and the render window came to life, with all 3 sliders working. Perhaps you had already got that far?

However that didn’t translate to the plugin in Live, with neither of our versions having Thickness operational. It does give a hint at an explanation, given the note in ISFEditor that “(Some ISFs only work in GL4)”. Maybe Videosync/Live/M4L doesn’t handle some of these ISFs correctly?

That doesn’t explain how others have presumably followed the instructions successfully - maybe a different Videosync/Live/M4L iteration? I’m on Videosync 1.0, so that might be a factor?

Another interesting thing is that the Videosync console reports that it has “Successfully compiled shader BetterLines.fs” - exactly the same message as for the other example shaders in Plugin SDK. It doesn’t see a problem.

So maybe that’s as far as we can get at the moment? It is not a significant problem for my work - I’m not going to be using that shader, and the work on it will help me with modifying the ones I really do need.

Thanks for your efforts - much appreciated.

All the best,


Hi Sokkan,

We found out that the formatting issue probably came from copying your code from your post or that you maybe edited the code in a text editor that is not typically designed for code editing. Resulting in different type of quotes (U+201D) that Videosync could not interpret. But it seems that this error only occurred on my side after copying the code from the forum post…so after fixing the “” issue, it did not fix yours… :sweat_smile:.

Yes, you are probably right that your issue has something to do with your OpenGL version. Although multiplying integers with floats should not be a problem anymore after OpenGL version 2.1(GLSL 1.2).
What you could maybe try is to add .0 to all of your integers. So for example : float offset = thickness * 4.0 - 2.0;.

Then about the Thickness param still not working; if Videosync has no problem with compiling the shader, then the problem should lie with the code in the Max patcher. Could you share your version of the Max patcher with me as well so I can have a look at it :grinning:?


Hi Eric,

Problem solved, thanks to you!

There was indeed an error in the M4L patch - in spite of the fact I had checked it multiple times!

It was my first time using Max - or anything similar - so I had really only seen the ‘macro’ view, which looked fine. But just now I noticed a ‘micro’ mistake - I had connected the in and out of the new Thickness object directly - so it was being effectively bypassed? I’m not sure exactly how I did it - but I now know to make sure I zoom in when patching!

Fixed that, and all works fine. Thanks for your help.

You were right also about the copy of the fs file I sent you - I had taken it from Text Edit, not the ISFEdit file. Thanks to this current experience I’ll stick to the latter - now that I feel less overwhelmed by its complexity. That should make it much easier to see significant formatting issues, not to mention the other errors I am sure to make.

Also correct was the idea that replacing 2 with 2.0, etc. would remove the errors. It did. First I unchecked the GL4 box and all the errors returned, with the render window blank. I made the changes in the offset df, and it was fixed - but blue, green, alpha, still had errors. After replacing all the integers, including the ones in fractions, all errors were removed and the render window came to life.

So a great learning experience for me, and perhaps others will get some benefit if they find themselves with such a problem. Hopefully I will now need less help from you in the future!

Thanks again,


Hi Sokkan,

Great to hear that you got it all working in the end! And indeed it looks like you learned a lot during the process, as did we :blush:. So I think we can call it a win win situation :slight_smile:

Happy syncing!