ISF-Shaders in MadMapper
  • woodwindblues
    junior Member
    Posts: 4
    Joined: Sun Jan 30, 2022 8:33 pm

    ISF-Shaders in MadMapper

    by woodwindblues » Sun Jan 30, 2022 9:27 pm

    Hello,

    I am new to MadMapper and, since I started working with custom shaders, very interested in it's capability in that part. So far I worked with GLSL shaders only, but after looking through the ISF Docs, I managed to port a few shaders to MadMapper. I am still having a few problems, though. Are there any docs specifically for the ISF syntax in MadMapper? For example, if I use the ISF generated RENDERSIZE, this is not the material-size in MadMapper, but the size of the whole render window. If I use texCoord to call the main function (like materialColorForPixel suggests), only a small fraction of the shader gets rendered. If I use gl_FragCoord, the shader gets rendered properly, but it seems to get rendered "behind" the screen and the Quads act as a kind of mask.

    Here you can see me comparing the behaviour of the MadMapper Clouds Material (works as expected) with two shaders I ported from shadertoy (weird mask-behaviour):
    https://imgur.com/a/rsVSYtr
  • mad-matt
    garageCube team
    Posts: 1275
    Joined: Mon Sep 09, 2013 5:50 pm

    Re: ISF-Shaders in MadMapper

    by mad-matt » Mon Jan 31, 2022 11:12 am

    Hi,
    Materials documentation is available in MadMapper help menu.
    if I use the ISF generated RENDERSIZE, this is not the material-size in MadMapper, but the size of the whole render window
    Indeed, in MadMapper materials are rendered directly on screen, so for a quad, it might be i perspective, with mesh warping etc. So using RENDERSIZE would make no sense. You should use "texCoord".
    If I use texCoord to call the main function (like materialColorForPixel suggests), only a small fraction of the shader gets rendered
    texCoord is from 0,0 to 1,1. Maybe your code expects -1,-1 - 1,1.
    If I use gl_FragCoord, the shader gets rendered properly, but it seems to get rendered "behind" the screen
    Indeed, don't use it. gl_FragCoord is the position on the screen, unrelated to surface/input rect etc. Use texCoord ;-)
  • woodwindblues
    junior Member
    Posts: 4
    Joined: Sun Jan 30, 2022 8:33 pm

    Re: ISF-Shaders in MadMapper

    by woodwindblues » Wed Feb 02, 2022 11:40 pm

    Hi,
    Materials documentation is available in MadMapper help menu.
    if I use the ISF generated RENDERSIZE, this is not the material-size in MadMapper, but the size of the whole render window
    Indeed, in MadMapper materials are rendered directly on screen, so for a quad, it might be i perspective, with mesh warping etc. So using RENDERSIZE would make no sense. You should use "texCoord".
    If I use texCoord to call the main function (like materialColorForPixel suggests), only a small fraction of the shader gets rendered
    texCoord is from 0,0 to 1,1. Maybe your code expects -1,-1 - 1,1.
    If I use gl_FragCoord, the shader gets rendered properly, but it seems to get rendered "behind" the screen
    Indeed, don't use it. gl_FragCoord is the position on the screen, unrelated to surface/input rect etc. Use texCoord ;-)
    Thanks for your reply! It helped me figured out that the shaders where expecting unnormalized coordinates, so texCoord * RENDERSIZE did the trick. Now they behave as expected.
  • woodwindblues
    junior Member
    Posts: 4
    Joined: Sun Jan 30, 2022 8:33 pm

    Re: ISF-Shaders in MadMapper

    by woodwindblues » Thu Feb 03, 2022 1:39 am

    I actually have another question regarding ISF-Shaders: Since MadMapper does not support multiple passes and ISF implements buffers as a type of multiple passes, how can I use buffers (to save data for the next frame) in MadMapper? The documentation mentions buffers in the section of generators but it does not really make clear how to use them to save a value for the next frame. Can I use the pass thru generator for that?
    {
    "NAME": "new_value",
    "TYPE": "pass_thru",
    "PARAMS": {"input_value":"old_value"}
    }

    //increase value by 1 each frame
    new_value = old_value + 1,0;

    Like this?
  • mad-matt
    garageCube team
    Posts: 1275
    Joined: Mon Sep 09, 2013 5:50 pm

    Re: ISF-Shaders in MadMapper

    by mad-matt » Thu Feb 03, 2022 1:03 pm

    Hi,
    There's no solution in MM 5.0 for keeping values from one frame to another. A shader only writes to pixels, you cannot modify a shader "uniform" variable inside a shader.
    But we did something for MM 5.1: when you activate "Render To Texture" you can access last frame data. I PM a MadMapper 5.1 build with the feature. Documentation is up to date in there.
    Cheers
    Matthieu - MM team
  • woodwindblues
    junior Member
    Posts: 4
    Joined: Sun Jan 30, 2022 8:33 pm

    Re: ISF-Shaders in MadMapper

    by woodwindblues » Fri Feb 04, 2022 8:09 pm

    Hi,
    There's no solution in MM 5.0 for keeping values from one frame to another. A shader only writes to pixels, you cannot modify a shader "uniform" variable inside a shader.
    But we did something for MM 5.1: when you activate "Render To Texture" you can access last frame data. I PM a MadMapper 5.1 build with the feature. Documentation is up to date in there.
    Cheers
    Matthieu - MM team
    Thank you so much!

    Are there any plans beyond that to support multipass shaders at some point? I get that they would be to resource hungry for complicated mappings with a lot of elements, but for projects where the mapping is not that elaborate it could be really useful and less resource intensive than having another application run the multipass shader and feed it to madmapper.
  • jasonbeyers
    activ8 member
    Posts: 98
    Joined: Mon Oct 08, 2018 7:16 am

    Re: ISF-Shaders in MadMapper

    by jasonbeyers » Sun Feb 06, 2022 3:46 am

    +1 for multi-pass shaders! This would be a wonderful thing for materials and surface FX, in addition to just ISFs :)

    Some prior discussion here on the forums: https://forum.garagecube.com/viewtopic. ... ass#p58965

    I've been learning touchdesigner for this very reason, but it would be amazing if Madmapper could do it natively. So many possibilities (including things like reaction diffusion).

    Have also been looking at Resolume + Wire, since they added multi-pass ISF support in wire, a few months back.

    But every time I use those other programs, I miss the power & simplicity of Madmapper's workflow & cue system.

Who is online

Users browsing this forum: No registered users and 1 guest