making jit.gl.render a movie so i can combine it with a background?

Mar 29, 2006 at 4:19am

making jit.gl.render a movie so i can combine it with a background?

hi

right now in a jit.window i have rendered a sphere with a texture which rotates at the top of the screen.

what i want to do is combine this window with a jit.qt.movie through jit.op so that my sphere would overlay my background which would be a movie.

the thing i cannot figure out right now is how to convert my jit.gl.render into a movie because right now i can only play it in the window….nowhere else.

i looked through the help file and tried to name a jit.pwindow and then pass a drawto message to the jit.gl.render, but for some reason my 3d scene does not render in the jit.pwindow and only in the jit.window.

i suspect that if i can convert the jit.gl.render scene into jit.pwindow i can then pass that into jit.op along with my background.

any help would be much appreciated.

thanks.

max v2;
#N vpatcher 143 201 1117 1038;
#P origin 0 12;
#P window setfont “Sans Serif” 9.;
#P newex 744 239 64 9109513 jit.matrix yon2;
#P newex 741 148 52 9109513 t b b erase;
#P newex 741 120 44 9109513 metro 20;
#P toggle 741 93 15 0;
#P user jit.pwindow 183 441 102 77 0 1 0 0 1 0;
#X name u149000130;
#P objectname where[1];
#P newex 138 396 54 9109513 r discolayer;
#P newex 555 516 30 9109513 print;
#P message 399 397 50 9109513 getname;
#P message 339 398 54 9109513 name yon2;
#P user jit.pwindow 338 437 102 77 0 1 0 0 1 0;
#X name yon2;
#P objectname where;
#P message 156 214 73 9109513 drawto discoball;
#P message 80 213 58 9109513 drawto yon2;
#P user jit.pwindow 156 582 240 183 0 1 0 0 1 0;
#P newex 157 536 70 9109513 jit.op @op max;
#P newex 356 130 54 9109513 jit.qt.movie;
#P message 411 99 84 9109513 read discofloor.jpg;
#P comment 166 63 100 9109513 discoball patcher;
#P toggle 356 63 15 0;
#P user jit.pwindow 355 172 240 183 0 1 0 0 1 0;
#P newex 356 87 44 9109513 metro 50;
#P newex 44 183 94 9109513 r discotexture_render;
#P toggle 171 83 15 0;
#N vpatcher 640 366 1554 1065;
#P origin 0 7;
#P window setfont “Sans Serif” 9.;
#P newex 54 534 58 9109513 s discolayer;
#P toggle 65 385 15 0;
#P message 65 416 64 9109513 matrixoutput $;
#P comment 230 25 100 9109513 discoball size;
#P comment 383 24 100 9109513 discoball position;
#P message 687 100 26 9109513 6.18;
#P message 646 99 26 9109513 9.15;
#P message 599 101 26 9109513 6.62;
#P message 481 94 29 9109513 -7.06;
#P message 440 93 26 9109513 2.69;
#P newex 337 54 44 9109513 loadbang;
#P toggle 521 289 15 0;
#P newex 521 310 44 9109513 metro 20;
#N counter;
#X flags 0 0;
#P newobj 521 334 66 9109513 counter;
#P newex 485 255 44 9109513 loadbang;
#P message 485 307 18 9109513 90;
#P flonum 559 404 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 521 404 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 485 424 108 9109513 pak rotatexyz 0. 0. 0.;
#P flonum 485 404 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 103 468 74 9109513 r discoball_state;
#P newex 485 487 74 9109513 s discoball_state;
#P newex 485 457 168 9109513 jit.gl.handle discoball @depth_enable 1;
#P newex 746 178 94 9109513 pak rotatexyz 0. 0. 0.;
#P newex 133 288 44 9109513 loadbang;
#P newex 234 261 44 9109513 loadbang;
#P message 133 317 61 9109513 texture disco;
#P newex 234 315 44 9109513 metro 40;
#P toggle 234 293 15 0;
#P user jit.pwindow 255 394 49 35 0 1 0 1 1 0;
#P newex 234 436 94 9109513 prepend texture disco;
#P newex 234 367 54 9109513 jit.qt.movie;
#P message 263 344 79 9109513 read discoball.jpg;
#P newex 234 479 94 9109513 s discotexture_render;
#P newex 637 50 34 9109513 * 2.5;
#P flonum 675 153 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 637 153 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 599 154 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 561 178 165 9109513 pak color 1. 0. 0. 1.;
#P newex 473 51 27 9109513 * 0.;
#P newex 435 51 27 9109513 * 0.;
#P newex 397 51 27 9109513 * 0.;
#P flonum 473 140 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 435 140 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 397 140 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 359 176 125 9109513 pak position 1. 1. 1.;
#P newex 235 175 85 9109513 pak scale 1. 1. 1.;
#P flonum 260 50 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 74 112 81 9109513 lighting_enable $1;
#P message 74 82 88 9109513 smooth_shading $1;
#P message 74 55 74 9109513 depth_enable $1;
#N comlet Effects;
#P inlet 74 24 15 0;
#P newex 54 492 104 9109513 jit.gl.gridshape discoball;
#P comment 233 237 100 9109513 disco teture load;
#P comment 480 238 100 9109513 discoball rotation;
#P comment 566 274 100 9109513 continous rotation;
#P comment 602 23 100 9109513 discoball color;
#P connect 54 0 4 0;
#P connect 36 0 4 0;
#P fasten 30 0 4 0 138 465 59 465;
#P fasten 18 0 4 0 566 214 59 214;
#P fasten 11 0 4 0 364 211 59 211;
#P fasten 10 0 4 0 240 208 59 208;
#P fasten 6 0 4 0 79 77 59 77;
#P fasten 7 0 4 0 79 107 59 107;
#P fasten 8 0 4 0 79 137 59 137;
#P fasten 33 0 4 0 751 216 59 216;
#P connect 4 0 56 0;
#P fasten 32 0 55 0 70 307;
#P connect 55 0 54 0;
#P connect 5 0 6 0;
#P fasten 5 0 7 0 79 45 168 45 168 77 79 77;
#P fasten 5 0 8 0 79 44 168 44 168 107 79 107;
#P connect 32 0 30 0;
#P connect 31 0 28 0;
#P connect 28 0 29 0;
#P connect 24 0 25 0;
#P connect 29 0 25 0;
#P connect 25 0 26 0;
#P connect 26 0 23 0;
#P connect 25 0 27 0;
#P connect 9 0 10 1;
#P fasten 31 0 24 0 239 285 286 285 286 338 268 338;
#P fasten 9 0 10 2 265 156 290 156;
#P fasten 9 0 10 3 265 156 315 156;
#P connect 15 0 12 0;
#P connect 12 0 11 1;
#P fasten 47 0 13 0 445 114 440 114;
#P connect 16 0 13 0;
#P connect 13 0 11 2;
#P fasten 46 0 47 0 342 83 445 83;
#P fasten 48 0 14 0 486 114 478 114;
#P connect 17 0 14 0;
#P connect 14 0 11 3;
#P fasten 46 0 48 0 342 83 486 83;
#P connect 42 0 41 0;
#P connect 41 0 37 0;
#P connect 38 0 34 0;
#P connect 34 0 35 0;
#P fasten 37 0 38 1 490 421 522 421;
#P fasten 42 0 45 0 490 281 526 281;
#P connect 45 0 44 0;
#P connect 44 0 43 0;
#P connect 43 0 39 0;
#P fasten 39 0 38 2 526 421 554 421;
#P fasten 40 0 38 3 564 421 586 421;
#P fasten 46 0 49 0 342 83 604 83;
#P connect 49 0 19 0;
#P connect 19 0 18 1;
#P fasten 50 0 20 0 651 143 642 143;
#P connect 22 0 20 0;
#P connect 20 0 18 2;
#P fasten 46 0 50 0 342 83 651 83;
#P fasten 51 0 21 0 692 143 680 143;
#P connect 21 0 18 3;
#P fasten 46 0 51 0 342 83 692 83;
#P pop 1;
#P newobj 171 113 56 9109513 p discoball;
#P newex 15 316 121 9109513 jit.window discoball 320 280;
#P newex 15 110 49 9109513 qmetro 40;
#P toggle 15 85 15 0;
#P newex 15 145 44 9109513 t b erase;
#P newex 15 239 92 9109513 jit.gl.render discoball;
#P comment 14 67 100 9109513 rendering discoball;
#P comment 13 282 100 9109513 the window for ball – will open automatically;
#P comment 6 39 100 9109513 THE DISCOBALL;
#P user panel 5 59 298 286;
#X brgb 193 255 157;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P background;
#P connect 6 0 7 0;
#P connect 7 0 5 0;
#P fasten 11 0 4 0 49 215 20 215;
#P connect 20 0 4 0;
#P connect 21 0 4 0;
#P connect 5 0 4 0;
#P fasten 5 1 4 0 54 172 20 172;
#P connect 18 0 19 0;
#P connect 10 0 9 0;
#P connect 26 0 27 0;
#P fasten 24 0 22 0 404 433 344 433;
#P connect 23 0 22 0;
#P connect 14 0 12 0;
#P connect 16 0 17 0;
#P connect 12 0 17 0;
#P connect 17 0 13 0;
#P connect 22 1 25 0;
#P connect 28 0 29 0;
#P connect 29 0 30 0;
#P pop;

