FreeframeGL ShaderLoader

FFGL, OSC, GLSL. If you like abbreviations, this is the forum for you
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: FreeframeGL ShaderLoader

Post by Joris »

That the ID would oscillate is indeed a bit weird. It could be because a texture is being ping-ponged somewhere else in Resolume, it's hard to say.

Is there a particular reason you need access to a fixed texture ID though?

leadedge
Hasn't felt like this about software in a long time
Posts: 104
Joined: Fri Feb 14, 2014 13:58

Re: FreeframeGL ShaderLoader

Post by leadedge »

Thanks Joris,

this is not yet fixed properly and there is a mistake in the ShaderMaker code, so I will need to make another change and it would be great if you could clear some things up for me.

To explain a little first. Some shaders use coordinates -1 to 1 instead of 0 - 1 and depend on a texture with wrap GL_REPEAT instead of GL_CLAMP_TO_EDGE. So an internal texture of this type has to be created from the incoming freeframe texture (the other reason is to avoid problems if the width/hardware width do not match).

Before explaining the ID change problem, here's the fundamental symptom (with release 1.002) for a shader that uses a texture.

. Drop a clip or image into a cell. Click and activate it. Drop ShaderMaker onto it. The result is OK.
. Drop a clip or image into a cell. Drop ShaderMaker onto it. Click and activate it. The result is OK.
. Drop ShaderMaker into a cell. Drop a clip or image onto it. Click and activate it. The result is OK.
. Drop ShaderMaker into a cell. Click and activate it. Drop a clip or image onto it. The result is black.

It appears that this is only a problem if media is dropped over the plugin. If the effect is dropped over media it is always OK.

So I guess the first question is whether this is expected behaviour or not. I would have expected some sort of rendering order and if media was dropped onto an effect it would not work, but all the other plugins do work OK in this way.

What is happening in the last case is that a texture is being received even though there is no media present. Then when you drop media onto it, the texture ID changes but this is not picked up and the internal OpenGL texture is not re-created and the result is black.

So the question here is, why is a texture being received if there is no media present?

The thing with the ID change 21,22,21 etc. is that because the change has to be detected for the texture to be re-created, this oscillation effect means that the texture is re-created on every frame.

I guess it doesn't matter much because the time taken would be trivial, but I thought it strange that this occurs at all, as well as on an empty frame and with some clips I have, but not all.

So before making another correction, I would like to know whether dropping media on top of a plugin is required. If not, ID change does not need to be detected and the result will remain black, but the oscillation will not be a problem.

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: FreeframeGL ShaderLoader

Post by Joris »

I think it may have to do with the way you have 'repurposed' Effect Clips to be able to create both a source and an effect from the same plugin.

In principle, a FFGL source does not take a texture input. It's marked as FF_SOURCE in PluginInfo. In Resolume it appears in the Sources tab and it's applied by dragging it from the Sources tab to a clip slot.

An FFGL effect takes a single texture input. It's marked as FF_EFFECT in PluginInfo. In Resolume it appears in the Effects tab. You apply it by dragging it over a *filled* clip slot, over a layer preview ( on the lefthand side of the clip grid ), or the clip, layer and composition tabs ( in the bottom half of the GUI ). When applied and active, it will immediately take that texture as an input.

There's a special case where an effect can be applied to an empty clip slot to create an Effect Clip. In this case it takes the rendering result of the combined layers underneath ( which can result it the effect rendering without having a valid texture input, when the layers underneath are left blank ).

You have 'repurposed' this special case to create shaders that do not need a texture and are as such sources, even though they're officially effects.

The use case of then dragging a movie clip over an effect clip to turn it back into a regular effect, although not explicitly prohibited, is such a fringe case that it hardly occurs during regular use. You don't create effects by dragging media over an existing Effect Clip, you create effects by dragging them over an existing clip, layer or comp tab.

Does that explain things a bit?

leadedge
Hasn't felt like this about software in a long time
Posts: 104
Joined: Fri Feb 14, 2014 13:58

Re: FreeframeGL ShaderLoader

Post by leadedge »

Thanks Joris, that makes it clear.

Yes there are assumptions about the function of source or effect plugins. With this project, we are stretching the concepts of Freeframe but seem to be getting away with it so far.

I don't think there is any way around this where different shaders are loaded by the one plugin. Then as far as I can see, there is no choice but to create the plugin as FF_EFFECT. But where the plugin is specifically compiled for a particular shader of course the programmer can simply change FF_EFFECT or FF_SOURCE. I probably should document that.

But the essential problem was with dropping media OVER the plugin as noted by one user. If that is not a required method, and I didn't think it should be, then all is well. I will go over this again before making a correction to the code.

There is another symptom related to this. If the shader is generating the output and media is dropped on top, the shader output remains. I have confirmed that this is an effect/source issue, but fortunately if another effect plugin is dropped on top, it gets the output and processes it OK. Again if dropping media over a plugin is not a required method it shouldn't be a practical problem.

Thanks again for your explanation.

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: FreeframeGL ShaderLoader

Post by Joris »

different shaders are loaded by the one plugin
Whuuuut? :o Can you select different shaders at runtime from the same plugin?

leadedge
Hasn't felt like this about software in a long time
Posts: 104
Joined: Fri Feb 14, 2014 13:58

Re: FreeframeGL ShaderLoader

Post by leadedge »

Not sure what you mean Joris. ShaderLoader does load shaders at runtime but it is only for Windows. Amaury has something in mind for OSX but the idea is not formed yet.

The "ShaderMaker" project evolved from this so that people could create permanent plugins that don't rely on an external shader file. Is this what you mean or is there something else you have in mind?

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: FreeframeGL ShaderLoader

Post by Joris »

Ah yes, ShaderLoader is the one that loads a shader from a text file. Forgot about that one.

trekfan42
Is taking Resolume on a second date
Posts: 18
Joined: Thu Jan 19, 2017 17:32

Re: FreeframeGL ShaderLoader

Post by trekfan42 »

coould someone make a video on how to compile with ShaderMaker? i don't see how to load the source texture into it for binding

lightbx
Hasn't felt like this about software in a long time
Posts: 144
Joined: Thu Oct 29, 2015 21:05

Re: FreeframeGL ShaderLoader

Post by lightbx »

+1 on video tutorial for us n00bs

takehiko
Met Resolume in a bar the other day
Posts: 9
Joined: Wed Aug 04, 2010 17:14

Re: FreeframeGL ShaderLoader

Post by takehiko »

there is a little bug, when i save the shaderloader with a particular shader loaded, and save the composition, when i reopen the composition, the shader disappear

Post Reply