I'll just leave this here...
-
-
Is it possible to have multiple shader-panels in one interface?
-
Yes, you can even have multiple shaders per panel.
-
Content.makeFrontInterface(600, 500); const var Panel1 = Content.getComponent("Panel1"); const var Panel2 = Content.getComponent("Panel2"); const var shader = Content.createShader("shader"); shader.setFragmentShader("shader.glsl"); const var shader2 = Content.createShader("shader2"); shader2.setFragmentShader("shader2.glsl"); Panel1.setPaintRoutine(function(g) { g.applyShader(shader, [0, 0, this.getWidth(), this.getHeight()]); }); Panel2.setPaintRoutine(function(g) { g.applyShader(shader2, [0, 0, this.getWidth(), this.getHeight()]); });
Something along those lines?
-
Yes, but you don't need the
setFragmentShader
calls, if you create a shader it automatically compiles it (the call is only required if you want to change the code dynamically). -
oh and you can use
this.getLocalBounds(0)
instead of[0, 0, this.getWidth(), this.getHeight()]
. Less typing, more fun. -
@Christoph-Hart Got it! It's pretty crazy really... Mind blown... π€―
So far my compiled plugin crashes (some GL problems) when I open it...
and...
somehow both shaders react to the sliders on the ui... even though only one shader has these inputs...lots to learn...
-
@Christoph-Hart Is it possible to send values from shaders back to the onInit???
I understand how I can add a uniform float and influence it with a knob, panel, timer, etc... but can I do the same thing backwards from a shader variable?
I hope that makes sense...
-
No, it's a unidirectional communication and the uniform variables are read only in GLSL - it will be accessed by each pixel calculation so it can't change.
-
@Christoph-Hart How is iTime related to timer objects in HISE?
I have a synth timer running in my instrument and the shader panel just runs along with it although I don't pass it anything...
Also when I drag a knob the shader starts moving along. Without me setting up a callback that passes a uniform variable into it...
Got me thinking that maybe a knob also runs on an internal timer-like object... π€―EDIT: It seems like iTime is always running... also while editing the shader keeps changing in the background and visually only shows updates when hovering over UI elements and interacting with them. When I hit compile it catches up with iTime and all is in sync again...
-
Maybe I should hit the screensaver business after all...
Hoping to pass the obligatory psychedelically-influenced first phase of shader coding soon to produce more meaningful and interesting stuff...
-
Yeah, I've been there too. The moment where you stare at a real screensaver and think "Wow that's really beautiful, I wonder how they programmed that" is the moment you need to reevaluate some life choices :)
But have you started playing around with 3D ray marching? That's where the real fun begins :)
-
@Christoph-Hart I wanted to dive in shaper code, but I find the code style just :face_vomiting:
So I postpone this moment the more I can and push even more the panel's paintRoutine in the waiting -
@ustk said in I'll just leave this here...:
code style just
What do you dislike there? I quickly got used to it (GLSL is C-like so at least there's no Lua madness involved and once you've wrapped your head around how it works (it's really different from the 2D canvas approach), you'll start enjoying it.
-
@Christoph-Hart Yeah I imagine I have to get used to it :)
I don't like the fact there're no ready methods for drawing basic stuff, even for a circle you have to make your own method. But it makes it powerfull :) -
@Christoph-Hart said in I'll just leave this here...:
@ustk said in I'll just leave this here...:
code style just
What do you dislike there? I quickly got used to it (GLSL is C-like so at least there's no Lua madness involved and once you've wrapped your head around how it works (it's really different from the 2D canvas approach), you'll start enjoying it.
That it deviates from the 2D Canvas is what mainly gets my brain twisted!! Itβs exactly that. I was so lost at first. Now that the panic attacks and the eye bleedings are residing, I am getting more and more into it. Following Martijnβs tutorials over and over again, making notes, messing with some numbers in the code and finally doing it yourself from scratch will get you there eventually. Funny that Martijn learned it from studying Shadertoy examples himselfβ¦ Raymarching is on the list, yesβ¦ Deeply fascinated by what a bunch of numbers and words can generate!
-
@ustk said in I'll just leave this here...:
ready methods for drawing basic stuff
This website is by far the best resource for code examples for GLSL primitives:
https://www.iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
-
@Christoph-Hart Yeah I've just seen that finally, one can find many ready-made methods :)
Once the principle is understood it becomes easy to adapt/modify -
And there is this thing here:
https://www.shadertoy.com/view/lslXW8
It's basically a 2D Graphics API for GLSL. I played around with it and it might ease the transition coming from the Panel Graphics API.
-
I think you could introduce a question for those signing up. You already have to manually approve them, but something like what VI-C has could reduce the number of these spammers. "What do you call an audio file played back by a virtual instrument?"