Forums > Jitter

texcoords on jit.gl.mesh


April 25, 2008 | 10:17 pm

Can anyone tell my small brain what I should do to correct the texture coordinates in the patch below so that the texture fills the whole plane that is created?
(My end goal is to create a patch so I can move the corners of my texture to make irregular, rhomboid shapes so in order to correct for projection distortions. Like an irregular keystone kind of thing.)

max v2;
#N vpatcher 439 108 1512 885;
#P origin 0 6;
#P window setfont "Sans Serif" 9.;
#P message 241 109 30 196617 read;
#P newex 242 136 138 196617 jit.gl.texture foo @name tex;
#P button 129 65 15 0;
#N vpatcher 142 410 775 901;
#P inlet 162 58 15 0;
#P outlet 87 375 15 0;
#P window setfont "Sans Serif" 9.;
#P newex 87 345 118 196617 jit.matrix 2 float32 2 2;
#P message 214 279 124 196617 setcell 1 1 plane 0 val -1;
#P message 214 298 119 196617 setcell 1 1 plane 1 val 1;
#P window setfont "Sans Serif" 12.;
#P comment 222 113 113 196620 texture s t;
#P window setfont "Sans Serif" 9.;
#P newex 160 100 30 196617 t b b;
#P button 180 124 15 0;
#P message 217 237 119 196617 setcell 0 1 plane 0 val 1;
#P message 217 256 119 196617 setcell 0 1 plane 1 val 1;
#P message 217 214 124 196617 setcell 1 0 plane 1 val -1;
#P message 217 196 124 196617 setcell 1 0 plane 0 val -1;
#P message 217 174 124 196617 setcell 0 0 plane 1 val -1;
#P message 217 155 119 196617 setcell 0 0 plane 0 val 1;
#P connect 7 0 11 0;
#P connect 0 0 11 0;
#P connect 1 0 11 0;
#P connect 2 0 11 0;
#P connect 3 0 11 0;
#P connect 5 0 11 0;
#P connect 4 0 11 0;
#P connect 10 0 11 0;
#P connect 9 0 11 0;
#P connect 11 0 12 0;
#P connect 13 0 7 0;
#P connect 7 1 6 0;
#P connect 6 0 10 0;
#P connect 6 0 9 0;
#P connect 6 0 0 0;
#P connect 6 0 1 0;
#P connect 6 0 2 0;
#P connect 6 0 3 0;
#P connect 6 0 5 0;
#P connect 6 0 4 0;
#P pop 1;
#P newobj 128 95 58 196617 p texcoord;
#P message 338 396 85 196617 poly_mode $1 $1;
#P toggle 338 373 15 0;
#P message 287 235 40 196617 reset;
#P newex 287 259 209 196617 jit.gl.handle foo @auto_rotate 1 @radius 1.5;
#P newex 39 259 99 196617 prepend draw_mode;
#P user ubumenu 40 236 68 196617 0 1 1 0;
#X add points;
#X add lines;
#X add line_strip;
#X add line_loop;
#X add triangles;
#X add tri_strip;
#X add tri_fan;
#X add quads;
#X add quad_strip;
#X add polygon;
#X add tri_grid;
#X prefix_set 0 0 0;
#X pattrmode 1;
#P user jit.pwindow 160 199 82 62 0 1 0 0 1 0;
#P newex 136 336 208 196617 jit.gl.mesh foo @texture tex @color 1 1 1 1;
#B color 5;
#P toggle 295 467 15 0;
#P message 295 485 55 196617 floating $1;
#P hidden message 50 424 68 196617 camera 0 0 4;
#P toggle 222 467 15 0;
#P newex 183 466 35 196617 sel 27;
#P message 222 485 68 196617 fullscreen $1;
#P newex 140 509 145 196617 jit.window foo @depthbuffer 1;
#P newex 138 466 40 196617 key;
#P user jit.fpsgui 59 188 60 196617 0;
#P newex 138 423 45 196617 s meshy;
#P toggle 138 373 15 0;
#P message 138 396 94 196617 smooth_shading $1;
#P toggle 237 373 15 0;
#P message 237 396 90 196617 lighting_enable $1;
#P hidden newex 62 317 50 196617 loadbang;
#P number 60 82 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 15 82 15 0;
#P newex 15 108 55 196617 qmetro 20;
#P newex 15 162 55 196617 t b erase b;
#P newex 15 535 194 196617 jit.gl.render foo @erase_color 0. 0. 1. 1.;
#P hidden message 81 342 14 196617 1;
#P newex 161 175 118 196617 jit.matrix 3 float32 2 2;
#P newex 40 289 45 196617 r meshy;
#P connect 6 0 5 0;
#P connect 5 0 4 0;
#P connect 4 0 3 0;
#P hidden fasten 20 0 3 0 55 483 20 483;
#P fasten 4 1 3 0 42 190 20 190;
#P fasten 25 1 26 0 74 255 44 255;
#P hidden fasten 8 0 20 0 67 364 55 364;
#P connect 4 2 14 0;
#P connect 7 0 5 1;
#P hidden connect 8 0 2 0;
#P connect 32 0 31 0;
#P fasten 0 0 23 0 45 308 141 308;
#P connect 31 0 23 0;
#P connect 24 0 23 0;
#P fasten 26 0 23 0 44 282 141 282;
#P fasten 27 0 23 0 292 308 141 308;
#P hidden fasten 2 0 12 0 86 364 143 364;
#P connect 12 0 11 0;
#P fasten 11 0 13 0 143 418 143 418;
#P fasten 9 0 13 0 242 418 143 418;
#P fasten 30 0 13 0 343 418 143 418;
#P fasten 21 0 16 0 300 504 145 504;
#P fasten 17 0 16 0 227 504 145 504;
#P connect 31 0 23 1;
#P connect 31 0 1 0;
#P connect 1 0 24 0;
#P fasten 15 0 18 0 143 485 180 485 180 464 188 464;
#P fasten 18 0 19 0 188 484 219 484 219 464 227 464;
#P connect 19 0 17 0;
#P hidden fasten 2 0 10 0 86 364 242 364;
#P connect 10 0 9 0;
#P connect 34 0 33 0;
#P connect 28 0 27 0;
#P connect 22 0 21 0;
#P connect 29 0 30 0;
#P pop;


