smallarrows.GIF
titlebar_image

Vertex Color Polygons     

Setup Arnold to Render Vertex Color
You might need Mesh Display->Soften Edge to interpolate colors between vertices

Select the
Sphere
     Under Arnold in the Attribute Editor
          Select Export Vertex Colors
Or use
Choose Windows->General Editors->Attribute Spread Sheet

     Choose the Arnold Tab
     Click in the field under Ai Export Colors where it reads off
         Type 1 for on, 0 equals off.


Color Set
Select the Sphere
Mesh Display->Color Set Editor
     Select New
          Apply and Close  (defaults are good)
               Note the name of the new
colorSet
               Close the window


New Shader
hypershade  Windows->Rendering Editors->Hypershade

Right Mouse over sphere, select Assign Favorite Material->Standard Surface

Select the new Standard Surface Shader from the Hypershade window.
Select
Graph->Input and Output Connections


Create 2 Utilities
Search for the Utility names under Create
     aiUserDataColor and aiMultiply


Select aiUserDataColor
In the Attribute Editor
     Add the name of your colorSet to Attribute     (spelling counts)


Connect
Out Color to aiMultiply use Input 1

Connect aiMultiply Out Color to StandardSurface use Base Color

vertex_color_hypershade



Project the Vertex Color from the Sphere onto any other model

Create another mesh.

Line up the Sphere over the 2nd mesh.

Select the Sphere first and then the other mesh.

Select
Mesh->Transfer Attributes->
option.jpg
     UV Sets off (default on)
     Color Sets:  Current  (default All)
     Sample space: World
     Search method:  Closest to point



Try moving the original sphere, you can also hide it.


Scripts
//Adjust Ai Export Colors with a script
string $sel[] = `ls -sl`;
for($i=0;$i<size($sel);$i++) {
print ($sel[$i]+"\n");
setAttr ($sel[$i]+".aiExportColors") 1;  
}; 


//Clear vertices with current color
artAttrPaintVertexCtx -e -clear `currentCtx`; 


//Import a map
//if it doesn't work import 1 map by hand first
artImportAttrMapCB artAttrPaintVertexCtx "C:/Users/jj/Desktop/maps/filename.0001.tif" "map";


//Export a map
//if it doesn't work export 1 map by hand first
artExportAttrMapCB artAttrPaintVertexCtx "C:/Users/jj/Desktop/export.tif" "map";


//Animate Vertex Colors with image map sequence, with padding 4
//Save file before running. Give this a minute to run
polyColorPerVertex -r 0 -g 0 -b 0 -a 1 ;  //primes the artisan brush, may need to import an image by hand
$n = "win_vertex_map"; //name of image file
proc string pad(float $n){return ($n<1000)? ( ($n<100)?( ($n<10)?"000"+$n:"00"+$n ):"0"+$n ) : $n+"";}
$tdir="/\/\server3/\f/\maya/\images/\folder/"+$n+"/";  //server path, folder and file have the same name
$i = 0;
for ($i = 1; $i <= 11; $i++) {
$file = ($tdir+$n+"."+pad($i)+".tif");
currentTime ($i);
artImportAttrMapCB artAttrPaintVertexCtx  $file "mapfile";
SetKeyframeForVertexColor;
print($file+"\n");}



//To delete vertex animation and start over:
DeleteHistory;  
ModifyCurrentSet;
polyColorPerVertex -r 0 -g 0 -b 0 -a 1 ;




//Animate Vertex Colors with image map sequence, no PADDING
polyColorPerVertex -r 0 -g 0 -b 0 -a 1 ; //primes the artisan brush
$n = "win_vertex_map"; //name of image file
$tdir="/\/\server3/\f/\maya/\images/\folder/"+$n+"/";  //server path, folder and file have the same name
$i = 0;
for ($i = 1; $i <= 720; $i++) {
$file = ($tdir+$n+"."+($i)+".tif");
currentTime ($i);
artImportAttrMapCB artAttrPaintVertexCtx  $file "mapfile";
SetKeyframeForVertexColor;
print($file+"\n");}




//assign vertex colors by vertex number
//if it doesn't work import 1 map by hand first
string $sel[] = `ls -sl`;
for($i=0;$i<size($sel);$i++) {
print ($sel[$i]+"\n");
select -r ($sel[$i]+".vtx[0]") ;
polyColorPerVertex -rgb 1.0 0.0 0.0;
select -r ($sel[$i]+".vtx[1]") ;
polyColorPerVertex -rgb 0.0 1.0 0.0;
select -r ($sel[$i]+".vtx[2]") ;
polyColorPerVertex -rgb 0.0 0.0 1.0;
if (`exists ($sel[$i]+".vtx[3]")`) {
    select -r ($sel[$i]+".vtx[3]") ;
    polyColorPerVertex -rgb 1.0 1.0 1.0;}
};       

© 1988-2024 36 years