dest_dim of jit.gl.node @capture 1
Hello,
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!
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 https://cycling74.com/forums/jit-gl-sketch-drawobject-command-is-broken-in-max-6 . Am I right? The quads are replaced by simple planes and there is no texture coordinates mess.
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.
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.
"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.
"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!