MJ
April 25, 2008 | 11:11 pm

im not sure but

texture coordinates cannot be less than 0
between 0.0 and 1.0

so make a separate matrix for the texcoords

April 25, 2008 | 11:27 pm

on the gl.mesh, try:
tex_map 1
tex_plane_s 0.5 0. 0. 0.5
tex_plane_s 0. 0.5 0. 0.5

attach this to your gl.mesh to adjust further (courtesy of wes smith)

#P window setfont "Sans Serif" 9.;
#P flonum 728 315 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 683 315 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 638 338 100 196617 pak anchor 0.5 0.5;
#N vpatcher 95 381 578 727;
#P window setfont "Sans Serif" 9.;
#P window linecount 0;
#P newex 98 79 60 196617 unpack 0. 0.;
#P window linecount 1;
#P newex 32 47 123 196617 route theta zoom anchor;
#P window linecount 0;
#P newex 353 98 27 196617 t b l;
#P flonum 32 127 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 190 219 27 196617 * 1.;
#P newex 370 178 41 196617 * -1.;
#P newex 227 219 27 196617 * 1.;
#P newex 32 219 27 196617 * 1.;
#P newex 370 123 60 196617 unpack 0. 0.;
#P newex 353 76 79 196617 vexpr 1./$f1;
#P newex 69 219 41 196617 * -1.;
#P newex 32 149 100 196617 expr 0.5*cos($f1);
#P newex 209 149 97 196617 expr 0.5*sin($f1);
#P flonum 301 244 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 264 244 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 227 244 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 190 244 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 191 267 147 196617 pak tex_plane_t 0. 0.5 0. 0.5;
#P flonum 143 245 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 106 245 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 69 245 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 32 245 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 33 267 149 196617 pak tex_plane_s 0.5 0. 0. 0.5;
#P inlet 32 25 15 0;
#P outlet 33 297 15 0;
#P connect 1 0 23 0;
#P fasten 22 0 21 0 358 122 37 122;
#P connect 23 0 21 0;
#P connect 21 0 13 0;
#P connect 13 0 17 0;
#P connect 17 0 3 0;
#P connect 2 0 0 0;
#P fasten 7 0 0 0 196 291 38 291;
#P fasten 16 0 17 1 375 171 54 171;
#P fasten 3 0 2 1 37 263 72 263;
#P fasten 12 0 14 0 214 182 74 182;
#P connect 14 0 4 0;
#P connect 23 2 24 0;
#P fasten 19 0 14 1 375 208 91 208;
#P fasten 4 0 2 2 74 263 106 263;
#P fasten 5 0 2 3 111 263 140 263;
#P fasten 24 0 6 0 103 104 148 104;
#P fasten 6 0 2 4 148 263 174 263;
#P fasten 12 0 20 0 214 182 195 182;
#P connect 20 0 8 0;
#P fasten 16 1 20 1 425 213 212 213;
#P fasten 21 0 12 0 37 145 214 145;
#P fasten 8 0 7 1 195 263 230 263;
#P fasten 13 0 18 0 37 193 232 193;
#P connect 18 0 9 0;
#P fasten 16 1 18 1 425 213 249 213;
#P fasten 9 0 7 2 232 263 264 263;
#P fasten 10 0 7 3 269 263 298 263;
#P fasten 24 1 11 0 153 108 306 108;
#P fasten 11 0 7 4 306 263 332 263;
#P fasten 23 1 15 0 70 71 358 71;
#P connect 15 0 22 0;
#P connect 22 1 16 0;
#P connect 16 0 19 0;
#P pop;
#P newobj 465 370 94 196617 p TexCoordMagic;
#P message 465 340 56 196617 theta $1;
#P newex 465 315 107 196617 expr $f1*3.14/180;
#P flonum 589 292 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 626 315 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 589 315 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 559 338 70 196617 pak zoom 1. 1.;
#P flonum 465 292 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P connect 0 0 5 0;
#P connect 5 0 6 0;
#P fasten 8 0 7 0 643 361 470 361;
#P connect 6 0 7 0;
#P fasten 1 0 7 0 564 363 470 363;
#P connect 2 0 1 1;
#P fasten 3 0 1 2 631 334 624 334;
#P fasten 4 0 3 0 594 310 631 310;
#P connect 4 0 2 0;
#P connect 9 0 8 1;
#P connect 10 0 8 2;
#P window clipboard copycount 11;

