<aside> 🤬
I love xGen Core, I’m a sucker for long hair and Xgen Core makes it relatively easy to get great results when grooming long hair. Problem is that Xgen is poorly integrated with Maya and VERY buggy so you are pretty much guaranteed a bad experience using it and Autodesk just abandoned Xgen since 2015ish.
How the fuck Autodesk just abandons a tool with so much potential is beyond me. Whoever is making decisions over there is an A-grade moron. I was told Autodesk is banking on Bifrost to replace it. How? No idea. Screw Bifrost and Autodesk.
I’m moving to Houdini.
</aside>
Anyways if you are still here, and using Xgen, I’ll share the expressions I use often.
Xgen expressions looks very complicated at the start but there isn’t a whole lot to learn. Don’t just copy, try to understand the structure, experiment and soon enough you can create some fairly complex thing setups with only a few bits of code.
Global Expressions are called as functions not as variables! For a global variable called global_var. Using $global_var WON’T work. Use global_var() instead. They are very useful to change values inside the clump/noise modifiers without having to dig deep into the interface, just go to the global tab and move some sliders.
Ternary operators are REALLY pretentious if/else statements.
#Syntax 1
[condition] ? [if_true] : [if_false]
#Explanation
[is X true] ? [then do this] : [ if not, do this instead]
#Example 1
(1 < 5) ? $a : $b # 1 is smaller than 5, so true. $a will be the return value.
#Example 2
(1 > 5) ? $a : $b # 1 is smaller than 5, so false. $b will be the return value.
Use this to create a curve gizmo in your interface, $t is the hair attribute that maps the output value along the hair length. Ignore the other values, just save the expression and adjust curve using the interface, it will make more sense when you try it out.
$a = curve($t,0,0,4,1,1,3);
$a
You'll need create a new folder containing a .ptex file manually in the xGen folder. Best way to do it is just duplicate any existing map folder and rename it with the [MAPNAME] of your choice.
$a=map('${DESC}/paintmaps/[MAPNAME]');#3dpaint,50.0
$a
$seed = 0; #0,1000
$min = 0.050; #0.0,1
$max = 0.150; #0.0,1
rand($min,$max,$seed)
$maskCoverage=95; #0,100
$maskSeed = 0; #0,100
$mask = rand(0,100,$maskSeed) < $maskCoverage ? 1 : 0;
$mask