PDA

View Full Version : Face pixels


CastorBlast
12-16-2008, 11:16 PM
Hello everyone,

How do I access each pixel of a given face? I already know how to work with Map Faces and Map Vertices, but I want to go further. It's not enough for me to apply a colour to a Map Vertex. I need to be able to apply a different colour to each pixel of the face.

Thank you.

RobGalanakis
12-17-2008, 12:29 AM
Faces don't have 'pixels' because they are geometry. You can access their barycentric coordinates, though, of geometry faces and uv faces. You could probably calculate some idea of pixels based on the uv information and a given texture size (so a certain barycentric coordinate you know will lie at a certain spot in UV space, which you can then figure out what pixel on a texture it corresponds to).

JHN
12-17-2008, 08:11 AM
Maybe he's referring to each pixel defined in a face by it's UV coordinates? If you know about map faces and vertices you would have enough to know how to get to it. There's a sample in the mxs docs about a bitmap painter, maybe not exactly what you want, but could be a starting point?

-Johan

CastorBlast
12-17-2008, 09:01 PM
Hello, and thank you both for your answers.

I read the bitmap painter example. It doesn't help me much because it detects the spot where the user clicks, and then paints it. I need to see how to work the other way round.

I've been reading about barycentric coordinates, and I think this is what I need. Now I have to learn how to work with it.

Could someone provide me with a code sample? For example, a short code that paints half a face of one colour, and the other half with another?

CGTalk Moderation
12-17-2008, 09:01 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.