jit.gl.sketch matrixoutput attribute in Js

Mattebass's icon

Hello,
I'm trying to process in gen a scene generated in js using jit.gl.sketch, but I'm having problems in finding a way to pass the result of jit.gl.sketch to the outside of js object. I've tried different approaches, but without any result.
I've tried to render the jit.gl.sketch to a jit.matrix outside the js;
I've also tried to pass the result of jit.gl.sketch to a bit.matrix inside js using matrixoutput;
I've tried to use matrixoutput in js and sending outside the js jit.gl.sketch object.name;

Is there a way to accomplish this task?

Thanks in advance

Matteo

Max Patch
Copy patch and select New From Clipboard in Max.

sketchy_05.js
application/x-javascript 3.67 KB

Rob Ramirez's icon

your patch works as expected for me. you are using jit.gl.asyncread properly to send out a matrix capture of the scene from the JS to the containing patch, and processing with jit.gen.

My guess is that instead of sending the rendered pixels (what asyncread is outputing) you instead want the geometry vertices. unfortunately jit.gl.sketch does not support matrixoutput for this functionality. you will instead have to use the more traditional geometry objects (e.g. gridshape, plato, nurbs, model). Alternatively, jit.gen has internal operators that generate geometry for basic shapes:
circle : Equation of a circle taking input coordinates ranging from [0, 1]
cone : Equation of a cone taking input coordinates ranging from [0, 1]
cylinder : Equation of a cylinder taking input coordinates ranging from [0, 1]
plane : Equation of a plane taking input coordinates ranging from [0, 1]
sphere : Equation of a sphere taking input coordinates ranging from [0, 1]
torus : Equation of a torus taking input coordinates ranging from [0, 1]

if you do in fact want the rendered pixels of your sketch scene output from the JS, a better solution is to capture them with a jit.gl.node @capture 1, and send the texture output from that node out of the JS to be further processed with e.g. jit.gl.pix.

here's a little patch demonstrating that functionality in jit.gen:

Max Patch
Copy patch and select New From Clipboard in Max.

Mattebass's icon

Thanks, that solved my problems.
I'll try your suggestions
Have a nice day