PDA

View Full Version : how to sample image file pixels?


ddawson
02-14-2002, 01:27 AM
Does anyone know how to sample the pixel color of a file texture in mel? I need to be able to specify the pixel location and get the rgb color values. I would think this would be pretty straight forward, but I can't seem to find it anywhere.

Thanks,

Daniel

jfrancis
01-15-2005, 03:41 AM
Within the rendering context, I think you can do this (http://www.digitalartform.com/archives/2005/01/sample_a_maya_f.html):

Outside the rendering context, I'm not sure.

This issue should be a no-brainer, but for some reason it's much harder than it should be.

MattBirkett-Smith
01-15-2005, 07:25 PM
I think you want the command colourAtPoint :

colorAtPoint -o RGB -u 0 -v 0 file1;



which could be used something like:

float $colour[3] = `colorAtPoint -o RGB -u $U -v $V $filename`;

where $colour is an array containg the RGB values, $U is the wanted $U cord, $V is the wanted V cord and $filename is the name of the file texture.


Hope this helps

Nicool
01-16-2005, 08:05 AM
If you want an example of use of colorAtPoint, I've coded a script using it : mapSpread.mel (you could find at http://ndhaussy.free.fr//temp/spreadArticle/#mapSpread )

jfrancis
01-19-2005, 02:38 AM
I upgraded directly from Maya 4 to 6. Is that why I missed this command, or has it been there all along?

At any rate, I'm glad I revived this 2002 thread. Very educational for me.

CGTalk Moderation
01-19-2006, 03:00 AM
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.