April 25, 2008 | 11:51 pm

brilliant! just the info I needed.
I just added a pictslider in a subpatcher that lets me move the corner of the plane around so I can cornerpin it to a projection surface.
thank you both. you rule!

max v2;
#N vpatcher 535 184 1608 961;
#P origin 0 6;
#P button 175 64 15 0;
#P window setfont "Sans Serif" 9.;
#P message 241 109 30 196617 read;
#P newex 242 136 138 196617 jit.gl.texture foo @name tex;
#P button 129 65 15 0;
#N vpatcher 596 366 1460 882;
#P window setfont "Sans Serif" 9.;
#N vpatcher 562 141 1162 541;
#P outlet 160 269 15 0;
#P outlet 60 270 15 0;
#P window setfont "Sans Serif" 9.;
#P flonum 156 236 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 61 236 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 157 206 40 196617 / 100.;
#P newex 60 208 40 196617 / 100.;
#P flonum 157 174 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 61 176 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P user pictslider 66 60 100 100 4 4 4 4 SliderDefaultKnob.pct 1 SliderDefaultBkgnd.pct 1 2163 0 13172536 -13107000 1. 1.;
#P connect 1 0 3 0;
#P connect 5 0 7 0;
#P connect 0 0 1 0;
#P connect 3 0 5 0;
#P connect 4 0 6 0;
#P connect 0 1 2 0;
#P connect 2 0 4 0;
#P connect 6 0 8 0;
#P pop;
#P newobj 222 65 78 196617 p movecorner1;
#P flonum 683 78 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P inlet 522 60 15 0;
#P outlet 447 377 15 0;
#P newex 447 347 118 196617 jit.matrix 2 float32 2 2;
#P message 574 281 119 196617 setcell 1 1 plane 0 val 0;
#P message 574 300 119 196617 setcell 1 1 plane 1 val 1;
#P window setfont "Sans Serif" 12.;
#P comment 582 115 113 196620 texture;
#P window setfont "Sans Serif" 9.;
#P newex 520 102 30 196617 t b b;
#P button 540 126 15 0;
#P message 577 239 119 196617 setcell 0 1 plane 0 val 1;
#P message 577 258 119 196617 setcell 0 1 plane 1 val 1;
#P message 577 216 119 196617 setcell 1 0 plane 1 val 0;
#P message 577 198 119 196617 setcell 1 0 plane 0 val 0;
#P message 577 176 119 196617 setcell 0 0 plane 1 val 0;
#P message 577 157 125 196617 setcell 0 0 plane 0 val $1;
#P inlet 162 58 15 0;
#P outlet 87 375 15 0;
#P newex 87 345 118 196617 jit.matrix 2 float32 2 2;
#P message 214 279 124 196617 setcell 1 1 plane 0 val -1;
#P message 214 298 119 196617 setcell 1 1 plane 1 val 1;
#P window setfont "Sans Serif" 12.;
#P comment 222 113 113 196620 vertices;
#P window setfont "Sans Serif" 9.;
#P newex 160 100 30 196617 t b b;
#P button 180 124 15 0;
#P message 217 237 119 196617 setcell 0 1 plane 0 val 1;
#P message 217 256 119 196617 setcell 0 1 plane 1 val 1;
#P message 217 214 124 196617 setcell 1 0 plane 1 val -1;
#P message 217 196 124 196617 setcell 1 0 plane 0 val -1;
#P message 217 174 125 196617 setcell 0 0 plane 1 val $1;
#P message 217 155 125 196617 setcell 0 0 plane 0 val $1;
#P connect 7 0 11 0;
#P connect 0 0 11 0;
#P connect 1 0 11 0;
#P connect 2 0 11 0;
#P connect 3 0 11 0;
#P connect 5 0 11 0;
#P connect 4 0 11 0;
#P connect 10 0 11 0;
#P connect 9 0 11 0;
#P connect 11 0 12 0;
#P connect 29 1 7 0;
#P connect 29 0 7 0;
#P connect 13 0 7 0;
#P connect 7 1 6 0;
#P connect 6 0 10 0;
#P connect 6 0 9 0;
#P connect 6 0 0 0;
#P connect 29 0 0 0;
#P connect 6 0 1 0;
#P connect 29 1 1 0;
#P connect 6 0 2 0;
#P connect 6 0 3 0;
#P connect 6 0 5 0;
#P connect 6 0 4 0;
#P connect 23 0 25 0;
#P connect 24 0 25 0;
#P connect 18 0 25 0;
#P connect 19 0 25 0;
#P connect 17 0 25 0;
#P connect 16 0 25 0;
#P connect 15 0 25 0;
#P connect 14 0 25 0;
#P connect 21 0 25 0;
#P connect 25 0 26 0;
#P connect 27 0 21 0;
#P connect 21 1 20 0;
#P connect 20 0 24 0;
#P connect 20 0 23 0;
#P connect 20 0 14 0;
#P connect 28 0 14 0;
#P connect 20 0 15 0;
#P connect 20 0 16 0;
#P connect 20 0 17 0;
#P connect 20 0 19 0;
#P connect 20 0 18 0;
#P pop 1;
#P newobj 128 95 58 196617 p texcoord;
#P message 338 396 85 196617 poly_mode $1 $1;
#P toggle 338 373 15 0;
#P message 287 235 40 196617 reset;
#P newex 287 259 209 196617 jit.gl.handle foo @auto_rotate 1 @radius 1.5;
#P newex 39 259 99 196617 prepend draw_mode;
#P user ubumenu 40 236 68 196617 0 1 1 0;
#X add points;
#X add lines;
#X add line_strip;
#X add line_loop;
#X add triangles;
#X add tri_strip;
#X add tri_fan;
#X add quads;
#X add quad_strip;
#X add polygon;
#X add tri_grid;
#X prefix_set 0 0


MJ
April 27, 2008 | 3:29 pm

post some results of you videomapping on youtube

here are mine
http://nl.youtube.com/user/visualjockey

Viewing 5 posts - 1 through 5 (of 5 total)

Forums > Jitter