[PD] GEM: multiply with movie

IOhannes m zmoelnig zmoelnig at iem.at
Tue Oct 18 09:12:17 CEST 2005


lorenz kirnbauer wrote:
> Thoralf Schulze wrote:
> 
>> It doesn't pay to think photoshop when using gem. the
>> gem-way of doing things is actually the more elegant
>> one.

i woudldn't say that.
it is like claiming that pd is more elegant than pro-tools; they are
just completely different things, even though something similar might
come out (sound with pd/protools, images with gem/photoshop)


> i think i found a better - photoshop-like :) - solution..
> there is an example of this solution attached to this mail:
> 
> the pix_multiply function just works for pix.. that was my problem.
> you can't multiply a movie with a "normal" rectangle-object this way..

which is actually by design.
pix-functions work on pixel-data: very low level; most of the time quite
CPU-expensive.
most of Gem's functionality (in the domain where the strenghts of Gem
are) are rather high-level (and cheap in terms of CPU!)


as a rule of thumb one could say, that you should try to avoid to use
pixel-processing whenever possible: e.g. if you want to fade out an
image use [color] instead of [pix_gain]


> 
> my workaround:
> 
> i took a black image in the same dimensions as my movie-material and
> used pix_rectangle to draw a rectangle on this black dummy-image.
> 
> so i could use pix_multiply to combine the movie with the black-image i
> painted the rectangle on..
> 
> 
> this works quite great for making visuals :D
> 

well, if you have spare CPUs...


when working with Gem you should first try to think what you really want
to achieve. don't think how you would do it in other applications (at
first).
then try to do what you want to achieve.
and then find some workarounds to make it work ;-(



there are several ways to do what you want to do.
a) use texture-coordinates [pix_coordinates] to tell the rectangle
(canvas) which part of the texture should be displayed.

b) use something like thoralf proposed: cover the parts of the image
that you don't want to see (think of a landscape behind a wall with a
moving window; since Gem (openGL) uses positive (additive) geometry, you
(unfotunately) cannot just cut out the window, so you have to build the
changing walls)

c) use [pix_crop] to cut out a sub-image of an image

d) use [pix_multiply]

e) use shaders to bind the texture-coordinates to the world rather than
the manipulated object.

(a), (b) and (e) work on the GPU (your gfx card) and are fast;
(c) and (d) work on the CPU (which cannot be used for other things in
the meantime)
for (e) you need some understanding of how shaders work in openGL
(you'll have to write your own), and you need the CVS-version of Gem.



mfg.a.sdr
IOhannes




More information about the Pd-list mailing list