Forums > Jitter

jit.gl.text2d On jit.gl.videoplane


ds.
June 2, 2006 | 11:01 am

Im trying to overlay some text on a gl video plane, but what results is the text within small boxes.

I think there must be a simple way to solve this, but suggestions from the past lists dont work or I might be missing something.

using osx 10.4.6 and Max/Msp 4.5.7 Jitter 1.5.2

Example Patch

max v2;
#N vpatcher 408 129 1243 504;
#P origin 0 21;
#P window setfont "Sans Serif" 9.;
#P message 572 267 43 196617 size $1;
#P number 572 242 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 528 57 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 347 105 14 196617 1;
#P newex 347 81 48 196617 loadbang;
#N vpreset 2;
#X append 1 2 1 220 328 toggle int 1 ; 8 56 73 toggle int 0 ; 9 56 118 number int 0 ; 14 56 438 flonum float 0. ; 16 57 484 flonum float 0. ; 18 178 481 flonum float;
#X append 1 2 1. ; 20 178 517 flonum float 1. ; 21 178 553 flonum float 0. ; 22 178 590 flonum float 1. ; 26 57 528 flonum float 0.02 ; 27 242 572 number int 92 ;;
#P preset 347 130 17 33;
#P flonum 590 178 35 9 0. 1. 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 553 178 35 9 0. 1. 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 517 178 35 9 0. 1. 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 483 197 144 196617 pak color 0. 0. 0. 1.;
#P flonum 481 178 35 9 0. 1. 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 381 148 54 196617 text Hello;
#P flonum 484 57 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 441 104 99 196617 pak position 0. 0. 1.;
#P flonum 438 56 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 362 311 82 196617 jit.gl.text2d foo;
#B color 5;
#P message 275 145 29 196617 stop;
#P newex 92 285 218 196617 jit.window foo @depthbuffer 1 @size 320 240;
#P newex 73 105 43 196617 jit.qball;
#P number 118 56 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 73 56 15 0;
#P newex 73 82 55 196617 metro 20;
#P newex 73 134 139 196617 t b erase b;
#P newex 73 168 80 196617 jit.gl.render foo;
#P message 240 145 28 196617 read;
#P newex 201 180 104 196617 jit.qt.movie 320 240;
#B color 5;
#P newex 201 216 95 196617 jit.gl.videoplane foo;
#B color 5;
#P toggle 328 220 15 0;
#P message 329 254 83 196617 depth_enable $1;
#P connect 8 0 7 0;
#P connect 7 0 10 0;
#P connect 10 0 6 0;
#P connect 6 0 5 0;
#P fasten 6 1 5 0 142 159 78 159;
#P connect 9 0 7 1;
#P fasten 4 0 3 0 245 171 206 171;
#P connect 6 2 3 0;
#P fasten 12 0 3 0 280 171 206 171;
#P connect 3 0 2 0;
#P connect 1 0 0 0;
#P connect 24 0 25 0;
#P connect 25 0 23 0;
#P connect 0 0 13 0;
#P connect 28 0 13 0;
#P connect 17 0 13 0;
#P connect 15 0 13 0;
#P connect 19 0 13 0;
#P connect 24 0 17 0;
#P connect 14 0 15 1;
#P connect 16 0 15 2;
#P fasten 18 0 19 1 486 195 521 195;
#P connect 26 0 15 3;
#P fasten 20 0 19 2 522 195 554 195;
#P connect 27 0 28 0;
#P fasten 21 0 19 3 558 195 587 195;
#P fasten 22 0 19 4 595 195 620 195;
#P pop;


June 2, 2006 | 9:05 pm

On Jun 2, 2006, at 4:01 AM, darcysays wrote:

> Im trying to overlay some text on a gl video plane, but what
> results is the text within small boxes.
> I think there must be a simple way to solve this, but suggestions
> from the past lists dont work or I might be missing something.

Your problem is as follows: in automatic mode there is currently no
way to enforce the sequence of object rendering. In your patch your
text is rendered first, and then the videoplane. This obscures the
text in the absence of depth testing (default off for jit.gl.text2d).

If depth_enable is *on*, however, then the videoplane will not render
anywhere the text is closer to the camera (for the entire
quadrilateral which has been rendered for each glyph, as the depth
buffer is written to based on the geometry, not the glyph’s alpha
channel).

The correct way to do this in the current version of Jitter is to
disable automatic mode and then explicitly render the text last,
without depth testing. Example is below.

In the next version of Jitter there are two new attributes which
would be of use in these types of scenarios:

- @layer : in automatic mode object rendering order is
sorted from low to high based on layer number, default 0. (note:
objects in the same layer are not guaranteed any specific rendering
order)
- @depth_clear : before rendering object, clear the depth
buffer (useful for having 3D layers which need depth testing internal
to rendering it’s geometry–e.g. a sphere–but wish to override the
depth buffer for all previously rendered objects)

jit.gl.render drawclients message also has a new optional layer
number argument for only drawing objects in a specifc layer.

Coming soon to a theater near you (no please don’t ask for dates).

-Joshua

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 632 327 43 196617 size $1;
#P number 632 302 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 588 117 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 407 165 14 196617 1;
#P newex 407 141 48 196617 loadbang;
#N vpreset 2;
#P preset 407 190 17 33;
#P flonum 650 238 35 9 0. 1. 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 613 238 35 9 0. 1. 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 577 238 35 9 0. 1. 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 543 257 144 196617 pak color 0. 0. 0. 1.;
#P flonum 541 238 35 9 0. 1. 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 441 208 54 196617 text Hello;
#P flonum 544 117 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 501 164 99 196617 pak position 0. 0. 1.;
#P flonum 498 116 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 388 371 146 196617 jit.gl.text2d foo @automatic 0;
#B color 5;
#P message 335 205 29 196617 stop;
#P newex 152 345 218 196617 jit.window foo @depthbuffer 1 @size 320 240;
#P newex 133 165 43 196617 jit.qball;
#P number 178 116 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 133 116 15 0;
#P newex 133 142 55 196617 metro 20;
#P newex 133 194 66 196617 t b b b erase;
#P newex 133 303 80 196617 jit.gl.render foo;
#P message 300 205 28 196617 read;
#P newex 261 240 104 196617 jit.qt.movie 320 240;
#B color 5;
#P newex 261 265 163 196617 jit.gl.videoplane foo @automatic 0;
#B color 5;
#P toggle 389 300 15 0;
#P message 389 334 83 196617 depth_enable $1;
#P connect 6 1 13 0;
#P connect 6 2 3 0;
#P connect 6 2 2 0;
#P fasten 6 3 5 0 192 240 138 240;
#P connect 6 0 5 0;
#P connect 10 0 6 0;
#P connect 19 0 13 0;
#P connect 15 0 13 0;
#P connect 17 0 13 0;
#P connect 28 0 13 0;
#P connect 0 0 13 0;
#P connect 3 0 2 0;
#P fasten 22 0 19 4 655 255 680 255;
#P fasten 21 0 19 3 618 255 647 255;
#P connect 27 0 28 0;
#P fasten 20 0 19 2 582 255 614 255;
#P connect 26 0 15 3;
#P fasten 18 0 19 1 546 255 581 255;
#P connect 16 0 15 2;
#P connect 14 0 15 1;
#P connect 24 0 25 0;
#P connect 24 0 17 0;
#P connect 25 0 23 0;
#P connect 1 0 0 0;
#P fasten 12 0 3 0 340 231 266 231;
#P fasten 4 0 3 0 305 231 266 231;
#P connect 9 0 7 1;
#P connect 7 0 10 0;
#P connect 8 0 7 0;
#P window clipboard copycount 29;



ds.
June 3, 2006 | 3:15 am

Thanks for that solution.

However I am finding that this now causes some video break up/artifacts. It is noticable when there are moving objects within the footage. It happens on both jit.qt.movie and jit.qt.grab on that patch you sent.

Unfortunaetly screen captures I have taken don’t show the problem, but can you or anyone else reproduce it? Does the video in that patch play smoothly without artifacts?

PowerBook G4/1.0GHz
1GIG RAM
ATI Mobility Radeon 9000 (AGP 4X) / 64 MB of DDR SDRAM
OSX 10.4.6 and Max/Msp 4.5.7 Jitter 1.5.2


June 3, 2006 | 9:54 pm

I can’t reproduce this problem on the development version I’m using
at the moment. However, if you send jit.glvideoplane the message:
"sendtexture mode static" does the problem disappear?

Otherwise, could you be more specific about what artifacts you are
seeing? Is it just from interlaced movies, or input devices?

If you’re unfamiliar with how to tell if it is simply from interlaced
source, please read the following:

http://neuron2.net/LVG/interlacing.html

FWIW, this page seems like a good resource for people interested in a
variety of video issues. Just came across it for the first time
today. Will add to our resource guide.

-Joshua


June 4, 2006 | 6:54 am

another excellent explanation/solution for deinterlacing (and much more)

http://www.100fps.com/



ds.
June 4, 2006 | 11:05 am

Yes that works! Thank you.

Just incase your interested this was the distortion I was getting: http://darcy.co.nz/artifacts.mov
Quite a bit different from the normal interlacing drama.

Thanks again.


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