No More Retake

3DCG屋さん向けTips&Referenceサイト

メニュー

Houdiniレシピ:Wrangle Memo 01

Wrangle(SOP)のVEX例文。メモより抜粋。

よう使うglobal変数

//SOP
@Cd      //Point Color
@P       //Point位置
@v       //Point Velocity
@ptnum   //処理中のPoint番号
@pscale  //Particle Scale
@numpt   //Point総数
@N       //法線

//時間
@Frame;  //Frame
@Time;   //Time

 

Attribute読み書きあれこれ

//Type別
f@Float = 1.0; //float
i@ID = @ptnum;  //int
v@Vec = {0,1,2};//vector
u@UV = {4,5};   //vector2
s@Text = "name";//string

//個別にアクセス(位置)
@P.x = @P.x + rand(@ptnum);
@P.y = anoise(@P.y);
@P.z = fit01(@P.z,0,5);

//個別にアクセス(色)
@Cd = {1,0,0};
@Cd.g = @Cd.g+1;

 

Pointを追加する

vector pos = {0,0,0};
addpoint(geoself(), pos); 

 

Primitiveを追加する(Line)

int prim = addprim(geoself(), "polyline");
addvertex(geoself(), prim, 0);
addvertex(geoself(), prim, 1);

(ポイント0とポイント1を繋ぐ)


Primitiveを追加する2(Line)

int nPoly = chi("n");
int startPt = chi("stratPoint");

if(@ptnum == startPt){
    int prim = addprim(0, "polyline");
    for(int i=0; i<nPoly; i++){
        addvertex(0, prim, @ptnum+i);
    }
}

(指定したスタートポイントから、指定した数のポイントを繋ぐ)


Primitiveを追加する3(面)

int prim = addprim(geoself(), "poly");
addvertex(geoself(), prim, 0);
addvertex(geoself(), prim, 1);
addvertex(geoself(), prim, 2);

(ポイント0とポイント1とポイント2を繋いで面を作る)


 

Primitiveを追加する4(面)

int nPoly = chi("n");

if(@ptnum%3 == 0){
    int prim = addprim(0, "poly");
    for(int i=0; i<nPoly; i++){
        addvertex(0, prim, @ptnum+i);
    }
}

(ポイント3つごとに面をはる)


 

Pointを消す

if (@ptnum%5==0){
    removepoint(geoself(),@ptnum);
}

(ptnumが5の倍数のpointを消す)


 

Primitiveを消す

if (@primnum%2==1){
    removeprim(geoself(), @primnum, 1);
}


 

Groupを作る

if(@ptnum &amp;amp;amp;amp;lt; chi('threshold')){
    i@group_mygroup=1;
}
if(@ptnum == 10){
    i@group_mygroup=0;
}

@group_*の形式でグループを設定、参照できる。*には任意のグループ名。int型。
グループに属するかどうかは@group_* == 1でチェックできる。
グループに追加する場合は、i@group_*=1
グループから外す場合は、i@group_*=0

 

Group作る(別解)

string gpName = "testGroup";

for(int i=0; i &amp;amp;lt; @numpt; i++){
  if(@P &amp;amp;lt; 0){
        setpointgroup(geoself(), gpName, @ptnum, 1 ,"set");
    }
}

(primitiveのグループを作るときは”setprimgroup”)


 

 

記述からパラメータ作成
HoudiniWrangleSample

先に書いといて、横っちょにあるボタンを押すと、記述したパラメータを作成してくれる。
初期値はParameter Interfaceで設定しろってことかな。


 

使用バージョン:Houdini 14
Wrangleの記述方法はバージョンによって変更される場合があるので注意が必要。

 

関連記事

  1. 2015.12.18

    Houdini:Marble Ball

コメントをお待ちしております

このサイトについて

3DCG Tipsサイト。Houdiniの記事が多めです。

RSS

follow us in feedly

Archives

  • 2024 (1)
  • 2023 (2)
  • 2022 (9)
  • 2021 (14)
  • 2020 (46)
  • 2019 (17)
  • 2018 (33)
  • 2017 (29)
  • 2016 (36)
  • 2015 (64)
  • 2014 (54)
  • 2013 (60)
  • 2012 (55)

スポンサードリンク

言語切り替え

スポンサードリンク

言語切り替え

Houdiniを使えるようになる本


Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /usr/home/nomorere/nomoreretake.net/wordpress/wp-content/themes/n1-custom/functions/social.php on line 132

Warning: file_get_contents(): Failed to enable crypto in /usr/home/nomorere/nomoreretake.net/wordpress/wp-content/themes/n1-custom/functions/social.php on line 132

Warning: file_get_contents(http://api.facebook.com/restserver.php?method=links.getStats&urls=http%3A%2F%2Fnomoreretake.net%2F2015%2F09%2F25%2Fhoudini_wrangle_memo%2F): failed to open stream: operation failed in /usr/home/nomorere/nomoreretake.net/wordpress/wp-content/themes/n1-custom/functions/social.php on line 132

Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /usr/home/nomorere/nomoreretake.net/wordpress/wp-content/themes/n1-custom/functions/social.php on line 132

Warning: file_get_contents(): Failed to enable crypto in /usr/home/nomorere/nomoreretake.net/wordpress/wp-content/themes/n1-custom/functions/social.php on line 132

Warning: file_get_contents(http://api.b.st-hatena.com/entry.count?url=http%3A%2F%2Fnomoreretake.net%2F2015%2F09%2F25%2Fhoudini_wrangle_memo%2F): failed to open stream: operation failed in /usr/home/nomorere/nomoreretake.net/wordpress/wp-content/themes/n1-custom/functions/social.php on line 132