Render to Matrix via javascript with jit.gl.render quality 1


    May 31 2006 | 3:41 am
    Hello, I am trying to render to a matrix via javascript with the OS X software openGL rendering engine (works), but I cannot enable any FSAA/antialiasing, so my output looks .. well, very aliased.
    Ive searched the archives and noted JKC's note about enabling high quality (quality=1) to the jit.gl.render instance in the javascript. I have attempted to do so in the code below, but still get my aliased output.
    Could someone shed some light. Im pretty sure im doing something wrong, as my procedural coding is weak.
    Thanks, example patch and JS included below. BTW, Max 4.5.7, Jitter 1.5.2, OS X 10.4.6, QT 7.1. Yay acronyms.
    //// patch//
    ///////// js save as 2_Circle.js ////
    // setup a jitter openGL renderer to render to our simple_matrix var myRender = new JitterObject("jit.gl.render", "simple_matrix");
    // setup a jit.gl.sketch object that we will do our drawing with... var mySketch = new JitterObject("jit.gl.sketch", "simple_matrix");
    // our replacement for frameCount from Processing, our timer. var timer=0;
    myRender.quality=1; mySketch.depth_enable=0; mySketch.antialias=1;
    function bang() { // our jit.gl.render's rendering commands. myRender.erase();
    // our drawing routine we 'ported' from Processing.. draw();
    myRender.drawclients(); myRender.swap();
    // increment our timer... since we dont have a 'frameCount' like in processing timer++;
    // clear the command list for jit.gl.sketch, so we dont bog down over time. mySketch.reset(); }
    function draw() { mySketch.moveto(0.0, 0.0, 0.0); mySketch.glcolor(1,1,1,1);
    mySketch.glpushmatrix(); mySketch.glrotate(timer*0.1, 0,0, 1); mySketch.circle(0.5); mySketch.moveto(0.0, 0.05, 0.0); mySketch.glcolor(1,0,0,1); mySketch.circle(0.45); mySketch.glpopmatrix();
    }
    //////// end js /////////
    v a d e //
    www.vade.info abstrakt.vade.info

    • May 31 2006 | 9:37 pm
      Ah, I missed this message in the archives:
      Subject: Re: [max-msp] fsaa and offscreen rendering
      Which pretty much covers what I wanted to do. Seems the solution is simply to render to a higher res matrix and interpolate down. Oh well.
      v a d e //
      www.vade.info abstrakt.vade.info
    • May 31 2006 | 10:42 pm
      On May 30, 2006, at 8:41 PM, vade wrote:
      > Hello, I am trying to render to a matrix via javascript with the OS > X software openGL rendering engine (works), but I cannot enable any > FSAA/antialiasing, so my output looks .. well, very aliased.
      jit.gl.render @antialias, just refers to line antialiasing. What you want is multi-sampling for FSAA, which isn't currently exposed when rendering into RAM (since traditionally it hasn't been supported). However, multisampling is supported as of 10.4 and higher with Apple's slower, but higher quality software renderer, and we can look at adding this in a future version.
      In the meantime, and for all other platforms, I would recommend rendering at 4x resolution and perform an averaging downsample (which is what JSUI does). It might even be faster than the slow, but high quality Apple software renderer with multisampling enabled. I haven't tested.
      You can averaging downsample with the following chain jit.demultiplex- > jit.op @op avg-> jit.demultiplex @demultiplexdim 1->jit.op @op avg.
      Hope this helps.
      -Joshua
    • Jun 02 2006 | 4:42 am
      Hi. I humbly submit a potential solution for people wanting to render to a matrix via openGL but who have run into the same sorts of issues discussed in this thread. The following patch is a workaround using a hidden render context and GPU->Matrix readback via jit.gl.slab, and @capture to render geometry to a texture. The patch allows the use of antialiasing, and it seems like FSAA is working as well.
      Id love feedback (esp from the hardcore openGL folks). This may seem like an obvious way of doing it, but it was a eureka moment for me.. anyway Im particularly pleased with this solution, as it offers a lot of options. My reasoning for doing this is to be able to port some procedural drawing code written in Processing, render it using jit.gl.sketch and then play with it in 'matrix land'. Fun stuff.
      ---
      v a d e //
      www.vade.info abstrakt.vade.info