It’s great to have such a tool like Maya’s Paint Effects.
A short and simple way to use the leaves color randomization feature as a texture modulation source:
- Create your beautiful plant with Paint Effects. 🙂
- Use the leaf color randomization feature – you can see it in the viewport.
(brush node -> Tubes -> Growth -> Leaves)
- Convert your plant to polygons with the usual settings:
Vertex color mode: Color (this is necessary to get vertex color)
Quad output: on
Poly limit: 0 (means no limit)
(Modify -> Convert Paint Effects to Polygons) - Select the leaf geometry and turn on the vertex color preview for that.
(mesh node -> Mesh Component Display -> Display Colors)
- You can change any attributes on the stroke or the brush node.
For example change the leaf color randomization attributes. - Create a userDataColor node (Arnold: aiUserDataColor, Redshift: rsUserDataColor) Type in the name of the color set, the default is colorSet1.
- For Arnold: Don’t forget to turn on the Export Vertex Data option (Arnold section -> Export) in every mesh node!!!! (Update)
- Now you can use the userDataColor node to modulate/blend/mix texture colors
via some kind of layered color node (Arnold: aiLayerRgba, Redshift: rsColorLayer)
Tip:
- If you want to use not just the RGB values but the Alpha channel as well you should edit the mtoa.mtd file (solidangle\mtoadeploy\2018\plug-ins) and find the [node user_data_rgba] line and change the maya.hide BOOL parameter to false.
That way you’ll get a aiUserDataRgba node with an out alpha output. - You can paint Vertex Color by hand and use that via a userDataColor node.
- You can generate vertex color on any geometry for each polyShell. It’s useful to modulate color, roughness, UV offset, or any other attribute via vertex color.I created a very crude MEL script to do that (really ugly and slow).
Here it is:
//Select an Object than run this script
{
float $r = rand(0.0,0.2);
float $g = rand(0.3,0.5);
float $b = rand(0.0,0.2);
polyColorPerVertex -r $r -g $g -b $b;
}
{
ConvertSelectionToFaces;
float $rRatio = rand(0.0005,0.1);
polySelectConstraint -m 3 -t 0x0008 -r 1 -rr $rRatio;
polyConvertToShell;
float $r = rand(0.0,0.2);
float $g = rand(0.3,0.5);
float $b = rand(0.0,0.2);
polyColorPerVertex -r $r -g $g -b $b;
polySelectConstraint -m 0 -t 0x0008 -r 0;
select -cl;
toggleSelMode;
toggleSelMode;
changeSelectMode -object;
}
{
ConvertSelectionToFaces;
float $rRatio = rand(0.0005,0.05);
polySelectConstraint -m 3 -t 0x0008 -r 1 -rr $rRatio;
polyConvertToShell;
float $r = rand(0.0,0.2);
float $g = rand(0.3,0.5);
float $b = rand(0.0,0.2);
polyColorPerVertex -r $r -g $g -b $b;
polySelectConstraint -m 0 -t 0x0008 -r 0;
select -cl;
toggleSelMode;
toggleSelMode;
changeSelectMode -object;
}
Please don’t be shy. Tell me If you have a great python script for vertex color randomization for each polyShell in Maya.
Cheers, D