#25125
Jul 24, 2007 at 6:15pm

Hey Cablecharlz,

I didn’t check out your patch but I had the exact same question/problem myself. It turns out that there is a patch located in examples/jitter-examples/render (in the max application folder) that is called jit.gl.render over movie. There patch does the trick but I am just now tearing it apart to figure out why it works. On first glance it seems to go the other way around that we were thinking about, ie. using a draw_pixels command to place the video onto the render instead of converting the render to video or attempting to composite it into a new matrix. I have to leave for a movie premier I am doing in Prenzlauer Berg, Berlin, but when I return this evening I will post any new findings I have to help you out as well. Take care and I hope this leads you in the right direction as it did me.

-dilkROM

ps. I have yet to test the functionality of this patch with a jit.gl.model object, but my fingers are crossed that it will work the same. As of now, the patch is using a jit.gl.gridshape object but I can’t see this making a difference, as both still use the jit.gl.handle and jit.gl.render objects.

#73603
Jul 25, 2007 at 12:17am

Here’s what I would do for a start. If you want to combine 3D with
graphics, stay in OpenGL. You can canpture stuff to a texture and
slab it together in any way you wish. See archives for how to do this
kind of stuff there are alot of fairly length threads on this issue.

wes

#P window setfont “Sans Serif” 9.;
#P flonum 344 259 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P message 344 280 42 196617 rate $1;
#P message 235 256 81 196617 read wheel.mov;
#P message 278 280 27 196617 stop;
#P message 244 280 31 196617 start;
#P flonum 187 259 35 9 0.5 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 145 259 15 0;
#P newex 145 279 52 196617 metro 30;
#P message 308 280 31 196617 clear;
#P newex 145 307 103 196617 jit.qt.movie 320 240;
#B color 5;
#P newex 139 232 363 196617 jit.gl.gridshape test @shape torus @color
1 0 0 1 @lighting_enable 1 @layer 1;
#P newex 145 330 319 196617 jit.gl.videoplane test @transform_reset 2
@depth_enable 0 @later 0;
#P message 136 90 34 196617 reset;
#P newex 136 110 186 196617 jit.gl.handle test @inherit_transform 1;
#P newex 1 110 48 196617 r render;
#P toggle 116 81 15 0;
#N vpatcher 53 128 279 297;
#P inlet 106 30 15 0;
#P window setfont “Sans Serif” 9.;
#P window linecount 0;
#P newex 43 95 47 196617 gate 1 1;
#P newex 42 116 41 196617 s draw;
#P window linecount 1;
#P newex 17 52 58 196617 t b b erase;
#P inlet 17 32 15 0;
#P outlet 17 83 15 0;
#P connect 1 0 2 0;
#P connect 2 0 0 0;
#P fasten 2 2 0 0 70 75 22 75;
#P connect 4 0 3 0;
#P fasten 5 0 4 0 111 88 48 88;
#P fasten 2 1 4 1 46 83 85 83;
#P lcolor 15;
#P pop;
#P newobj 54 110 42 196617 p Draw;
#P toggle 192 49 15 0;
#P message 192 69 68 196617 fullscreen $1;
#N vpatcher 30 89 166 253;
#P window setfont “Sans Serif” 9.;
#P newex 50 71 35 196617 sel 27;
#P newex 50 50 40 196617 key;
#P outlet 50 93 15 0;
#P connect 1 0 2 0;
#P connect 2 0 0 0;
#P pop;
#P newobj 209 49 33 196617 p Esc;
#P newex 192 87 151 196617 jit.window test @depthbuffer 1;
#P toggle 54 62 15 0;
#P newex 54 81 57 196617 qmetro 30;
#P newex 54 137 187 196617 jit.gl.render test @erase_color 0 0 0 1;
#P connect 14 0 12 0;
#P connect 23 0 22 0;
#P connect 18 0 16 1;
#P fasten 22 0 14 0 349 301 150 301;
#P fasten 21 0 14 0 240 301 150 301;
#P fasten 20 0 14 0 283 301 150 301;
#P fasten 19 0 14 0 249 301 150 301;
#P fasten 15 0 14 0 313 301 150 301;
#P fasten 16 0 14 0 150 304 150 304;
#P connect 17 0 16 0;
#P connect 5 0 3 0;
#P connect 6 0 5 0;
#P connect 4 0 6 0;
#P connect 11 0 10 0;
#P fasten 8 0 7 1 121 103 91 103;
#P fasten 9 0 0 0 6 132 59 132;
#P connect 7 0 0 0;
#P fasten 10 0 0 0 141 132 59 132;
#P connect 1 0 7 0;
#P connect 2 0 1 0;
#P window clipboard copycount 24;

