[特效] 学习Houdini VEX 有哪些好的经典语句案例 Github VFX代码分享

查看:17848 |回复:7 | 2021-6-26 18:29:54

您需要 登录 才可以下载或查看,没有账号?注册

x
学习Houdini VEX 有哪些好的经典语句案例

有好的案例整理和库吗??

image.png


2021-6-26 18:29:54  
 赞 赞 1

使用道具 登录

7个回答,把该问题分享到群,邀请大神一起回答。
2#
Liuzkai/Houdini
https://github.com/Liuzkai/Houdini/blob/master/VEXpressions.txt
  1. # Lines starting with # are comments and ignored
  2. #
  3. # Each entry starts with no indentation and gives the key used
  4. # by the menu callback.  By convention, this is nodename/parmname.
  5. # Multiply keys can be given for the same entry.
  6. #
  7. # The next line gives the name of the expression.  Its indentation
  8. # level is then used for the remainder of the text.  All the
  9. # code until the next parameter are appended together to make
  10. # the snippet.  All preceeding indentation is removed.
  11. # Note that tabs == 8 is assumed.

  12. #
  13. # POPs
  14. #

  15. popfan/localexpression
  16.     Pass Through
  17.     // Center:
  18.     t = t;
  19.     // Cone angle:
  20.     cone = cone;
  21.     dir = dir;
  22.     windspeed = windspeed;
  23.     airresist = airresist;

  24. popfan/localexpression
  25.     Randomize Airresist by Id
  26.     airresist *= rand(@id);

  27. popfilamentforce/localexpression
  28.     Pass Through
  29.     velscale = velscale;
  30.     airresist = airresist;
  31.     forcescale = forcescale;
  32.     velblend = velblend;

  33. popfilamentforce/localexpression
  34.     Randomize by Id
  35.     airresist *= rand(@id);
  36.     forcescale *= rand(@id);

  37. popforce/localforceexpression
  38.     Randomize Magnitude
  39.     // Assign to a float to force rand to scalar.
  40.     // 0.5 and 1.0 are the min and max scales
  41.     float amt = rand(@id);
  42.     force *= fit01(amt, 0.5, 1.0);

  43. popforce/localforceexpression
  44.     Orbit the Origin
  45.     // length(force) ensures the parameter
  46.     // still has an effect on the scale of
  47.     // the orbit
  48.     vector axis = { 0, 1, 0 };
  49.     vector center = { 0, 0, 0 };
  50.     force = length(force) * cross(@P-center, axis);

  51. popforce/localforceexpression
  52.     Force Until Velocity Reached
  53.     float threshold = 2.0;        // Cut off
  54.     float speed = length(@v);
  55.    
  56.     if (speed > threshold)
  57.     {
  58.         force = 0;
  59.     }

  60. popforce/localforceexpression
  61.     Scale Force According to Proximity to Point
  62.     vector pos = { 0, 2, 0 };        // Point Position
  63.     float radius = 1.0;                // Radius of effect
  64.     float dist = length(@P - pos);
  65.     dist /= radius;             // Normalize distance
  66.     //force *= 1 - clamp(dist, 0, 1); // simple linear force
  67.     force *= smooth(0, 1, 1-dist); // reversed ease in-out force


  68. popforce/localnoiseexpression
  69. popwind/localnoiseexpression
  70.     Amplitude by Age
  71.     // Ease in using age in seconds
  72.     amp *= smooth(0, 1.5, @age);   

  73. popforce/localnoiseexpression
  74. popwind/localnoiseexpression
  75.     Amplitude by Normalized Age
  76.     // Ease in based on percentage life
  77.     amp *= smooth(0, 0.2, @nage);

  78. popforce/localnoiseexpression
  79. popwind/localnoiseexpression
  80.     Amplitude by Speed
  81.     // speed determines amplitude of effect
  82.     float min = 0.5;    // minimum speed threshold
  83.     float max = 1.0;    // maximum speed threshold
  84.     float width = 0.1;  // ease in and out feather width
  85.     float vmag = clamp(length(@v), min, max);
  86.     amp *= smooth(min, min + width, vmag) - smooth(max - width, max, vmag);

  87. popforce/localnoiseexpression
  88. popwind/localnoiseexpression
  89.     Scale by Velocity
  90.     // boost noise for lower velocity values
  91.     amp *= fit(length(@v), 0, 0.5, 2, 1);

  92. popdrag/localdragexpression
  93.     Drag by Proximity to Point
  94.     vector target = {0, 1, 0};         // Target position
  95.     float dist = length(@P - target);  // distance to target
  96.     float radius = 2.0;                       // Effect radius
  97.     dist = fit(dist, 0, radius, 0, 1); // fit to range
  98.     airresist *= dist;

  99. popdragspin/localdragexpression
  100.     Drag by Proximity to Point
  101.     vector target = {0, 1, 0};         // Target position
  102.     float dist = length(@P - target);  // distance to target
  103.     float radius = 2.0;                       // Effect radius
  104.     dist = fit(dist, 0, radius, 0, 1); // fit to range
  105.     spinresist *= dist;

  106. popattract/goalcode
  107.     Spread Goal
  108.     float spread = 0.1;
  109.     float seed = 0.1245;
  110.     goal += spread * (vector(rand(@id+seed)) - 0.5);

  111. popattract/forcecode
  112.     Randomize Force Scale
  113.     float        fmin = 0.1;
  114.     float        fmax = 1.0;
  115.     forcescale *= fit01( rand(@id), fmin, fmax );

  116. popcolor/localconstant
  117.     Color by Velocity Magnitude
  118.     // Color red by velocity magnitude
  119.     float vmax = 1.0;
  120.     color = set(fit(length(@v), 0, vmax, 0, 1), 0, 0);


  121. popcolor/localconstant
  122.     Color by Condition
  123.     // Condition is Position Y greater than 1.
  124.     // Use any attribute test you wish.
  125.     if (@P.y > 1.0)
  126.     {
  127.         color = color;        // Set to parameter value
  128.     }
  129.     else
  130.     {
  131.         color = @Cd;        // Restore
  132.     }

  133. popcolor/localconstant
  134.     Color by Proximity
  135.     vector center = {0,1,0};
  136.     float  radius = 2.0;
  137.     color = fit(length(@P - center), 0, radius, 1, 0); // reverse fit index

  138. popinstance/localexpression
  139.     Random Scale
  140.     // Note you have to turn on the pscale option for this
  141.     // to work!
  142.     pscale *= rand(@id);

  143. popkill/rulecode
  144.     Kill by Condition
  145.     dead = (@P.y > 1) ? 1 : 0;

  146. poplocalforce/localforce
  147.     Randomize Thrust, Lift and Side Slip
  148.     float seed = 0.12345;
  149.     thrust   *= fit01(rand(@id+seed),   0.5, 1);
  150.     lift     *= fit01(rand(@id+seed+0.1),  0.5, 1);
  151.     sideslip *= fit01(rand(@id+seed+0.2), 0.5, 1);

  152. poplookat/code
  153.     Orient to Velocity
  154.     // Force mode to target is direction:
  155.     mode = 1;
  156.     target = @v;

  157. popproperty/localexpression
  158.     Randomize Mass
  159.     float seed = 0.12345;
  160.     mass *= fit01(rand(@id+seed), 0.7, 1);

  161. popproperty/localexpression
  162.     Randomize Particle Scale
  163.     float seed = 0.12345;
  164.     pscale *= fit01(rand(@id+seed), 0.5, 1.5);

  165. popspeedlimit/localexpression
  166.     Randomize Speed and Spin
  167.     float seed = 0.12345;
  168.     speedmin *= fit01(rand(@id+seed),    0.5, 1);
  169.     speedmax *= fit01(rand(@id+seed+.1), 0.5, 1);
  170.     spinmin  *= fit01(rand(@id+seed+.2), 0.5, 1);
  171.     spinmax  *= fit01(rand(@id+seed+.3), 0.5, 1);

  172. popvelocity/localexpression
  173.     Pass Through
  174.     scale = scale;
  175.     v = v;

  176. popvelocity/localexpression
  177.     Scale Velocity
  178.     v = @v * scale;

  179. popvelocity/localexpression
  180.     Project onto Vector
  181.     vector nv = normalize(v);
  182.     v = dot(nv, @v) * nv;

  183. popvelocity/localexpression
  184.     Project onto Plane
  185.     vector nv = normalize(v);
  186.     v = @v - dot(nv, @v) * nv;

  187. popvelocity/localexpression
  188.     Set Speed
  189.     // The implicit multiplication by scale will
  190.     // then set the speed.
  191.     v = normalize(@v);

  192. popspin/localexpression
  193.     Pass Through
  194.     // oldspinspeed also exists giving the
  195.     // previous spin in degrees per second
  196.     spinspeed = spinspeed;
  197.     axis = axis;

  198. popspin/localexpression
  199.     Scale Spin Speed
  200.     // We treat the spinspeed as a scale here
  201.     // and ignore the axis.
  202.     axis = @w;
  203.     spinspeed = oldspinspeed * spinspeed;

  204. popspin/localexpression
  205.     Project onto Vector
  206.     vector naxis = normalize(axis);
  207.     axis = dot(naxis, @w) * naxis;
  208.     // Construct the required spinspeed
  209.     spinspeed = degrees( length(axis) );

  210. popspin/localexpression
  211.     Rotate onto Vector
  212.     vector naxis = normalize(axis);
  213.     axis = dot(naxis, @w) * naxis;
  214.     spinspeed = oldspinspeed;

  215. popspin/localexpression
  216.     Project onto Plane
  217.     vector naxis = normalize(axis);
  218.     axis = @w - dot(naxis, @w) * naxis;
  219.     // Construct the required spinspeed
  220.     spinspeed = degrees( length(axis) );

  221. popspin/localexpression
  222.     Rotate onto Plane
  223.     vector naxis = normalize(axis);
  224.     axis = @w - dot(naxis, @w) * naxis;
  225.     spinspeed = oldspinspeed;

  226. popspin/localexpression
  227.     Set Spin Speed
  228.     // The implicit multiplication by spinspeed will
  229.     // then set the speed.
  230.     axis = @w;

  231. #
  232. # Point Wrangle
  233. #
  234. attribwrangle/snippet
  235.     Add Value to Y Position
  236.     @P += {0,1,0};

  237. attribwrangle/snippet
  238.     Flatten Points in Y
  239.     @P = set(@P.x, 0, @P.z);

  240. attribwrangle/snippet
  241.     Add Random to Y Position:
  242.     @P += set(@P.x, rand(@ptnum), @P.z);

  243. attribwrangle/snippet
  244.     Velocity from Surface Normals
  245.     @v = @N; // v from surface normals

  246. attribwrangle/snippet
  247.     Color from Bounding Box
  248.     @Cd = relbbox(0, @P);

  249. attribwrangle/snippet
  250.     Flared Y Velocity Attributes
  251.     float  vely = 1.0;                // Velocity in Y
  252.     vector offset = {0, 0, 0};       // Offset flare center
  253.     float  seed = 0.12345;              // seed for rand
  254.     float  randamt = 0.1;             // amount of randomness to add
  255.     vector bbox = relbbox(0, P);     // bounding box of point
  256.     bbox += offset;                     // transform bbox by offset
  257.     @v = set(bbox.x, vely, bbox.z);  // set v
  258.     @v += rand(seed+@ptnum)*randamt;  // add noise to v

  259. attribwrangle/snippet
  260.     Percent pscale Along Curve:
  261.     @pscale = @ptnum/(@Npt-1.0);  // initialize pscale
  262.     //@pscale = spline("catmull-rom", index, 0,0,0.25,0.3,1,1);

  263. attribwrangle/snippet
  264.     Normalize Surface Normals
  265.     @N = normalize(@N);  // normalize surface normals

  266. attribwrangle/snippet
  267.     Random Point Color:
  268.     float seed = 0.12345; // seed for rand
  269.     @Cd = rand(seed + @ptnum);

  270. attribwrangle/snippet
  271.     Random Y Velocity
  272.     float seed = 0.12345;              // initialize seed
  273.     @v = set(0, rand(@ptnum+seed), 0); // random velocity in Y

  274. attribwrangle/snippet
  275.     Simple Noise to Y Position
  276.     @P = set(@P.x, @P.y + fit01(noise(@P),-1, 1)*0.5, @P.z);

  277. attribwrangle/snippet
  278.     Add Noise to Position
  279.     float amp = 1;                    // amplitude of noise
  280.     float time = Time * 0.5;          // speed time used in offset
  281.     int seed = 1;                     // seed of noise
  282.     int octaves = 1;                  // octaves for turbulence noise
  283.     vector freq = {1,1,1};            // noise frequency
  284.     vector offset = set(0, time, 0);  // animate offset with time in Y
  285.     vector pos = ptransform("space:current", "space:world", @P);
  286.     // uncomment the noise function below you want to use
  287.     @P += noise(pos * freq + offset + seed) * amp;
  288.     //@P += onoise(pos * freq + offset + seed) * amp;
  289.     //@P += hscript_noise(pos * freq + offset + seed) * amp;
  290.     //@P += hscript_rand(pos * freq + offset + seed) * amp;
  291.     //@P += hscript_turb(pos * freq + offset + seed, octaves) * amp;
  292.     //@P += hscript_sturb(pos * freq + offset + seed, octaves) * amp;

  293. attribwrangle/snippet
  294.     Swap Point Position with Rest
  295.     vector tmp = @P;
  296.     @P = @rest;
  297.     @rest = tmp;

  298. attribwrangle/snippet
  299.     Swap Point Position with UV
  300.     vector tmp = @P;
  301.     @P = @uv;
  302.     @uv = tmp;

  303. attribwrangle/snippet
  304.     Color Based on Threshold
  305.     int condition = (@P.x > 0) ? 1 : 0; // short form if() test
  306.     @Cd = set(condition, 0, 0);        // write condition into red color


  307. attribwrangle/snippet
  308.     Point Group on Threshold
  309.     string group = "mygroup";         // group name to add points to
  310.     int condition = (@P.x > 0) ? 1: 0; // short form if() test
  311.     if (condition)
  312.         addgroup(group, @ptnum);       // if true add point to group
  313.     @Cd = set( condition, 0, 0);      // color if in group

  314. attribwrangle/snippet
  315.     Fetch Second Input Position
  316.     // Second input used as reference geometry
  317.     @P = point(1, "P", @ptnum); // set second input position to first

  318. attribwrangle/snippet
  319.     Fetch Second Input Cd Attribute
  320.     // Second input used as reference geometry
  321.     @Cd = point(1, "Cd", @ptnum);


  322. attribwrangle/snippet
  323.     Fetch Second Input Attribute by id
  324.     // grab attribute by id match from second input
  325.     // id attribute present on both inputs for indexing
  326.     int match_pt = findattribval(1, "point", "id", @id); // matching point
  327.     @P = point(1, "P", match_pt);  // use matching point to fetch attribute

  328. attribwrangle/snippet
  329.     Nearest Point Distance
  330.     // Second input used for reference geometry
  331.     int closept = nearpoint(1, @P);          // get point number of near point
  332.     vector value = point(1, "P", closept);// get position of near point
  333.     @dist = length(@P - value);           // export distance from nearest point
  334.     @Cd = set(@dist, 0, 0);

  335. #
  336. # Attribute Wrangle
  337. #
  338. attribwrangle/snippet
  339.     Color from Bounding Box
  340.     @Cd = relbbox(0, @P);

  341. attribwrangle/snippet
  342.     Random Point Color:
  343.     float seed = 0.12345; // seed for rand
  344.     @Cd = rand(seed + @ptnum);

  345. attribwrangle/snippet
  346.     Color Based on Threshold
  347.     int condition = (@P.x > 0) ? 1 : 0; // short form if() test
  348.     @Cd = set(condition, 0, 0);        // write condition into red color

  349. attribwrangle/snippet
  350.     Point Group on Threshold
  351.     string group = "mygroup";         // group name to add points to
  352.     int condition = (@P.x > 0) ? 1: 0; // short form if() test
  353.     setpointgroup(geoself(), group, @ptnum, condition);
  354.     @Cd = set( condition, 0, 0);      // color if in group

  355. attribwrangle/snippet
  356.     Fetch Second Input Cd Attribute
  357.     // Second input used as reference geometry
  358.     // Use prim and @primnum to get a matching primitive attribute.
  359.     @Cd = point(1, "Cd", @ptnum);

  360. attribwrangle/snippet
  361.     Fetch Second Input Attribute by id/name

  362.     // grab attribute by id match from second input
  363.     // id attribute present on both inputs for indexing
  364.     int match_pt = findattribval(1, "point", "id", @id); // matching point
  365.     @P = point(1, "P", match_pt);  // use matching point to fetch attribute

  366.     // grab attribute by name attribute
  367.     // int match_prim = findattribval(1, "prim", "name", @name); // matching name
  368.     // @Cd = prim(1, "Cd", match_prim);

  369. attribwrangle/snippet
  370.     Nearest Point Distance
  371.     // Second input used for reference geometry
  372.     int closept = nearpoint(1, @P);          // get point number of near point
  373.     vector value = point(1, "P", closept);// get position of near point
  374.     @dist = length(@P - value);           // export distance from nearest point
  375.     @Cd = set(@dist, 0, 0);

  376. attribwrangle/snippet
  377.     Grow Hairs
  378.     vector dir = { 0, 1, 0 };
  379.     // dir = @N;        // grow in normal direction
  380.     float len = 1.0;
  381.     int   steps = 10;
  382.     float jitter = 0.1;
  383.     float seed = 0.12345;

  384.     vector        pos = @P;
  385.     int                pr = addprim(geoself(), "polyline");

  386.     // Start the curve with our point
  387.     addvertex(geoself(), pr, @ptnum);
  388.     for (int i = 0; i < steps; i++)
  389.     {
  390.         pos += dir * len / steps;
  391.         pos += (vector(rand( @ptnum + seed )) - 0.5) * jitter;

  392.         // Clone our point to copy attributes
  393.         int pt = addpoint(geoself(), @ptnum);
  394.         // But write a new position
  395.         setpointattrib(geoself(), "P", pt, pos);

  396.         // Connect the new point to our curve.
  397.         addvertex(geoself(), pr, pt);
  398.         seed += $PI;
  399.     }

  400. attribwrangle/snippet
  401.     Get Neighbouring Points into Attribute
  402.     i[]@neighbours = neighbours(0, @ptnum);

  403. attribwrangle/snippet
  404.     Average Neighbouring Points
  405.     int n[] = neighbours(0, @ptnum);
  406.     vector avgP = @P;

  407.     // Loops over all elements of n, setting pt
  408.     // to be the value of each element
  409.     foreach (int pt; n)
  410.     {
  411.         avgP += point(0, "P", pt);
  412.     }

  413.     // +1 because we included ourself.
  414.     avgP /= len(n)+1;
  415.     @P = avgP;

  416. #
  417. # VEX Deform
  418. #
  419. deformationwrangle/snippet
  420.     Pass Through
  421.     pos = pos;
  422.     xform = xform;

  423. deformationwrangle/snippet
  424.     Twist
  425.     // Hit the Plug button to generate the UI
  426.     // and change axis.
  427.     vector axis = chv('axis');
  428.     vector center = chv('origin');
  429.     float  rate = chf('rotations_per_distance');

  430.     // Find where we are from the center along axis.
  431.     axis = normalize(axis);
  432.     float dist = dot(pos - center, axis);
  433.     float amt = $PI * 2 * rate * dist;

  434.     matrix3        rot = 1;
  435.     rotate(rot, amt, axis);

  436.     pos -= center;
  437.     pos *= rot;
  438.     pos += center;


  439. #
  440. # Volume Wrangle
  441. #
  442. volumewrangle/snippet
  443.     Create Points where Positive
  444.     // You may want to turn on Bind Each to Density to
  445.     // apply to all volumes.
  446.     if (@density > 0)
  447.     {
  448.         addpoint(geoself(), @P);
  449.     }

  450. #
  451. # Popsteer POPs
  452. #
  453. popsteeralign/localforceexpression
  454.     Randomize Force Scale per Particle
  455.     forcescale = rand(@ptnum);

  456. popsteeralign/localforceexpression
  457.     Randomize Fov per Particle
  458.     usefov = 1;
  459.     fov = rand(@ptnum)*120;

  460. popsteercohesion/localforceexpression
  461.     Randomize Force Scale per Particle
  462.     forcescale = rand(@ptnum)*10;

  463. popsteercohesion/localforceexpression
  464.     Randomize Fov per Particle
  465.     usefov = 1;
  466.     fov = rand(@ptnum)*120;

  467. popsteerobstacle/localexpression
  468.     Randomize Search Distance per Particle
  469.     frontsearchdistance = rand(@ptnum)*10;
  470.     sidesearchdistance = rand(@ptnum)*5;

  471. popsteerobstacle/localexpression
  472.     Scale Avoidance Force by Pscale
  473.     avoidanceforcescale = 10*1/@pscale;
  474.     breakingforcescale = 10*1/@pscale;

  475. popsteerpath/localforceexpression
  476.     Randomize Path Variance and Force per Particle
  477.     forcescale = rand(@ptnum)*10;
  478.     pathvariance = rand(@ptnum)*5;

  479. popsteerseek/localgoalexpression
  480.     Randomize Goal Position per Particle
  481.     // Random goal position in (-10,10) range
  482.     goal.x = (2*rand(@ptnum)-0.5)*10;
  483.     goal.z = (2*rand(@ptnum)+123)-0.5)*10;

  484. popsteerseek/localforceexpression
  485.     Randomize Force Scale per Particle
  486.     forcescale = rand(@ptnum)*10;

  487. popsteerseparate/localforceexpression
  488.     Randomize Force Scale per Particle
  489.     forcescale = rand(@ptnum)*10;

  490. popsteerseparate/localforceexpression
  491.     Randomize Fov per Particle
  492.     usefov = 1;
  493.     fov = rand(@ptnum)*180;

  494. popsteerseparate/localforceexpression
  495.     Randomize Fov per Particle
  496.     usefov = 1;
  497.     fov = rand(@ptnum)*180;

  498. popsteerwander/localforceexpression
  499.     Randomize Force XZ direction per Particle
  500.     force.x = (2*rand(@ptnum)-0.5)*10;
  501.     force.z = (2*rand(@ptnum)+123)-0.5)*10;


  502. sprite/localexpression
  503.     Pass Through
  504.     // 0: Uses offset/size
  505.     // 1: Uses textureindex/row/col
  506.     cropmode = cropmode;
  507.     textureoffset = textureoffset;
  508.     texturesize = texturesize;

  509.     textureindex = textureindex;
  510.     texturerow = texturerow;
  511.     texturecol = texturecol;

  512.     spriterot = spriterot;
  513.     spritescale = spritescale;

  514. #
  515. # Group Expression
  516. #
  517. groupexpression/snippet
  518.     Within radius 1 sphere of origin
  519.     length(@P) < 1.0

  520. groupexpression/snippet
  521.     X coordinate less than 0
  522.     @P.x < 0

  523. groupexpression/snippet
  524.     30% chance
  525.     rand(@elemnum) < 0.3

  526. #
  527. # Attribute Expression
  528. #
  529. attribexpression/snippet
  530.     Pass Through
  531.     self

  532. attribexpression/snippet
  533.     Constant Value
  534.     value

  535. attribexpression/snippet
  536.     Multiply by Constant Value
  537.     self * value

  538. attribexpression/snippet
  539.     Add Constant Value
  540.     self + value

  541. attribexpression/snippet
  542.     Random
  543.     rand(@elemnum)

  544. attribexpression/snippet
  545.     Random Scale of Value
  546.     value * float(rand(@elemnum))

  547. attribexpression/snippet
  548.     Random Offset of Value
  549.     value + rand(@elemnum)

  550. attribexpression/snippet
  551.     Second Input's Position
  552.     @opinput1_P

  553. attribexpression/snippet
  554.     Flatten Vector
  555.     set(self.x, 0, self.z)

  556. attribexpression/snippet
  557.     Uniform Parameter on Polyline
  558.     vertexprimindex(0, @vtxnum) / (primvertexcount(0, @primnum) - 1.0)

  559. attribexpression/snippet
  560.     Subtract Center of First Input
  561.     self - getbbox_center(0)

  562. attribexpression/snippet
  563.     Spherify P
  564.     lerp(self,(normalize(self - getbbox_center(0)) * ch("radius")) + getbbox_center(0),ch("Amt"))

  565. attribexpression/snippet
  566.     Spherify N
  567.     @P - getbbox_center(0)

  568. attribexpression/snippet
  569.     Morph to 2nd Input
  570.     lerp(self, point(1,"P",@ptnum),ch("Amt"))

  571. # VEX Channel
  572. #
  573. channelwrangle/snippet
  574.     Lookat
  575.     matrix m1 = lookat(0, @t-chv("lookatvec"), chv("upvec") );

  576.     // Rotate the lookat to point to a different axis.
  577.     int mode = chi("rorder");
  578.     if( mode>=0 && mode<=6 )
  579.         m1 = maketransform( /*trs_order=*/0, /*rot_order=*/mode, /*t=*/0, /*r=*/chv("angle"), /*s=*/1 ) * m1;

  580.     @r = cracktransform(0,0,1,0,m1); // Overwrite only the rotation

  581. channelwrangle/snippet
  582.     Identity
  583.     @t = 0;
  584.     @r = 0;
  585.     @s = 1;

  586. channelwrangle/snippet
  587.     Distance
  588.     chopTRS c0 = c->fetchInput(0);
  589.     chopTRS c1 = c->fetchInput(1);

  590.     // Compute the vector betweem first and second input.
  591.     // and scale it with a radius parm
  592.     vector dt = normalize(c1.t - c0.t)* chf('radius');

  593.     @t = c0.t + dt; // Translation from first input + radius vector
  594.     @r = c1.r;      // Rotation from second input
  595.     @s = c0.s;      // Scale from first input
点击此处复制文本


回复 收起回复
2021-6-26 18:32:38   回复
 赞 赞 3

使用道具 登录

5#
https://github.com/Liuzkai/Houdini
Liuzkai的VEX快捷代码指令库



回复 收起回复
2021-6-26 18:37:16   回复
 赞 赞 4

使用道具 登录

6#
https://github.com/qLab/qLib
快捷工具扩展库
回复 收起回复
2021-6-26 18:38:40   回复
 赞 赞 3

使用道具 登录

8#
楼上牛逼,点赞
回复 收起回复
2021-6-27 14:13:42   回复
 赞 赞 2

使用道具 登录

9#
能一建写出来的代码,你敢用?
回复 收起回复
2021-6-28 09:07:22   回复
 赞 赞 3

使用道具 登录

10#
回复 收起回复
2023-2-26 12:52:52   回复
 赞 赞 1

使用道具 登录

CG 游戏行业专业问题

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表