dest_dim of jit.gl.node @capture 1
I am trying to update my rendering pipeline from jit.gl.sketch’s drawobject to jit.gl.node and jit.gl.camera. They seem to be very simple and powerful but I cannot figure out several things. I suspect that they are bugs but I am not sure as the documentation about them is not yet very complete… :) Or maybe I use the objects in a unexpected combination.
All can be seen in the patcher below. There is a sub-context created using jit.gl.node and a jit.gl.camera is attached to it. The sub-context is captured to a texture with a fixed size.
1) The dest_dim attribute of jit.gl.node cannot be changed and is taken from the dimensions of the main context’s window. Why is that so? Is there any way to change it?
2) Is there any way to change the aspect ratio in the jit.gl.camera?
Thanks for any help!
-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 1201.3oc0ZtsaahDFG+ZGo7NLxW6hlSL.6UtOGUQVXXpCsvfWX7lzsZe224. 3335C33gCQJIHCCl+7iuyje+3Cylut7Ud8bveA9FX1req1yLy9z6YV6NlMuH 90j73ZyBmGKkU6xlun4XeuTHEwEbyw9ZUVb99CI1UTtSlyklSD0t6rTyZKW+ iuPP6Wrckxeskaky74fmN7ZTm8ulifvdv18qkh465ex3ursrRt+aaarL44Lw lUU7Do8KjRTmH.Evzav9glMPO3aWFkdyD6kqYm+2iOn2p1rXb.DwM.JNMd6E oCBFY.Bi5AYnHejBU9vOGLB6FFklUbIBEQMzfpNUJiRCU.JD8o.PXla.DuJt luJoLur5RfhYnBJR4gg7oggedrjvNJbTNWTuJVrImeINEXCAooBAFE32ubRv eQcKtWOR9qFYL+GYRuM4dIJlUECpS3BNX4AOoAPOl5W8OHOvx2t0.9DODAhf zaG93S.ezEB0oD4pM4qzhdWkBpc5wwYyAnDsYSHt2ncRYQAWH+Sbqzu.TJ.x m4f+tfKqJAwhTfr5WfJt5tPoWywdISjV9x9yOOSvSJ2Ijuidcl2vSvaZz7O. AY3.a9Sa1TqAKg1CHrfWWGug+mHTqT.ACUwhgtwumdeAHOElHlxL7sFbglOf BOKkvtmRa3Vs5F.QcMf7CL1QTaJTZzvCHU5dfOBq+0Q0g.cMjZBWwLwor.af YDuVtRCJm5tgct0DEZc2rEwhvAih+VKsbCkPgtlR3HqyFwXVEzeAkbZ08gNp 59ie3b1JWoHnkLnAuXr7x3z0ppqbD5BNO5LWk6HnD1W+WF7yNhX8AhBnF5Po 8MjbZyOgCRazM4zBC5aeLmxlfAZLL1dBahPOhsC1zoUa+fZvARdVk6yM85gG fd8PV+NKQQV6sdAkmsj.UCcb4BPKKM7aAXadrBoHOGYY1SEc5aGhCyu2JR3J Vf0+jqjl0.zQCX3RNw24HEZrxf98lUlFKeea8lORHsSRC+9iFM0gGZGN.6PZ TTlZ9dHijSnwd5KpO05HB8BbT85XW6I1VFQXy.Uwirun51xQ1dv9v1qAWMFe QiVtSgxDWyJvxDU1dsQGpICZS1TSU..HX4Aif.rTcFqdaUZSzaG1jS.6vaJU 6c54SYQ144L7zWBVCLys1M1nWqwfEMuOjO57AiNnCA+9q3DY4lCeMDWOL1ER KjoG+7SW+th3uup9iuq1FWodfH4Uq3h30472Mb5d1.oYb6tZJVj9nywVBZKW kcsxI5sH9UbQJuxcQ7wW2a59bjr4HGof91WViCyO1yzps9LxMRK6xLuLpi+m FwbwzG3HFVWtqJoU7Moi.32td5wxkIhkYkhCVjdBwprl6W0yYoobw6BVjlUq CfXfF77OUuIcAultzEMe3pF.cw5htvihrPSOY42EZQFbYoe+Ycv5Zv0EoSV8 gCutB5jUOb3EVmbGQCugOgzIgM7l9D7TUXnopvfcx3eD7J6htXSSYcbD3oht PW+wXQV51RUuWMkbwngd952RYjdCAB2+oCtVN9VAOQySfCln5hMQisfmpA8v cJnGJXvEFZhZ5i5Vd0guDITW5LfxtqF7.O83CpM+OwlA0iA -----------end_max5_patcher-----------
These aren’t bugs, they’re deliberate design decisions :) I understand where your questions are coming from, but I’m not sure where you’re trying to go. If you could give an idea of what you’re trying to achieve, I’m sure there’s a way to make it happen with how things are currently.
"1) The dest_dim attribute of jit.gl.node cannot be changed and is taken from the dimensions of the main context’s window. Why is that so? Is there any way to change it?"
This value has always been linked to the rendering destination’s dimensions. What are you trying to do with it? jit.gl.node’s @dim attribute is what sets the resolution of the capture. If you set @adapt 1, it will automatically link dim to dest_dim. dest_dim’s purpose is to allow objects to perform calculations based on rendering destination resolution.
"2) Is there any way to change the aspect ratio in the jit.gl.camera?"
For perspective projection (non-ortho), the aspect ratio is always linked to the aspect ratio of the rendering destination, which for camera is dependent on the viewport attribute. What are you trying to do with it?
Thanks for the reply!
Sorry about the legth of this post. :( I hope this will explain my questions from the last post. What I am actullay trying to do with this is to use multiple projectors to project one image on a plane (a dancefloor or a screen). The setup of the projectors can be pretty free but their images should somehow overlap. The basic idea behind this is to render the actual image I want to see on the screen to a texture and use quads with proper texture coordinates to display them. Each quad is displayed on one projector. The quads are calibrated (have theirs corners setup) to cancel the effect of the projectors’ projective :) transform and to stich the image from the texture back on the screen.
I have put together an example patcher in Max 5 that does schematicly what I use today. It doesn’t yet work in Max 6.0.1 (50928) and I think it is because of http://cycling74.com/forums/topic.php?id=36256 . Am I right? The quads are replaced by simple planes and there is no texture coordinates mess.
-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 1160.3oc0YtsiihCD.84LRy+fEZejFYaf.YeZ1uicF0xAbm3tALCX5K6n8ee 8EHgNSniyEZXkRvIENlxGWU4pb90W+xBm07Wo0Nf+D72fEK9kTxBsLkjEcBV 3jSdMIiTq6nSBOOmVHbbauof9pPeiJZQJspFH1RAe24mMjz5u6.Dbs.dinrQ .dgUjxeY2uMiUPS3ME5A.2IsjHR1xJ1beEMQXTNTLzC5BBv5FjutwOvCB9Q2 u5AdgnfjS05xeUwHY6dLEM4rhLpPOAP8jJ0pNwv9iSM6eziCB6sSNKUOx70O dGF4nE9ue8KpVYi60iuZdNEjHe3x6BdfWowFKmrgJ+DQ.p2xaxRAqofTVcYF 4MZJfWn6UcREkVb9TcIzfyP80UASJTQqFAn12lbbYYXrgh9llnIFlwi.LU3Q 8klJJXKOKU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M aYfrJ.CZZ1pEgrlbn4pyZzz3PDYkxglwQRF1gvZkSIP17eLAhgrE -----------end_max5_patcher-----------
The "bugs" or "delibrate design decisions" :) from the patcher using jit.gl.node are here handled by:
1) The dimensions of the texture. — The jit.gl.sketch with @capture fills the whole texture but jit.gl.node @adapt 0 @capture 1 @dim x y only the @dest_dim part of it. I did not make this clear enough in the last post. That is the reason I wanted to change the dest_dim, which has different meaning as I see now. So perhaps the the whole texture should be filled?
2) Second parameter to the gluperspective message in the jit.gl.skecch @name scene-sketch. — The aspect ratio of the actual image (projected on the screen) has no relation to the window it is displayed in (wide window spanning 2-3 projector outputs).
I would really like to use the jit.gl.node for the same task because it allows much easier registration of the OB3Ds to the scene. But the world will not collapse if Max 6 allows me to do it the same way as in Max 5. :)
BTW: Thanks for including jit.gl.lua in Max 6. And for the whole Max 6 too.
Thanks for putting this info together. It’s now much much clearer to me what you’re trying to do. It’s going to take me a bit to go through all of this and come back with a response, but you should be able to do it the sketch way in Max 6.0.2 when that comes out soon. I think you should also be able to do the same with node/camera although you do point out some limitations that may have to be addressed for 6.0.2 before that works as well. In any case, I very much appreciate this feedback. It’s a big help.
"1) The dimensions of the texture. — The jit.gl.sketch with @capture fills the whole texture but jit.gl.node @adapt 0 @capture 1 @dim x y only the @dest_dim part of it. I did not make this clear enough in the last post. That is the reason I wanted to change the dest_dim, which has different meaning as I see now. So perhaps the the whole texture should be filled?"
I’m not seeing this. Can you post a patch that just shows this problem? Here’s the patch I made to try and reproduce. I tried adjusting the dim attribute to make it fill less than all of the texture, but the entire texture here is getting filled. Maybe I’m misunderstanding what you mean, but this is what I understood.
-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 604.3ocyWF0jZBCDG+Y3SQl7r0gD.A6S1OGctwIZRwbCjPCgp8t49tWRhbm1 ohH5Q4AAcSX2+6ujMr9puGbi7.qBB9J36.OuW887rlLF7N9aOXA4v1bRkcZP hVqp4vYtg9gTnEjBlcnuo3j71Qj05blV+6Rly6PH3oiCURza2wEYqUrsZ2nn T77fYfnDyULdg8Vv7f2eFN0FB4lm+BJ5znWwewFAjwANyh5BtnI3VAiNZzna qKn7B3GSzIS2LMFey22bY1+UZfCWZ.PRZenQ38QCVkd8CEIB19Fc05OM6fMo fOy0yyxm+KNkIKyIB1.fViOVWPzJ9A3r9gPbhEdKC6DgACAgmSJ7CmTBIkAV skTpqUL.BrhPa9NH.rpY4BDivlOCDhY4qMgqwwVP1SXhBhrXbQbWzb48CyvG NLa10vNkJ2Rk50nSD1d1EJzVthPgyiuLcRuE5jNRa0xTbZ0NRYy9M2MsTUW8 4Vf1RsEItacdHWxjq.cOWPk6AuL.HsgHxtJdhQVrDaq3RvcAmESwSuTLAko9 joCxdPTRPWzIdRQGMXCfoHUr6fLtm+53w09PbRWzIZRQmeVvzJIHLbnz45Pw 0gY2uA6l5nB+vZbRKyxxYWLA4BcepIRayrKmeu20PIQ0.2l2LtlIHaxsQ5FV 4OMIswAlyE+8+lvpTi8yy7JYsZaap01UO3C4Z5KkKHZtTbxjVd1b1woTl3TQ S4Ul7vlpA+ykf9Jmk8PMl9FGI4X5xehQGzUTSxnolzdvlwSMQ8fMwipZBlLp oO6hiFM0f6gZBGnZ.O4+l+e.2z7AxA -----------end_max5_patcher-----------
The problem seems to appear when the jit.gl.camera is added to context created by jit.gl.node in your last patch. Try this patch. The effect can be seen when the "z" window is resized.
-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 699.3ocyX11aZCCD.9yoR8+fUz9XWTbdm8I1uiooHShWvUAaliyf0p8ee9EB kM.go0IfDjC74Ze9w2cbWe8wG77Wv1h67AeA7Mfm2qxQ7zioFwaX.O+UnsUs nN8D8ErllVr+S6zQ6WQnsXgVIbXTRsdtrEO+YX9gyk0KNZxlwD+dM1XI9Dpv G78A0qQhpkDZSIGWILyHIJJH7IPTXlQL77v+HNZEVf4kXJZQqdkC059yiOnj RwSVelWg65PMucnE3sZKw2r3fOA2q5GLpfJ2Zs5uxIn1SipnSgpzKgJ0p2Qd Qu5PECNGBsiew4JQVr5IrPwu2Mhn3MxivwD5YhHnoMnRhDNBLW9nCWVwZYb. L.DpeACtZ7cROsyPunqldRitrosTcH54xqca4Y1LimX9aNjuafhDBdOY+QR8 U830jUtgVISjyFrPCmDCThxFS1f6DkNCPwSDfhh0tM4EtCPWHZ7WjZLacKhh cCoBcZj2JjfS1d4ntcbKJWSrYwiO2nrZLXdEZsJs..BlipkeFDBlKc5.ovH0 amfzYmgnwtHWlsjEFlXRqkN9nUdoi+GDYK8JNA8Jbl+n049gw5vWHLNHcrYU CmT2sDsV5KZDBFuuyI9c42jH4AFlkaDicJvMDZMaC3EmfrLmgrEHZykgUJTC oTcrYdz3GZxwzZL2IrJ81vJnNAVd3HxJAXAPWbqS3Thy4jw1r.VlxPRyGQV8 SYmYbFHN1IcM4txzzrxBDYJk0I+p301Mcj6aldWLRwGoUZyr8aIzi92In2Qk h+CCcrdd0fQtqjGYIU62VUs7DJRPXzCljrGOvA11RRcMVqe+sZMoSYk0Wnie qMKUS4Gtk2K1kU3Je5wUrM3Z1MAWW9VLb54Ux8Iuf4VArzI2vrhW2FyBd+YV Q1Pq3I2rrJIQxjaVE1XVerbppZEjh+xz3qiI -----------end_max5_patcher-----------
"2) Second parameter to the gluperspective message in the jit.gl.skecch @name scene-sketch. — The aspect ratio of the actual image (projected on the screen) has no relation to the window it is displayed in (wide window spanning 2-3 projector outputs)."
Here’s how to handle capturing with a different aspect ratio than what the window has. This is not really well documented, but you can use jit.gl.camera with jit.gl.node to realize some interesting situations. Here the node is not capturing. Capturing with node was designed to produce the exact same visual result as when it’s not capturing. If you toggle capture on/off, you will see this. jit.gl.camera on the other hands uses its capture texture’s dimensions for its aspect ratio. By default, this is set to adapt, which adapts to the window’s dimensions. With adapt off, you can set it to aspect ratios having nothing to do with the window. I think this patch should work for you.
-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 829.3oc0X1sbhCBEG+Z8ofIWac.xmtW49brSGGLvZoaB3B3psc569R.s0tVS xFsooSUi8HD9e9ky4jS3owiBVJ2wzAfuA9AXznmFOZjyTkgQ6++QAkjc4EDs aXA4xxRlvDLw+aF1NiyNQulka.JhgKATlgoJ4BFEr7A.kamglKEGlTg8Wxka DtYh2a7mRgQPJYty12UbRwggulXxuiKVsPYWAuViBmMENAfQoUGPgtCgQSgf a2OIN0chjKu+FbTvQqgl+naMPX6b7lEarZsfYbdH5UixMlCVgUFed73pOlzR TIXasK+IjpPRnKIhUAM539027vZl2qCbS6EW7c3RXLxwEGcRftuCOCUvWNUP cfJkLslrhcBVTLMyLAvJJ3q0L.Zp8UGPTavSbhKpAF6Nj897AE++vG7UiOmI p4dtY5pho5ewrdEXtNmTv.vogGd2ETMoc3Jyiqzn5BmPgWd3D9piq+voL45B hfAluVp41hSBabEF.AvNPL6YcQIwn36ZlcI6qIgcvaV84hnOG3QLF0F90NKC m484LW.CxWL5rtNrKtdkv82Nhr1rQ8R0jKO86CEIXXaPBJ8hPBgZYxWEff8. IN8DfTkJuXKmZtqZFQYu38GSprKhT1FSB5o514VloHf46iWAHvb20Iagn4VY .hQX2641QoYKxkERUUQJ6enNVnZUwhJU3xNZ5pgsUgXK+Syb0rlkTa3YxWlJ 82zKk5QoguoTe82mDNDomPRYWmvrFC07cti7UBSv0wpYWNpButnZKWPkaAOZ a.yJGPFDBBgvt1IeSrx29EJdeMx35X0fLoTwDTl5CFOHGWRqsAq3AEcLfk.W c9KfL942Ld7kzem6udDchFTz42kLiRBBC+Hd.YOThb3Ho1DpvOmG+yHWspfc VGjWsoIMmSjcvypow6W2dEkEtFlZASPVV3VoNtG.t0ws8N+ydJ4TZk8254Z4 FU9AW6PuEfWkKkoMbQ0VJINdPv2Ln63TJSbrpobckiPO+F2bU0S0Su0S5wdG QaqiMfmj9COYs4xUOpmzgkdvvAldvsQOw820q31nmvgU5U+ImnVHm3dUMvAi ZBagZh5uDqVnltF2.tc7yi+KXhP8v. -----------end_max5_patcher-----------
"By default, this is set to adapt, which adapts to the window’s dimensions. With adapt off, you can set it to aspect ratios having nothing to do with the window. I think this patch should work for you."
I was wondering what the @capture on jit.gl.camera is good for… And it also solves 1). (as it seems to me now at 1:30 AM)
Thanks a lot!
Forums > Jitter