PDA

View Full Version : [Maya API] How to put a custom image in viewport not using Image Plane?


benio33
06-26-2009, 01:25 PM
Hi,

I've made a custom HeadsUpDisplay using MPxLocatorNode class for displaying custom information to screen. I managed to put custom data to the screen, with grayed out areas, for playblasts. The thing is now I need to put a logo on my gray box, and now is my question.

How can I put a bitmap to the viewport, NOT using Image Plane? When I use image plane the alpha areas of the image also "cut out" what's underneath i.e. my OpenGL drawn graphics, which should be my backround of the image.

Thanks,
Benio

benio33
07-06-2009, 09:13 AM
Ok, maybe what I need CAN be done with custom Image plane, but I need to know what am I doing wrong ...

this is my issue using image plane:

http://img443.imageshack.us/img443/2351/whatisee.jpg

I would like it to be like THIS:

http://img401.imageshack.us/img401/5017/whatiwishtosee.jpg

I've put the bitmap using MPxImagePlane class with alpha as transparency. Maybe there is another way of putting the image over an OpenGL drawn object as the background dark gray bar is? I'm open for ANY options.

Thanks!

Keilun
07-07-2009, 05:50 PM
Have you tried looking up how to draw a bitmap with transparency in OpenGL? That'd probably be a good start.

MPxLocatorNode provides you with an opportunity to draw inside the draw loop. So as long as you know how to display a bitmap with transparency, and the locator is visible, it should only involve plopping that code in and drawing it to the appropriate location in screenspace.

benio33
07-07-2009, 07:02 PM
Hello Keilun, this is exactly what I thought, and I started this thread "MPxLocatorNode draw bitmaps?" :)) The thing is, I can't make that $&^*^&$^** BAD locator to display bitmaps :(

Keilun
07-07-2009, 07:46 PM
It's not the locator. It's that you need to do it yourself. The locator has no awareness of what you're trying to draw, it only gives you the opportunity to draw inside the draw loop. You need to implement the smarts for everything else. It looks like you've managed to get the text and such going.

For transparent bitmaps, you need to do some research to learn how to do this in OpenGL. Maya won't do this for you.

The other thread you created gave some hints on what to do. Try googling:

drawing transparent bitmaps in OpenGL

That should give you a good start.

mascio
05-17-2010, 09:27 AM
Please, can you suggest me how do you make your viewport watermark?
Could you share code please!?

I am trying by Maya Python Api.

If you want I could send you my private email.

Thank you.

mascio

benio33
05-18-2010, 03:04 PM
I'm affraid I left the code in the Crazy Sardine company I left last December. This is pretty easy to implement - use the Custom Locator example provided with maya. Work out how it works, put an OpenGL image drawing class into the draw method of the locator, and you're done.

mascio
05-19-2010, 05:55 AM
I wrote my first watermark plugin part in python, but i have problem with near/far clipping plane that fragment my openGL drawing. I am not an expert. If I send you my custom locator code, can you please help me?

Thank You.

I'm affraid I left the code in the Crazy Sardine company I left last December. This is pretty easy to implement - use the Custom Locator example provided with maya. Work out how it works, put an OpenGL image drawing class into the draw method of the locator, and you're done.

benio33
05-20-2010, 05:37 PM
mascio, I was just thinking ... if you just wish to implement a watermark to your viewport it is enough you connect an imageplane with a half transparency to your cameras where you want the watermark to appear. You can connect as many image planes to one camera as you wish, you just have to do it with connection editor as attributes window in Maya doesn't give that opportunity. Image plane attribute in cameras is an object array. I had to draw my stuff as my vieport data changed over time, but just for watermark I'd use mel to connect a watermark to my camera for example as ImagePlane[1] instead the default ImagePlane[0] where Maya connects image plane by default.

CGTalk Moderation
05-20-2010, 05:37 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.