No More Retake

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

メニュー

Houdini:SubFrame

Houdini回。
フレームとフレームの間の値が欲しい時があります。

SubFrame_01上の絵でいうと、1.57613…の小数点以下の部分、0.57613…ですね。
この値があると、今、フレームとフレームの間のどのあたりかを知ることができます。
この例だと、0.57613…なので、フレーム間のちょうど半分よりすこし次のフレーム寄りだということが分かります。
フレーム間を補間するときに便利だったりします。

この値をVOPで求めます。
ネットワークはfloor(VOP)を使ってこう。

SubFrame_02

floor(VOP)は入力されたFloat値に対して、小数点以下を切り捨てて整数値を返してくれます。
エクセルとかにもfloor関数ありますね。あれと一緒です。

SubFrame_03

表で例示してみると、こんな感じ。

A floor(A)
7.9634 7
105.1257 105
-5.9123 -5

 

floor(VOP)で得られた整数値を、現在のフレームから引くと、欲しかった小数点以下を得ることができます、と。こんな具合に。

A A – floor(A)
7.9634 0.9634
105.1257 0.1257
-5.9123 0.9123

 


私は、ずっとこうやってフレームの小数点以下の値を求めてたんですが、最近、Fraction(VOP)というのがあることを知りました。
上記の小数点以下を求めることができるノードです。

SubFrame_04

ネットワークは繋ぐだけでOK。

SubFrame_05

便利ネ。


VEXで書くとこうネ。

#floor
f@subframe_A = @Frame - floor(@Frame);
#fraction
f@subframe_B = frac(@Frame);

 

以上!

関連記事

  1. 2015.12.18

    Houdini:Marble Ball

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

このサイトについて

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

RSS

follow us in feedly

Archives

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

スポンサードリンク

言語切り替え

  • English (United States)
  • 日本語

スポンサードリンク

言語切り替え

  • English (United States)
  • 日本語

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%2F2016%2F02%2F08%2Fhoudini_subframe%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%2F2016%2F02%2F08%2Fhoudini_subframe%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