Get vertex colour via python

Get vertex colour via python

Totila_
Enthusiast Enthusiast
823 Views
4 Replies
Message 1 of 5

Get vertex colour via python

Totila_
Enthusiast
Enthusiast

Hi there,

 

Is there any possibility to read/set the vertex colour of a geometry node via python?

You can get indices, positions, normals etc. but I couldnt find anything in the docs for the vertex colour.

 

Kind regards

T

0 Likes
Accepted solutions (1)
824 Views
4 Replies
Replies (4)
Message 2 of 5

bryan_martin_morris
Contributor
Contributor

I'm figuring they hide somewhere in here:

vertices.PNG

 

I'm beginning to play with this here, by making a box and then getting the positions and then the texcoords

 

#get vertices colours for later nefarious work

 

boxy_colour = vrFieldAccess(boxy.fields().getFieldContainer("texCoords7"))

 

which will then require a list of vertex colours with rgb and gamma as vec4f or something along those lines. I'm just getting started so it's slow going...

 

check Simon Nagel's 'load point cloud script' (that I'm using for a lunch hour project that is taking more than my lunch hour 🙂 )

 

https://github.com/simonnagel/VRED-loadPointCloudPTS

 

He accesses the vertices and maps the rgb from a point cloud, so i guess this might help put you on track.

0 Likes
Message 3 of 5

Totila_
Enthusiast
Enthusiast

Thanks for the tip. Looks good.

 

But it seems this only works for poly geometry, not for nurbs.. For those there is not texCoords7 in the node editor.

0 Likes
Message 4 of 5

michael_nikelsky
Autodesk
Autodesk
Accepted solution

We don´t support vertex colors in our materials at the moment. The texCoord7 uses the baked indirect illumination and ambient occlusion and is therefore not used like a normal vertex color.

As for NURBS: A Shell does not have any data at all, everything is stored in the child surfaces.



Michael Nikelsky
Sr. Principal Engineer
0 Likes
Message 5 of 5

Totila_
Enthusiast
Enthusiast

Thanks for your reply. @michael_nikelsky 

 

This was helpful for me to do what I want by reading the vertex colour from the shells' children.

Thanks also to @bryan_martin_morris for the starter.

0 Likes