GLSL shader follows mouse


  • Tech Staff

     
    A simple patch with a GLSL shader that follows 
    Getting now results with the new shaders, that before I thought I need processing, etc...

    1d06de-shader-follows-mouse.izz


  • Tech Staff

    @crystalhorizon

    looks great.
    Have you played around at all with the custom parameter inputs? Did you notice that many GLSL have XY settings (position) and can by mapped to mouse co-ordinates rather easily??
    I'm torn about learning GLSL.. its a serious undertaking, but its so damn awesome.

  • Tech Staff

    @DusX

    Yes I played around with the custom input parameters as shown by Mark at the Werkstatt in Berlin.
    It is really great to have that possibility.
    But finding the right parameters is sometimes like a lottery :-))


  • @crystalhorizon

    I really like the shader possibilities bat I agree with the "lottery" side of the process.
    Since Berlin I explored the possibilities and I compared with the Processing (the software) implementation of glsl shaders.
    I think in Isadora the problem is the limitation to fragment shader and the lack of possibilities to write program in the vertex shader. The fragment shader describe the reaction of each pixel on a surface to the texture and the light (quickly said), the vertex shader describe the place of the texture (also quickly said). In Processing you can access the both side of the process, in Isadora you have to struggle with fragment and that make very difficult the process of a real procedural design.
    So, please Mark, activate the vertex shader in Isadora, it would be very powerful.
    Jacques

  • Tech Staff

    @jhoepffner

    You can write custom Vertex Shaders as well.
    In the GLSL editor, click the 'Vertex Shader' radio button along the top, and the Vertex script is switched into view.
    I haven't used it, but its there. 


  • @DusX

    Yes I know it's here but it doesn't work. If I copy paste a working shader with vertex/fragment shader like in processing examples
    https://processing.org/tutorials/pshader/
    It works in Processing but not in Isadora. One page shaders work in the both app.
    I continue to explore it but for the moment its more trial and error. I need a more rational way to write shaders, like with JavaScript.
    All the best,
    Jacques

  • Tech Staff

    @DusX @jhoepffner

    I don't know anything about shaders but guess Jacques means that in processing you can use fragment and vertex shaders at the same time. Is this right?
    Best Michel


  • Yes, it's that. In Processing you put the vertex and fragment shader in the data folder and you declare it in the setup.

    pointShader = loadShader("pointfrag.glsl", "pointvert.glsl");
    The way to change parameters during run is similar to the Isadora way.
    The Processing tutorial is very good to explain how shaders are working.
    I think the actual idea in Isadora is to procure, as with shaders in Unity, a way to change the render of a Isadora processed image geometry, that the role of fragment shader.
    But you can also define and change the geometry with vertex shader as to implement procedural drawing in Isadora…
    You can do some procedural with fragment shaders as explained here
    https://thebookofshaders.com
    But its a little bit tricky calculation because you induce the color of a pixel by his position, using complicate formulas. I begin to obtain some result in that way but quickly it become very difficult to manage.
    But the opening with shader is really exciting!
    Jacques


  • Dear @jhoepffner,

    Well, vertex shaders definitely do work in Isadora, it's just that the Processing code may not work.
    On the page you listed https://processing.org/tutorials/pshader/, take note of this section:
    _"_**_Some uniform variables are automatically set by Processing_**_, such as transform, normalMatrix and lightNormal. The next section describes in detail the names of uniform and attribute variables that are automatically set by the Processing renderers."_
    Isadora does not set those variables, so any vertex shader that depends upon them will not work.
    The issue here is that every environment (e.g., Processing) is going to do some custom stuff like this. That means that not all code in those examples will work in Isadora. Certainly, you can file a feature request for me to implement this, and that would make sense given the popularity of Processing. But things like this are going to come up as people try more code from different environments.
    Take a look at the attached example file. The first scene has a very simply shader, that just paints a green square. The second one has a more complex vertex shader that creates a "brick wall" by coloring the bricks and mortar. Hopefully that will show that both the Fragment and Vertex shaders do in fact work.
    In the end, we want this new feature to work with as many platforms as possible. Adding the special uniforms from Processing should not be too difficult to do. But we need to get v2.5 out the door first. I'm sorry but the fix will not appear in the initial version of 2.5.
    Best Wishes,
    Mark

    bef4ae-vertex-shader-demo.izz



  • Dear @mark,

    Thank you for your very clear and helpful explanations. All is happening so quickly, that's difficult to understand what is coming from the glsl language, what is coming from software implementation and what from the programmer skills…
    I try hard to have a good understanding of how to proceed and tutorial are not so easy to find, often cryptic and adapted to particular circumstances.
    The prospect to have some similarities between Isadora and Processing concerning shaders would be a great opportunity, looking at the number of people practicing Processing, the quality of tutorials and the life of the forum.
    But I understand for sure it will not happen tomorrow… You make a great work and I thank one more time you and your staff for your work and in particular for the great time we had in Berlin.
    Best Wishes,
    Jacques

Log in to reply
 

Looks like your connection to TroikaTronix Community Forum was lost, please wait while we try to reconnect.