Select Page

Following on from part 1, in this example we take things a small step further. Instead of just sampling the mesh for the closest normal to the MASH point, we sample the mesh for the closest point and normal, this call has the added benefit of also returning the closest face to the MASH point. Once we have the closest face we can use the MItMeshPolygon class to give us colour information about that face. I appreciate MFnMesh can also give us the information we want here, I’m just showing one of many ways of doing this.

This is a fairly simplistic example of using colour sets, meshes of course can contain multiple colour sets, and these can be set via methods on MFnMesh so with a little extra work (left to the reader) you can read multiple colour sets if you wish.

This script also includes the normal sampling from the previous script, and as before, you can just copy and paste this Python script onto the Python node and hit the run button, make sure your MASH network has a mesh based distribution, otherwise there will be no mesh to sample.