Get Vertex Color from Mesh

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 12 December 2010   #1
Get Vertex Color from Mesh

Hi Guy,

i have a newbie question. I have look here at other Treads, but i don´t unterstand. How can i get a the Vertex Color of Vertex[24] from a Mesh?

my_color = my_mesh.getVertexcolor[24] ( don´t work )

mfg
hot chip
 
Old 12 December 2010   #2
my_color = getVertColor my_mesh 24
 
Old 12 December 2010   #3
hi AnoPrkl,


thank you for help. I have convert my Poly Object to a Mesh Object, but it comes a error message: "vertex index out of range"

for i=1 to vertex_anzahl do (

vertex_farbe = getVertColor th_mesh i

)

and what must i do, when my mesh is a editable Poly, because my mesh is a editable Poly Object.

mfg
hot chip
 
Old 12 December 2010   #4
You can use,

$.SetVertexColor (color 128 128 128) #VertexColor

This is for an EditablePoly Object, but you have to be in sub-object level 1 I believe with the vertex selected, otherwise it doesn't work.

Hope that helps.
 
Old 12 December 2010   #5
hi matthew


thank you. How can i say Vertex 24 for example, and i must read all Vertex of Poly-Object and check if the Color Red, Green or Blue.
 
Old 12 December 2010   #6
That command works on the selected vertex.

So you would loop through all the verts like...

(

local theMesh = selection[1]
setCommandPanelTaskMode #modify
subObjectLevel = 1

For v = 1 to theMesh.mesh.verts.count do
(
theMesh.EditablePoly.SetSelection #Vertex #{v}
local theVertColor = theMesh.getVertexColor #VertexColor
print theVertColor
)

)
 
Old 12 December 2010   #7
Super It work´s. Thank you very much.

mfg
hot chip
 
Old 12 December 2010   #8

check MXS Help:
Editable_Poly Mapping Methods
Vertex Colors
polyop.getVertsByColor
polyop.setVertColor

the Vertex Color Channel is Map Channel #0


(
	n = converttopoly (box())
	polyop.setvertcolor n 0 #{1,4} red 
	polyop.setvertcolor n 0 #{2,5,7} blue 
	polyop.setvertcolor n 0 #{3} green 
	polyop.setvertcolor n 0 #{6,8} black
	
	format "red:%\n" (polyop.getvertsbycolor n red 0 0 0 channel:0) 
	format "blue:%\n" (polyop.getvertsbycolor n blue 0 0 0 channel:0) 
	format "green:%\n" (polyop.getvertsbycolor n green 0 0 0 channel:0) 
)




Last edited by denisT : 12 December 2010 at 07:29 PM.
 
Old 12 December 2010   #9
Hi Denis,


thank you to the code. From time to time, i understand more and more.
 
Old 12 December 2010   #10
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 05:16 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.