Create Dynamic OpenGL Scene Processing Chains


    Did you know that jit.gl.pass Jitter object can be used to create dynamic OpenGL scene processing chains?
    Jit.gl.pass can load jxs shader files and jit.gl.pix gen files to create custom effects for processing your OpenGL scenes. In this post, I want to show how simple it can be to load in an effect - and how to use jit.gl.pass objects for dynamic processing chains.
    In this example patch, we work with two built-in pass effects (bloom and motionblur) and a custom effect (rota) based on a shader. Let’s take a look at how it’s made:
    Jxp files, the format used by jit.gl.pass, load one or more jxs or jit.gl.pix gen files, which means you can use any of the shaders or jit.pix examples to get started; in this case, I used the td.rota.jxs shader that ships with Max.
    All I had to do was identify the primary attributes used to control the shader - anchor, offset, zoom, theta and boundmode - and use the bind name method to wrap them into the jxp format.
    You can double-click the object to see and edit the code directly - it looks like this:
    Once the file is made, you just save it as a jxp file. When save the file to a location in your search path you can load it into your jit.gl.pass objects any time.
    For a more detailed description of creating your own effects, you can refer to the “pass.custom.effects.maxpat” file in the Jitter examples. Hint: Search the file browser for jxs and genjit files to get a sense of what’s possible.
    Now let’s look at chaining the effects together. The usual method of binding the middle outlet of one pass object to the next is powerful and convenient, it results in fixed signal processing chains and requires your objects to live on the same patcher level.
    I recently began exploring a way of opening up the signal flow to enable use in multi-patcher and modular environments. By explicitly naming the jit.gl.pass objects and using the @child and @layer attributes, you can bypass the middle outlet connection and open up a lot of different terrain. The result of starting with rota, applying bloom and then a blur yields very different results than reversing the order.
    While it takes some more effort to configure at the start, the ability to change the order of your effects on the fly gives you the opportunity to explore a wide range of permutations without having to reprogram for each possibility.
    If you haven’t already, download and open up the patch to see how much of a difference the processing order can make.

    • Jun 16 2016 | 6:05 pm
      it crashes Max instantly when i bang to commit the change with this chain : bloom 1st, blur 2d, rota 3rd
    • Jun 28 2016 | 10:17 am
      Great article.
      But Max also crashes if you turn off one of the effects so that less than a total of 3 cells are selected.
      Looks like matrixctrl could use another attribute (in addition to @one/row and @one/column) that prevents you from turning off all the cells in a row or column (that is, if a cell is on, you wouldn't be able to click it off by clicking on it).
    • Jun 28 2016 | 7:00 pm
      There seem to be various problems switching the order of the passes on the fly - I've been getting various crashes and freezes, as well as this error:
      jit.gl.node: capture cannot be changed when bound to jit.gl.pass.
      However, if I make sure to:
      A) set enable 0 on all jit.gl.passes B) remove all child references on all passes C) reorder layers & specify parent/child relationships D) set enable 1 on all jit.gl.passes
      everything seems to be OK (so far).
    • Jul 21 2016 | 3:16 pm
      Ditto on crashes. Stage 2 and then Commit (Stage 3) crashes max. I think this was noted elsewhere in another thread.
    • Sep 28 2016 | 3:39 pm
      I am not sure why using gl.pass over gl.pix or gl.slab It's possible to chain effects with either of these gl objects
      I'm reading documentation and the logic of using one or another isn't clear to me.
      Someone has a synthesis explanation?
    • Sep 28 2016 | 4:34 pm
      good question. the best information on the technical aspects of jit.gl.pass is the Discussion section of the object's reference page. https://docs.cycling74.com/max7/maxobject/jit.gl.pass
      there's nothing that can't be done using one or more gl.slab/pix objects. it is simply another format for creating multipass texture effects, and may or may not be more convenient for you.
      for example, below is a side by side comparison of the bloom effect, jit.gl.pass vs no jit.gl.pass. and this is one of the most basic of the built-in pass effects.
      i think the real power of this object comes with how easy it is to access multiple render target outputs (as described in the reference file linked above).
    • Oct 15 2016 | 2:18 am
      Hey thanks Rob
      Sorry for late answer! Car accidents can put your life upside down!
      Great comparison patch! Very useful! From what I understand Gl.pass is a way to "condense" code I mean assemble all the steps of multiple shaders "receipe" together.
      Would you have a patch showing many different render targets?
      Like in this jxp code I understand that the cf.edgedetect.jxs targets the COLOR of the image and multiply.jxs only of the COLOR of the PREVIOUS image? I guess another .jxs could be applied on the TEXTURE like lumadisplace ?
      Next question Is there a step-by-step tutorial on how to create a .jxp?
      MHP
    • Oct 16 2016 | 1:02 pm
      The crash seems related to NVidia drivers: http://pastebin.com/ugJY2hLJ
      { "version" : "Version 7.3.0 (535a4d8) (64-bit mac)", "platform" : "mac", "arch" : "x64", "osversion" : "Mac OS X Version 10.9.5 x86_64", "samplerate" : 48000, "iovs" : 512, "sigvs" : 512, "scheduler_in_audio_interrupt" : "off", "audio_drivername" : "Core Audio", "audio_driver_subname" : "", "license" : "permanent full", "machine_id" : "8c3d6ad9edab1412421ef6b2efe8f3f9", "eventinterval" : 2, "overdrive" : "on", "mixerparallel" : "on", "mixercrossfade" : 0, "mixerlatency" : 30.0, "mixerramptime" : 10.0, "videoengine" : "viddll", "packages" : { "Max" : { "name" : "Max", "domain" : 1, "domains" : 1 } , "MSP" : { "name" : "MSP", "domain" : 1, "domains" : 1 } , "Jitter" : { "name" : "Jitter", "domain" : 1, "domains" : 1 } , "Max for Live" : { "name" : "Max for Live", "domain" : 1, "domains" : 1 } , "Gen" : { "name" : "Gen", "domain" : 1, "domains" : 1 } , "BEAP" : { "author" : "Matthew Davidson, Peter McCulloch", "description" : "BEAP (Berklee Electro Acoustic Pedagogy) Modular is a synthesis pedagogical tool.", "displayname" : "", "extends" : "", "extensible" : 1, "homepatcher" : "", "max_version_max" : "none", "max_version_min" : "6.1.10", "name" : "BEAP", "os" : { "macintosh" : { "platform" : [ "ia32", "x64" ], "min_version" : "none" } , "windows" : { "platform" : [ "ia32", "x64" ], "min_version" : "none" }
      } , "version" : "1.0.0", "website" : "https://github.com/stretta/BEAP/wiki", "domain" : 32, "domains" : 32 } , "max-mxj" : { "author" : "Cycling '74", "description" : "Max Java Support", "displayname" : "", "extends" : "", "extensible" : 0, "homepatcher" : "", "max_version_max" : "none", "max_version_min" : "7.2.5", "name" : "max-mxj", "os" : { "macintosh" : { "platform" : [ "ia32", "x64" ], "min_version" : "none" } , "windows" : { "platform" : [ "ia32", "x64" ], "min_version" : "none" }
      } , "version" : "7.2.5", "website" : "https://cycling74.com", "domain" : 32, "domains" : 32 } , "MaxDefaultContent" : { "name" : "MaxDefaultContent", "domain" : 32, "domains" : 32 } , "MaxIntroLessons" : { "name" : "MaxIntroLessons", "domain" : 32, "domains" : 32 } , "Mira" : { "name" : "Mira", "author" : "Cycling '74", "description" : "Mira automatically connects to Max and mirrors your interface.", "version" : "1.1.8", "domain" : 32, "domains" : 32 } , "VIDDLL" : { "author" : "Rob Ramirez", "description" : "The VIDDLL package installs a Jitter video engine adapter for jit.movie, allowing file playback via the VIDDLL library.\n\nVIDDLL is an interface and set of utilities for cross platform, high performance, random access video playback. VIDDLL is copyright Paul Bamborough and Julian Storer. \n\nThis software uses code of FFmpeg - http://ffmpeg.org - licensed under the LGPLv2.1 - http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html - and its source can be downloaded here - https://cycling74.s3.amazonaws.com/download/ffmpeg-3.0.2.tar.gz", "displayname" : "", "extends" : "", "extensible" : 0, "homepatcher" : "", "max_version_max" : "none", "max_version_min" : "7.1", "name" : "VIDDLL", "os" : { "macintosh" : { "platform" : [ "ia32", "x64" ], "min_version" : "10.9.x" } , "windows" : { "platform" : [ "ia32", "x64" ], "min_version" : "7" }
      } , "version" : "1.0.6", "website" : "https://cycling74.com", "domain" : 32, "domains" : 36 } , "Video and Graphics" : { "author" : "Cycling '74", "description" : "Video and Graphics programming tutorials", "displayname" : "", "extends" : "", "extensible" : 0, "homepatcher" : "", "max_version_max" : "none", "max_version_min" : "7.2", "name" : "Video and Graphics", "os" : { "macintosh" : { "platform" : [ "ia32", "x64" ], "min_version" : "none" } , "windows" : { "platform" : [ "ia32", "x64" ], "min_version" : "none" }
      } , "version" : "7.2.0", "website" : "https://cycling74.com", "domain" : 32, "domains" : 32 } , "Vizzie" : { "author" : "Cycling '74", "description" : "With VIZZIE, you just grab a few simple modules, connect them together and almost instantly have a VJ rig or interactive video work, complete with real-time effects.", "displayname" : "", "extends" : "", "extensible" : 1, "homepatcher" : "", "max_version_max" : "none", "max_version_min" : "6.1.10", "name" : "Vizzie", "os" : { "macintosh" : { "platform" : [ "ia32", "x64" ], "min_version" : "none" } , "windows" : { "platform" : [ "ia32", "x64" ], "min_version" : "none" }
      } , "version" : "1.0.2", "website" : "https://cycling74.com/articles/introducing-vizzie/", "domain" : 32, "domains" : 32 } , "bach" : { "author" : "Andrea Agostini and Daniele Ghisi", "description" : "bach: automated composer's helper - a library for real-time computer-assisted composition", "displayname" : "", "extends" : "", "extensible" : 0, "homepatcher" : "bach.overview.maxpat", "max_version_max" : "none", "max_version_min" : "6.1", "name" : "bach", "os" : { "macintosh" : { "platform" : [ "ia32", "x64" ], "min_version" : "10.7.x" } , "windows" : { "platform" : [ "ia32", "x64" ], "min_version" : "none" }
      } , "version" : "0.7.9", "website" : "http://www.bachproject.net", "domain" : 4, "domains" : 4 } , "CNMAT Externals" : { "author" : "CNMAT", "description" : "A collection of Max tools created by researchers at CNMAT in Berkeley, CA.", "displayname" : "", "extends" : "", "extensible" : 0, "homepatcher" : null, "max_version_max" : "none", "max_version_min" : "none", "name" : "CNMAT Externals", "os" : { "macintosh" : { "platform" : [ "ia32", "x64" ], "min_version" : "10.7.x" } , "windows" : { "platform" : [ "ia32" ], "min_version" : "7" }
      } , "version" : "1.0.1", "website" : "http://cnmat.berkeley.edu", "domain" : 4, "domains" : 4 } , "cv.jit" : { "author" : "Jean-Marc Pelletier", "description" : "A collection of max/msp/jitter externals, abstractions and help files for computer vision applications originally authored by Jean-Marc Pelletier.", "displayname" : "", "extends" : "", "extensible" : 0, "homepatcher" : "cv.jit-Object Guide.maxpat", "max_version_max" : "none", "max_version_min" : "none", "name" : "cv.jit", "os" : { "macintosh" : { "platform" : [ "ia32", "x64" ], "min_version" : "none" } , "windows" : { "platform" : [ "ia32", "x64" ], "min_version" : "none" }
      } , "version" : "1.8.0", "website" : "http://www.maxology.club/starter-kit-info/2015/4/27/starter-kit-1", "domain" : 4, "domains" : 4 } , "ejies" : { "author" : "Emmanuel Jourdan", "description" : "ejies is a collection of abstractions utilities, digital signal processing, JavaScripts and Java tools.", "displayname" : "", "extends" : "", "extensible" : 0, "homepatcher" : "ejies-overview.maxpat", "max_version_max" : "none", "max_version_min" : "6.1.10", "name" : "ejies", "os" : { "macintosh" : { "platform" : [ "ia32", "x64" ], "min_version" : "10.7.x" } , "windows" : { "platform" : [ "ia32", "x64" ], "min_version" : "7" }
      } , "version" : "3.2.4", "website" : "http://www.e--j.com", "domain" : 4, "domains" : 4 } , "FedFod" : { "name" : "FedFod", "domain" : 4, "domains" : 4 } , "ForumMaxApps-All" : { "name" : "ForumMaxApps-All", "domain" : 4, "domains" : 4 } , "FTM.2.6.0.BETA-Max6-7" : { "name" : "FTM.2.6.0.BETA-Max6-7", "domain" : 4, "domains" : 4 } , "Gen CV Tools" : { "author" : "Spektro Audio", "description" : "A collection of gen patches focused on generating different kinds of control voltage (CV) signals that can be used to control analog / modular synthesizers as well as other Max patches.", "displayname" : "", "extends" : "", "extensible" : 0, "homepatcher" : "_SpektroAudio-OverView.maxpat", "max_version_max" : "none", "max_version_min" : "7.0", "name" : "Gen CV Tools", "os" : { "macintosh" : { "platform" : [ "ia32", "x64" ], "min_version" : "none" } , "windows" : { "platform" : [ "ia32", "x64" ], "min_version" : "none" }
      } , "version" : "1.0.0", "website" : "http://spektroaudio.com/", "domain" : 4, "domains" : 4 } , "Gesture&Sound-2015-06-OSX" : { "name" : "Gesture&Sound-2015-06-OSX", "domain" : 4, "domains" : 4 } , "HoaLibrary-Mac-v2.2" : { "name" : "HoaLibrary-Mac-v2.2", "domain" : 4, "domains" : 4 } , "imp.dmx" : { "name" : "imp.dmx", "author" : "David Butler", "description" : "imp.dmx is a cross-platform collection of Max/MSP/Jitter abstractions for dealing with DMX data in various forms.", "version" : "0.5", "website" : "http://www.theimpersonalstereo.com/software/imp-dmx", "domain" : 4, "domains" : 4 } , "ircam-spat" : { "name" : "ircam-spat", "description" : "software suite for spatialization of sound signals in real-time", "author" : "Ircam Centre Pompidou", "homepatcher" : "Ircam Spat Overview.maxpat", "max_version_max" : "none", "max_version_min" : "6.1.4", "os" : { "macintosh" : { "platform" : [ "ia32", "x64" ], "min_version" : "10.7.x" } , "windows" : { "platform" : [ "ia32", "x64" ], "min_version" : "7" }
      } , "version" : "4.9.0", "website" : "http://www.forumnet.ircam.fr/product/spat-en/", "domain" : 4, "domains" : 4 } , "Jitter Recipes" : { "author" : "Andrew Benson", "description" : "A growing collection of Jitter examples including video synths, OpenGL graphics, video feedback, live visuals, and more. Discover what you can cook up with Jitter and expand your repertoire.", "displayname" : "", "extends" : "", "extensible" : 0, "homepatcher" : "Jitter Recipes Launch.maxpat", "max_version_max" : "none", "max_version_min" : "6.1", "name" : "Jitter Recipes", "os" : { "macintosh" : { "platform" : [ "ia32", "x64" ], "min_version" : "10.7.x" } , "windows" : { "platform" : [ "ia32", "x64" ], "min_version" : "XP" }
      } , "version" : "0.1.1", "website" : "https://cycling74.com/category/articles/jitter-recipes/", "domain" : 4, "domains" : 4 } , "jpb-0.0.5" : { "name" : "jpb-0.0.5", "domain" : 4, "domains" : 4 } , "karma" : { "author" : "Rodrigo Constanzo and raja", "description" : "A dynamically lengthened varispeed record/playback looper with complex functionality.", "displayname" : "karma", "extends" : "", "extensible" : 0, "homepatcher" : "karma_overview.maxpat", "max_version_max" : "none", "max_version_min" : "none", "name" : "karma", "os" : { "macintosh" : { "platform" : [ "ia32", "x64" ], "min_version" : "none" } , "windows" : { "platform" : [ "ia32", "x64" ], "min_version" : "none" }
      } , "version" : "1.0.0", "website" : "http://www.rodrigoconstanzo.com/karma", "domain" : 4, "domains" : 4 } , "LowkeyNW" : { "author" : "Nathan Wolek", "description" : "Contains updated objects from the Granular Toolkit, a classic stereo reverb and some twists on standard MSP objects that makes them savvy about zero-crossings. ", "displayname" : "", "extends" : "", "extensible" : 0, "homepatcher" : "LowkeyNW-Overview.maxpat", "max_version_max" : "none", "max_version_min" : "none", "name" : "LowkeyNW", "os" : { "macintosh" : { "platform" : [ "ia32", "x64" ], "min_version" : "none" } , "windows" : { "platform" : [ "ia32", "x64" ], "min_version" : "none" }
      } , "version" : "1.1.1", "website" : "http://www.nathanwolek.com", "domain" : 4, "domains" : 4 } , "MaxSoundBox-2014-11-Max-6-7" : { "name" : "MaxSoundBox-2014-11-Max-6-7", "domain" : 4, "domains" : 4 } , "Max ToolBox" : { "name" : "Max ToolBox", "author" : "Nathanaël Lécaudé", "description" : "The Max ToolBox is a tool that simplifies some aspects of patching within the Max/MSP environment.", "version" : "15", "website" : "https://github.com/natcl/maxtoolbox", "domain" : 4, "domains" : 20 } , "mixer-0.0.2" : { "name" : "mixer-0.0.2", "domain" : 4, "domains" : 4 } , "modalys" : { "name" : "modalys", "domain" : 4, "domains" : 4 } , "MuBuForMax" : { "name" : "MuBuForMax", "author" : "ISMM Team @ Ircam", "description" : "MuBu: multi-buffer container for sound and motion data.", "homepatcher" : "MuBu-Overview.maxpat", "max_version_max" : "none", "max_version_min" : "6.1.7", "os" : { "macintosh" : { "platform" : [ "ia32", "x64" ], "min_version" : "10.7.x" } , "windows" : { "platform" : [ "ia32", "x64" ], "min_version" : "7" }
      } , "version" : "1.8.12", "website" : "http://ismm.ircam.fr/mubu/", "domain" : 4, "domains" : 4 } , "odot" : { "name" : "odot", "domain" : 4, "domains" : 4 } , "PGS-1" : { "author" : "Cycling '74", "description" : "From the dark days of Pluggo comes the big fat sound of PGS-1, fully updated with support for MPE controllers.", "displayname" : "", "extends" : "", "extensible" : 0, "homepatcher" : "PGS1-Overview.maxpat", "max_version_max" : "none", "max_version_min" : "7.2", "name" : "PGS-1", "os" : { "macintosh" : { "platform" : [ "ia32", "x64" ], "min_version" : "none" } , "windows" : { "platform" : [ "ia32", "x64" ], "min_version" : "none" }
      } , "version" : "0.0.5", "website" : "https://cycling74.com", "domain" : 4, "domains" : 4 } , "Rand" : { "name" : "Rand", "domain" : 4, "domains" : 4 } , "smFilterPack" : { "author" : "Surreal Machines", "description" : "gen~ audio filters for the masses", "displayname" : "", "extends" : "", "extensible" : 0, "homepatcher" : "smFilterPack_Overview.maxpat", "max_version_max" : "none", "max_version_min" : "7.0.5", "name" : "smFilterPack", "os" : { "macintosh" : { "platform" : [ "ia32", "x64" ], "min_version" : "10.7.x" } , "windows" : { "platform" : [ "ia32", "x64" ], "min_version" : "7" }
      } , "version" : "0.0.3", "website" : "http://www.surrealmachines.com", "domain" : 4, "domains" : 4 } , "SuperVPMaxMSP-2015-11-OSX-Max-6-7" : { "name" : "SuperVPMaxMSP-2015-11-OSX-Max-6-7", "domain" : 4, "domains" : 4 } , "Syphon" : { "author" : "Tom Butterworth, Anton Marini", "description" : "Jitter externals for sharing OpenGL textures with Syphon enabled applications. Mac only, for similar functionality on Windows, check out the Spout package.", "displayname" : "", "extends" : "", "extensible" : 0, "homepatcher" : null, "max_version_max" : "none", "max_version_min" : "6.1", "name" : "Syphon", "os" : { "macintosh" : { "platform" : [ "ia32", "x64" ], "min_version" : "10.7.x" } , "windows" : { "platform" : [ ], "min_version" : "none" }
      } , "version" : "1.0.3", "website" : "http://syphon.v002.info", "domain" : 4, "domains" : 4 } , "uPattr" : { "name" : "uPattr", "domain" : 4, "domains" : 4 } , "XRAY" : { "author" : "Wesley Smith", "description" : "A collection of useful Jitter utility objects for working with data, geometry, and video. Includes objects for quick sorting, contour mapping, water simulation, and more.", "displayname" : "", "extends" : "", "extensible" : 0, "homepatcher" : "XRAY Launch.maxpat", "max_version_max" : "none", "max_version_min" : "7.0", "name" : "XRAY", "os" : { "macintosh" : { "platform" : [ "ia32", "x64" ], "min_version" : "10.7.x" } , "windows" : { "platform" : [ "ia32", "x64" ], "min_version" : "7" }
      } , "version" : "1.0.1", "website" : "http://www.mat.ucsb.edu/whsmith/xray.html", "domain" : 4, "domains" : 4 } , "zsa.descriptors" : { "author" : "Mikhail Malt, Emmanuel Jourdan", "description" : "Zsa.descriptors is a library for real-time sound descriptors analysis for Max.", "displayname" : "", "extends" : "", "extensible" : 0, "homepatcher" : "zsa.overview.maxpat", "max_version_max" : "none", "max_version_min" : "7.0.6", "name" : "zsa.descriptors", "os" : { "macintosh" : { "platform" : [ "ia32", "x64" ], "min_version" : "10.7.x" } , "windows" : { "platform" : [ "ia32", "x64" ], "min_version" : "7" }
      } , "version" : "1.1.1", "website" : "http://www.e--j.com/index.php/what-is-zsa-descriptors/", "domain" : 4, "domains" : 4 } , "µK Bundle" : { "author" : "K-Devices", "description" : "A small pack of Max for Live devices from K-Devices. Includes µEXT, µKflux, and µVIMO", "displayname" : "", "extends" : "", "extensible" : 0, "homepatcher" : "µK Bundle Intro.maxpat", "max_version_max" : "none", "max_version_min" : "7.0", "name" : "µK Bundle", "os" : { "macintosh" : { "platform" : [ "ia32", "x64" ], "min_version" : "10.7.x" } , "windows" : { "platform" : [ "ia32", "x64" ], "min_version" : "7" }
      } , "version" : "0.0.0", "website" : "http://k-devices.com/", "domain" : 4, "domains" : 4 } , "jit.gl.hap" : { "name" : "jit.gl.hap", "author" : "Rob Ramirez", "description" : "Provides native Hap codec support.", "version" : "1.3", "website" : "https://cycling74.com/tools/jit-gl-hap/", "domain" : 16, "domains" : 16 }
      }
      }
    • Oct 17 2016 | 3:07 pm
      hey guys, i'll be investigating a fix for this crash for the next update. thanks for the reports.