#73604
Jul 25, 2007 at 5:22am

Wes,

This is a good idea, but if I am not mistaken Cablecharlz wants to do what I want, which is not allowed with textures. For example, if the ‘background’ video isn’t in openGL itself then it won’t move, so you are free to reposition the camera and 3d object(s)/model(s) without changing the video position. The draw_pixels method is actually seeming to work well for me but I will post my final results when I plug in a jit.gl.model object to the whole thing.

Oh, and because it might help, how do you turn a patch into text like you are doing? As well, how do you turn this back into a patch? Thanks…

-dilkROM

#73605
Jul 25, 2007 at 5:26am

Also, forgot to mention that adding a texture object is going to take up more ram (which is important to me because I am building patches for live performance and running on low ram gear). As well, a jit.gl.videoplane (or other similar solution) still requires a jit.qt.movie object anyway, so this draw_pixels method eliminates the need for a secondary object, ie. all you need is the qt.movie object and then a message that routes the matrix, prepends draw_pixels, and sends this directly to the render. Pretty sneaky if you ask me… but definitely let me know if you think there is a reason why this isn’t less ram heavy, I am very interested in every angle involved. Thanks again…

-dilkROM

#73606
Jul 25, 2007 at 5:50am

Yes but with textures you get all kinds of features like interpolation
and compression which wil save you _VRAM_ (not RAM). Did you try
moving the camera around? That’s basically what the handle was doing.
The background image doesn’t actually move because I was using
@transform_reset 2. What GPU (and how much VRAM) do you have?

