# RGB Vertex Color Average

**URL:** https://forum.highend3d.com/t/rgb-vertex-color-average/4482
**Category:** Maya
**Tags:** mel
**Created:** [March 29, 2004, 9:46pm UTC](https://forum.highend3d.com/t/rgb-vertex-color-average/4482 "2004-03-29T21:46:24Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![ikaris](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/i/ad7895/32.png) [@ikaris](https://forum.highend3d.com/u/ikaris)
#### Post date: [March 29, 2004, 9:46pm UTC](https://forum.highend3d.com/t/rgb-vertex-color-average/4482/1 "2004-03-29T21:46:24Z")

</div>

Hello everyone,

it seems quite simple in theory, but...

if I have a series of vertexes selected, how can I find out the average of all their vertex colors values ?

I am using "polyColorPerVertex -q -rgb" to determine their RGB values, but how can I put all of that together and get the average ?

I imagine I have to line up the R, the G and the B and average them... I could use a Matrix, but of course, the number of vertices selected changes every time, so would I have to create matrices on the fly ?

Any suggestions would be greatly appreciated !

Thanks ![](http://www2.highendnet.com/forums/icons/smile.gif)

---

<div class="post-metadata">

### Author: ![warpcat](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/w/c89c15/32.png) [@warpcat](https://forum.highend3d.com/u/warpcat)
#### Post date: [March 29, 2004, 11:44pm UTC](https://forum.highend3d.com/t/rgb-vertex-color-average/4482/2 "2004-03-29T23:44:34Z")

</div>

I have a UI that does this. Just use a for loop: For each vert selected, get the value, then add it's value to the previous one. when the loop's done, take the total, and divide by the number of verts selected. shazzam, color averaged.
