video input on Triangular Sprite or billboard!

ramona777's picture

Hey guys,

I'm trying to create a triangular sprite or billboard so I can project video input on to it. In effect only see one triangular half of the sprite. Been looking at masking and alpha channels etc. but not getting there. Any comments?

Thanks very much in advance

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

dust's picture
Re: video input on Triangular Sprite or billboard!

without actually rendering onto a triangle strip you could just add a triangular mask to a billboard. a mask is just a black and white image. you could make a triangle mask with two black sprites rotated inside a render in image patch with a clear patch set to white for the background. then use that image as an input mask to billboard or sprite your video image is connected to. or just use any image editor to derive the triangle it doesn't matter black = alpha mask.

ramona777's picture
Re: video input on Triangular Sprite or billboard!

thank you very much :)

idlefon's picture
Re: video input on Triangular Sprite or billboard!

What dust suggested is a good way of acheiving what you're after.

Of course you can use a GL Quad from the kineme GL pack and place two of the vertexes on each other. I guess this is more customizable and I don't it's any more GPU-hungry than a sprite.

ramona777's picture
Re: video input on Triangular Sprite or billboard!

Thanks again, Yes I've tried GL Quad and GL Triangle but somehow their manipulation or transformation is a bit fiddly. Using them for tiling which needs rotation etc in order to make reflection (mirroring of triangles) does not seem to be easy.....maybe I'm not doing it right

gtoledo3's picture
Re: video input on Triangular Sprite or billboard!

What you might want to try is that GL Triangle, but place it inside of a 3D transform environment macro. Then, you can just move it around like a sprite instead of thinking about each point separately.

That said, whenever I do a quad or triangle, more than half the time I wish that there was some kind of global translation or rotation instead of just the corner point controls.

With that in mind, I made this plugin a while ago. It renders a quad (eg., square/polygon) by default, but I've adjusted it to a/b a triangle and quad. It has built in translation and rotation controls, which are handy for just flipping something around to mirror when you've established the basic shape you want.

At some point I'll get around to adding blend mode and depth testing, but for now, pay mind to the layer order you place stuff at. I hesitate to recommend it fully, b/c GL Tools quad and triangle support blend mode and depth testing, but the fact that rotation and translation are built in with this plugin is straightforward to me, and I use it all the time. (I put the source on my site in case anyone feels like doing anything nifty to it.)

PreviewAttachmentSize
GLQuad_gt.plugin.zip11.26 KB
GLQuad_gt_triangle_setting.qtz3.86 KB

ramona777's picture
Re: video input on Triangular Sprite or billboard!

That's really kind. Thank you so much, this would be exactly what I need.

Unfortunately can't open it though. I put GLQuad_gt.plugin in Library->Graphics->Quartz Composer Patches and tried running GLQuad_gt_triangle_setting.qtz but I get GLQuad_gtPlugIn" is missing, tried changing the name still didn't work.

Will try the GL Triangle in 3D Transform as well.

Thanks again

gtoledo3's picture
Re: video input on Triangular Sprite or billboard!

It's a plugin :) so, it would go in the plugins folder instead of patches.

gtoledo3's picture
Re: video input on Triangular Sprite or billboard!

It started occurring to me that if you want a totally stock, no plugin or any jazz approach, you can do something like this (see attachment).

Basically, I'm specifying points with javascript and building up a structure that is a triangle. Then, I'm using the mesh creator and renderer to render the triangle. The mesh renderer has rotation and translation controls on it already (I'm rendering the same triangle structure to 3 different mesh renderers to illustrate that one only needs to build the geometry once). So, this would be the kind of built in geometry-pipeline way of creating a triangle from scratch with built in patches.

PreviewAttachmentSize
triangles.qtz16.33 KB

idmism's picture
Re: video input on Triangular Sprite or billboard!

how to avoid the jagged edges?

gtoledo3's picture
Re: video input on Triangular Sprite or billboard!

Go to QC preferences, hold down option while you're doing it. Go to "(Editor)". Check the box that reads "multisampling". Quit QC, restart.

ramona777's picture
Re: video input on Triangular Sprite or billboard!

Wow, this is great, thank you so much.

BTW should have said, I did try GLQuad_gt.plugin in both Plugins and Patches folders but still the same issue.