easy way to read color of faces(material) .....or read the color of the texture ?

easy way to read color of faces(material) …or read the color of the texture ?

someone know a method ?

i want know for example what is the color of face “X” , or pixel X.

we say that distinguish the black and white would have good start anyway…

You can read vertex color. But it will not help you much a it usually is set to plain white.
There is no easy way to read texture colors. I remember a thread regarding this some years ago. But I never followed it, so I can’t tell if they found a solution.

Look out for martish HDR ,and color bleeding ,he uses some sort of color reading.

I believe martinsh’s color bleeding script used a GLSL shader to check the color of the screen at certain coordinates. You could also do this with the bge.texture module (make a texture of the screen render, and then grab the color of the pixel at the coordinate you want).

If you want to check a texture color, you can do so with the bge.texture module as well (you would open it from file, and then look in the array to see the color at the specified X / Y co-ordinate. I made a function to do this, if you need to.

If you need to get the color of a face, it should be possible with a ray cast. A ray cast can return the UV information of the hit face, which you can use to get the color of the texture as highlighted above.

If you want to check a material’s diffuse color, you might be able to do so with Python. If that’s what you need, I can look into it more-so.

Monster’s method also is good, assuming you’ve set the vertex colors manually before.