VEX

// C:\Users\ (UserName) \Documents\houdini19.0\houdini.env
EDITOR = "C:\Users\(UserName)\AppData\Local\Programs\Microsoft VS Code\Code.exe"
  • 절대로 point() 또는 prim() 표현식을 사용하지 마십시오(expressions). VEX 대응만 사용하십시오.

  • https://www.tokeru.com/cgwiki/?title=HoudiniVex

  • https://www.sidefx.com/learn/vex/

  • Attribute VOP

    • Vex 시각화 그래프
  • Attribute Wrangle

    • Vex 코딩
    • Wrangle
      • This is a very powerful, low-level node that lets experts who are familiar with VEX tweak attributes using code.
      • https://english.stackexchange.com/questions/263712/what-does-come-on-lets-wrangle-up-the-cattle-mean
      • 소나 말들 관리

type@attribute

  • geometry sheet에서 확인 가능
i@myint         = 5;                                        // i | int

f@myfloat       = 12.234;                                   // f | float
u@myvector2     = {0.6, 0.5};                               // u | float2
v@myvector      = {1,2,3};                                  // v | float3
p@myquat        = {0,0,0,1};                                // p | float4

2@mymatrix2     = {1,2,3,4};                                // 2 | float2x2
3@mymatrix3     = {1,2,3,4,5,6,7,8,9};                      // 3 | float3x3
4@mymatrix4     = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}; // 4 | float4x4

s@mystring      = 'a string';                               // s | string

d@mydict        = {};                                       // d | dict
d@mydict['key'] = 'value';

i[]@connected_pts = neighbours(0, @ptnum);                  // i[] | int[] array

https://sites.google.com/site/fujitarium/Houdini/sop/copy-sop

// https://www.sidefx.com/docs/houdini/vex/snippets.html
vector x0 = point(0, "P", @ptnum);
vector x1 = point(1, "P", @ptnum);


float dist = distance(x0, x1);
vector dir = normalize(x1 - x0);
vector next = x0 + dir * (dist / 2.0f);

@P = next;

@

@elemnum현재 element@id
@vtxnum현재 vertex (linear)흔히 말하는 버텍스
@ptnum현재 point포인트(중복된 포지션이 없다)
@primnum현재 primitive단일 엔티티(면 or 구 ...)
@numelem총 element 갯수
@numvtx총 vertex 갯수
@numpt총 point 갯수
@numprim총 primitive 갯수
@TimeFloat time ($T)
@FrameFloat frame ($FF)
@SimTimeFloat simulation time ($ST), only present in DOP contexts.
@SimFrameFloat simulation frame ($SF), only present in DOP contexts.
@TimeIncFloat time step (1/$FPS)
$VTXvertexprimindex(0, @vtxnum);

geometry attribute

GeometryidintA unique element ID
namestring이름
Pvector포지션
Nvector노말
vvector속도 Velocity
pieceint조각
pscalefloatUniform scaling factor
scalevectorWhereas pscale is a single uniform scaling factor in all axes
RenderinguvvectorUV
ShaderCdvectordiffuse 색깔
Csvectorspecular 색깔
Crvectorreflect 색깔
Cevectoremission 색깔
Ctvectortransmit 색깔
AlphafloatAlpha transparency override. The viewport uses this to set the alpha of OpenGL geometry.
roughfloatRoughness override.
fresnelfloatFresnel coefficient override.
shadowfloatShadow intensity override.
sbiasfloatShadow bias override.
Particleorientvector4Quaternion orientation of a particle
upvectorRepresents the up vector of a particle’s local space
rotvector4An additional offset-quaternion applied after all other attributes

Expression

$BBX = relbbox(@P).x
$BBY = relbbox(@P).y
$BBZ = relbbox(@P).z
Expression Local Variables
$PT포인트 번호
$PR프리미티브 번호
$CY현재 사본 번호
$TX,$TY,$TZ트랜스폼
$TX2,$TY2,$TZ2두번째 입력에서 오는 포인트 위치
$NX,$NY,$NZ노말
$CR,$CG,$CB,$CA칼라
$VX,$VY,$VZ벨로시티
$BBX,$BBY,$BBZ바운딩 박스 내 점 위치(0 ~ 1)
$CEX,$CEY,$CEZ기하학의 중심
$AGE파티클 수명(초)
$LIFE파티클 수명(0 ~ 1)
$XMIN,$XMAX,$YMIN,$YMAX,$ZMIN,$ZMAX경계 범위
$SIZEX,$SIZEY,$SIZEZ경계 크기

ch

  • https://www.sidefx.com/docs/houdini/vex/functions/ch.html
chramp(channel,ramppos, time)조절 가능한 2차원 그래프 채널이 생긴다

Function

clamp(value, min, max)
fit(value, fromMin, fromMax, toMin, toMax)
point(geometry, attribute_name, pointnumber)geometry는 입력 순서(0부터)
포지션 - minpos(geometry, point)point에서 geometry에 레이를 쐈을시 가장 먼저 닿는 부분의 포지션
포인트 - nearpoint(geometry, pt)geometry에 있는 모든 point 중에서 pt와 가장 가까운 point의 번호
Vector getbbox_size(geometry)Computes the size of the bounding box for the geometry.
vector currP = @P;

// 현재 위치에서 1번 지오메트리와 맨 처음으로 마주치게될 포지션.
vector hittedP = minpos(1, currP);

// 현재 위치에서 1번 지오메트리에 있는 모든 포인트 중 가장 가까운 포인트번호.
int nearPointNumber = nearpoint(1, currP);

// 1번 지오메트리의 nearpointNumber의 _id값.
int id = point(1, "_id", nearPointNumber);

quaternion

vector4 orient = quaternion(maketransform(@N, @up));
vector euler  = quaterniontoeuler(orient,XFORM_XYZ);
v@rot = degrees(euler);
// maketransform: https://www.sidefx.com/docs/houdini/vex/functions/maketransform.html

vector4  quaternion(matrix3 rotations)
vector4  quaternion(float angle, vector axis)
vector4  quaternion(vector angleaxis)

vector  qrotate(vector4 quaternion, vector v)
vector  degrees(vector nums_in_rads)
vector  quaterniontoeuler(vector4 orient, int order)

vector4  slerp(vector4 q1, vector4 q2, float bias)

vector4  qmultiply(vector4 q1, vector4 q2)
Constant nameRotation Order
XFORM_XYZRotate order X, Y, Z
XFORM_XZYRotate order X, Z, Y
XFORM_YXZRotate order Y, X, Z
XFORM_YZXRotate order Y, Z, X
XFORM_ZXYRotate order Z, X, Y
XFORM_ZYXRotate order Z, Y, X