For making patches from this stuff, use your normal copy and paste
routines. Max will handle the rest.

wes

On 7/25/07, dilkROM wrote:
>
> Also, forgot to mention that adding a texture object is going to take up more ram (which is important to me because I am building patches for live performance and running on low ram gear). As well, a jit.gl.videoplane (or other similar solution) still requires a jit.qt.movie object anyway, so this draw_pixels method eliminates the need for a secondary object, ie. all you need is the qt.movie object and then a message that routes the matrix, prepends draw_pixels, and sends this directly to the render. Pretty sneaky if you ask me… but definitely let me know if you think there is a reason why this isn’t less ram heavy, I am very interested in every angle involved. Thanks again…
>
> -dilkROM
>

#73607
Jul 25, 2007 at 6:12am

Actually I didn’t look at the patch yet but that stuff is good to know. Excuse my lack of knowledge here, but vram is virtual ram yes? And why is this important to save on over regular ram? As for my equipment, PowerBook G4 (slightly unreliable yet sturdy, as it was smashed by a guitar before being given to me, only part that is broken for sure is the disc drive, but sometimes I think it slows down do to the damage…) 1.5 ghz and 1.25 gb ram. How do I checck vram on my machine, do you know? Probably under the entire specs… About the copy and pasting, this was what I thought, but that is cool it works so easy. To give you an idea of the patch I am building, it runs jitter video effects objects (nearly twenty of them) using xfade to combine up to 5 channels (but all coming from the same jit.qt.movie object just pushed through each effect separately before being mixed with xfade). As well I have much automation controls (counters and such) and am now including a few gl objects (gridshape, model, etc.). I know how handle works but never knew there was a setting that kept the background from changing position. This is helpful, but overall why would it be better to save the vram instead of the ram? Thanks for the helpful info, as soon as I have my patch up and running (next few hours most likely, unless I crash out and finish it tomorrow) I will post it here for you to check out.

