View Full Version : Maya API - Vertex Query
02-16-2005, 07:17 PM
Hi all, not sure if this should be here or in the maya section but any way.
For a university project i am trying to recreate photo mosaic pictures in 3d - sampling pixel information from an object in the openGL view in maya - basically i need to know the colour at a random point, for example at each vertex so i can assign a sprite with a corresponding colour texture and reproduce the objects colour from a folder of images assigned to sprites that are at each vertex.
This is really hard to explain and im sure it makes no sense to anyone. Ask any questions and i'll try and clear things up a bit. but basically any ideas on if/how this could be done would be great!
Many thanks - Alex.
02-20-2005, 08:00 PM
Do you really need to write a plugin for this? This could easily be done within Maya using the colorAtPoint command.
02-22-2005, 04:27 AM
haha, i hope you are not one of my students, we set this as a tutorial......
within the devkit, you should find an iffpixel command plugin. That will allow you to query a pixel colour from an iff image. If thats a bit shonky (ie, you don't like iff images) then there is a an example plugin on my website that uses MImage to get the pixel colours. (www.robthebloke.org) [function3 i think in the maya API section]
the mel command, getFileList should help for the files in the directory part, and pretty much everything else can be done in mel.....
02-22-2005, 04:34 AM
read it again. Am i now right in assuming that you want to view the maya viewport as a photo mosaic? If you just need to render it out and do the mosaic on that then that would be easy.
If however you need a real time photo mosaic within maya, then things may get nasty. In this case you may need your own context + callbacks to determine when the frame gets rendered. You'd also need to use glReadPixels to get the frame buffer info, then finally re-render the mosaic. Yeah, that might be very very nasty indeed.
02-22-2005, 07:58 AM
If I was going to do this I'd probably do it by writing a node derived from MPxLocator that could draw the texture onto itself as a quad. Then you could position several of them in an array to build a mosaic.
It's pretty trivial to get Maya to load an image using the MImage class. You could wrap this in a node, then connect that to your locators to provide the image data. From there you can do any funky stuff you want using maya. You could even animate them all flying around and forming different shapes and stuff. If you wanted to get really fancy you could use rendered images instead of photos with normal, depth and opacity information and do a sort of 2.5D mosaic. That's be cool...
02-22-2005, 11:24 AM
i'm sure i've seen this done with a shading network, ok, this is only during rendering, but it might make the process easier.
03-05-2005, 02:04 AM
Robert Bateman you have a great website.
03-05-2005, 01:55 PM
thank you. Glad you found it useful
03-05-2005, 01:55 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.
vBulletin v3.0.5, Copyright ©2000-2015, Jelsoft Enterprises Ltd.