top of page

Code snippet: Houdini groom hair chance maps

Ellie Ansell

Used for adding colour attributes to hairs for the hair shader.

  1. Paint maps on the skin, e.g. 'mask_cd_white'

  2. Use Guide Skin Attrib. Lookup to transfer the paint maps to the prim hairs.

  3. Use the code snippet (or similar - depending on if you're using points/prims) to give a chance of assigning a hair with an attribute.

string attr = chs("cd_strays");
string group=chs("coloured");
float attr_val = 0.0;
if(!inprimgroup(0, group, @primnum))
{
    attr_val = prim(0, attr, @primnum);
    if(f@elem<chramp("chance", attr_val))
    {        
        v@Cd = set(1,1,0);
        setprimgroup(0, group, @primnum, 1, "set");
        setprimattrib(0, attr, @primnum, 1, "set");
    }
    else
    {
        setprimattrib(0, attr, @primnum, 0, "set");
    }
}
else
{
    setprimattrib(0, attr, @primnum, 0, "set");
}


167 views0 comments

Recent Posts

See All

Comments


  • LinkedIn // Professional Bio
  • Facebook // ellieansellart page
  • Instagram // Informal fun
  • Vimeo

© 2020 by Ellie Ansell

Happily created using Wix.com

bottom of page