-dilkROM

#73608
Jul 25, 2007 at 6:25am

By VRAM I was refering to Video RAM on your graphics card. If you’re
doing alot of video effects and have a decent GPU like a Radeon 9700
or better, than you’ll benefit quite a bit in terms of how many
effects you can run by using jit.gl.slab. And honestly I wouldn’t
worry about VRAM unless you start building delay lines on the GPU,
then it might become an issue.

Next time it might be wise to look at the patch before responding.

wes

#73609
Jul 25, 2007 at 6:32am

Okay, thanks for the tip (about viewing the patch, I will do this from now on). Checked my system profiler, using a GeForce FX Go5200 with 64 mb vram. What are delay lines? I used an early version of this patch I am building before and had not too much slow down but was a victim of a crash near the end of the ‘performance’. I believe this was due to my uneducated use of multiple metros and counters, which now I counteract by running most tasks from one qmetro and using Lnth to simulate (q)metros at different timings. Once I get a break in my work I will look at this patch you sent and see how it runs on my machine, sometimes I just get too caught up in the world of Max, I am sure you know how this can be. Thanks for the patience and guidance, I really appreciate it.

-dilkROM

#73610
Jul 25, 2007 at 6:43am

I have no real experience with the 5200. You should run some test on
it with slab processing to see how much it can handle.

wes

On 7/25/07, dilkROM wrote:
>
> Okay, thanks for the tip (about viewing the patch, I will do this from now on). Checked my system profiler, using a GeForce FX Go5200 with 64 mb vram. What are delay lines? I used an early version of this patch I am building before and had not too much slow down but was a victim of a crash near the end of the ‘performance’. I believe this was due to my uneducated use of multiple metros and counters, which now I counteract by running most tasks from one qmetro and using Lnth to simulate (q)metros at different timings. Once I get a break in my work I will look at this patch you sent and see how it runs on my machine, sometimes I just get too caught up in the world of Max, I am sure you know how this can be. Thanks for the patience and guidance, I really appreciate it.
>
> -dilkROM
>

#73611
Jul 25, 2007 at 4:13pm

Also, read the Max and Jitter tutorials and the Fundamentals pdf. A
lot of your questions and concerns are addressed therein. Armed with
their knowledge you’ll be able to make your patch much more efficient.

#73612

You must be logged in to reply to this topic.