Forums > Jitter

transparency of a texture

July 14, 2008 | 3:29 pm

hello,

i’m using a pixelated image as a texture to a gridshape (opencylinder).
i use the alpha channel of the texture to achieve transparency , so
that one can see inside or even through the cylinder if the pixel
values are dark.

this works fine with blend enable etc.
but only if i look at the cylinder in a certain angle. e.g. if i look
from above down on the cylinder it works, but not if i look from below.
i noticed these "planes" appearing inside the cylinder that finally
"kill" my wonderful transparency.
they are obviously connected to the dimension count – but i don’t get
it where/why they come from?

yes, my understanding of openGL is quite limited and i could use a
hint for the right direction.

attached is a patch that hopefully demonstrates what i mean.
give it a slight shove up or down to rotate the cylinder.

thanks.
volker.

max v2;
#N vpatcher 493 109 919 713;
#P origin 0 -60;
#P hidden button 184 117 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 2;
#P comment 70 155 40 196617 noise on/off;
#P window linecount 1;
#P hidden newex 212 117 75 196617 loadmess 0.75;
#P toggle 76 181 15 0;
#P flonum 96 181 35 9 0. 1. 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#N vpatcher 249 269 743 720;
#P window setfont "Sans Serif" 9.;
#P window linecount 0;
#P newex 177 113 44 196617 del 500;
#P window linecount 1;
#P newex 208 83 48 196617 loadbang;
#P newex 97 109 58 196617 metro 500;
#P inlet 97 80 15 0;
#P window linecount 0;
#P newex 97 297 53 196617 jit.pack;
#P newex 97 333 142 196617 jit.matrix oo 4 char 160 160;
#P inlet 269 106 15 0;
#P flonum 269 141 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 97 210 182 196617 jit.expr @expr "(in[0] > in[1])*in[0]";
#P window linecount 1;
#P newex 97 157 122 196617 jit.noise 1 float32 16 16;
#P inlet 44 62 15 0;
#P outlet 97 382 15 0;
#P connect 8 0 9 0;
#P connect 9 0 2 0;
#P connect 11 0 2 0;
#P connect 2 0 3 0;
#P connect 3 0 7 0;
#P fasten 1 0 6 0 49 326 102 326;
#P connect 7 0 6 0;
#P connect 6 0 0 0;
#P connect 3 0 7 1;
#P connect 3 0 7 2;
#P connect 3 0 7 3;
#P connect 10 0 11 0;
#P connect 5 0 4 0;
#P connect 4 0 3 1;
#P pop;
#P newobj 56 203 51 196617 p noiz;
#N vpatcher 437 44 1240 743;
#P window setfont "Sans Serif" 9.;
#P hidden message 498 154 14 196617 6;
#P hidden message 554 151 14 196617 4;
#P hidden message 576 274 20 196617 20;
#P number 576 295 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 576 319 68 196617 auto_time $1;
#P toggle 495 295 15 0;
#P message 495 319 75 196617 auto_rotate $1;
#P hidden newex 570 432 77 196617 t 0.3 0.3 0.2 1;
#P comment 553 176 55 196617 destination;
#P flonum 612 467 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 577 467 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 542 467 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 507 467 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 507 487 128 196617 pak erase_color 0. 0. 0. 1.;
#P number 554 192 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 507 192 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 488 212 95 196617 pak blend_mode 1 0;
#P comment 507 177 55 196617 source;
#P newex 40 92 139 196617 jit.gl.texture duu @name uno;
#P inlet 22 28 15 0;
#P hidden message 63 545 68 196617 camera 0 0 4;
#P flonum 340 125 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 302 125 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 262 125 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 237 152 85 196617 pak scale 1. 1. 1.;
#P newex 495 353 210 196617 jit.gl.handle duu @depth_enable 1 @radius
2.;
#P toggle 315 480 15 0;
#P newex 276 479 35 196617 sel 27;
#P message 315 498 68 196617 fullscreen $1;
#P newex 233 522 148 196617 jit.window duu @depthbuffer 1;
#P newex 231 479 40 196617 key;
#P number 145 142 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 145 170 54 196617 dim $1 $1;
#P user jit.fpsgui 76 224 60 196617 0;
#P flonum 359 173 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 321 173 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 281 173 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 346 326 15 0;
#P message 346 349 94 196617 smooth_shading $1;
#P hidden newex 657 172 50 196617 loadbang;
#P toggle 258 326 15 0;
#P message 258 349 81 196617 depth_enable $1;
#P newex 22 199 64 196617 t b l erase b;
#P newex 145 407 332 196617 jit.gl.gridshape duu @texture uno @shape
opencylinder @blend_enable 1;
#B color 5;
#P newex 22 592 83 196617 jit.gl.render duu;
#P hidden message 495 262 14 196617 1;
#P newex 253 197 95 196617 pak position 0. 0. 0.;
#P connect 27 0 4 0;
#P fasten 3 0 2 0 150 493 27 493;
#P hidden fasten 26 0 2 0 68 577 27 577;
#P connect 4 0 2 0;
#P fasten 4 2 2 0 63 275 27 275;
#P fasten 33 0 2 0 512 582 27 582;
#P connect 27 0 28 0;
#P hidden connect 7 0 26 0;
#P connect 4 3 13 0;
#P connect 15 0 14 0;
#P connect 8 0 3 0;
#P connect 0 0 3 0;
#P connect 22 0 3 0;
#P connect 5 0 3 0;
#P fasten 30 0 3 0 493 254 150 254;
#P fasten 14 0 3 0 150 204 150 204;
#P fasten 21 0 3 0 500 400 150 400;
#P fasten 18 0 17 0 320 517 238 517;
#P hidden fasten 1 0 6 0 500 285 263 285;
#P connect 6 0 5 0;
#P connect 23 0 22 1;
#P fasten 16 0 19 0 236 498 273 498 273 477 281 477;
#P connect 10 0 0 1;
#P fasten 24 0 22 2 307 146 292 146;
#P fasten 11 0 0 2 326 192 314 192;
#P fasten 25 0 22 3 345 146 317 146;
#P fasten 19 0 20 0 281 497 312 497 312 477 320 477;
#P connect 20 0 18 0;
#P fasten 12 0 0 3 364 192 342 192;
#P hidden fasten 1 0 9 0 500 285 351 285;
#P connect 9 0 8 0;
#P hidden connect 7 0 1 0;
#P hidden connect 1 0 41 0;
#P connect 41 0 40 0;
#P connect 42 0 21 0;
#P connect 40 0 21 0;
#P hidden connect 7 0 46 0;
#P hidden connect 46 0 31 0;
#P hidden connect 39 0 34 0;
#P fasten 31 0 30 1 512 209 535 209;
#P fasten 34 0 33 1 512 484 541 484;
#P hidden connect 39 1 35 0;
#P hidden connect 7 0 45 0;
#P hidden connect 45 0 32 0;
#P fasten 35 0 33 2 547 484 570 484;
#P hidden connect 7 0 39 0;
#P fasten 32 0 30 2 559 209 577 209;
#P hidden connect 7 0 44 0;
#P hidden connect 44 0 43 0;
#P connect 43 0 42 0;
#P hidden connect 39 2 36 0;
#P fasten 36 0 33 3 582 484 599 484;
#P hidden connect 39 3 37 0;
#P fasten 37 0 33 4 617 484 628 484;
#P pop;
#P newobj 85 245 49 196617 p openGL;
#P user jit.pwindow 55 323 162 162 0 1 0 0 1 0;
#P number 103 107 35 9 50 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 56 72 23 0;
#P newex 56 128 57 196617 qmetro 50;
#P comment 83 76 100 196617 < -- start;
#P comment 132 183 100 196617 noise threshod;
#P hidden connect 12 0 3 0;
#P connect 3 0 2 0;
#P connect 2 0 7 0;
#P connect 7 0 5 0;
#P connect 9 0 7 1;
#P connect 7 0 6 0;
#P hidden connect 10 0 8 0;
#P connect 8 0 7 2;
#P connect 4 0 2 1;
#P hidden connect 10 0 12 0;
#P pop;


July 14, 2008 | 5:27 pm

turning off depth_enable and setting the blend_mode to 6 5 or 6 1 seems to do the trick. unless i misunderstand…


July 15, 2008 | 1:37 pm

On 14 Jul 2008, at 19:27, Robert Ramirez wrote:
>
> turning off depth_enable and setting the blend_mode to 6 5 or 6 1
> seems to do the trick. unless i misunderstand…
> ______________________________________________

thanks, robert. i tried that and it works.
however, what i liked about mod 6 4 is that the original shape of the
cylinder is still present.
but this obviously is not possible.
volker.


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