2010/05/16

ビルボード効果

オブジェクトが常にカメラの正面を向いていることを
ビルボード効果という。
たとえば擬似パーティクルや木の表現に使う。

以下サンプル。processinで実装されてる。
http://www.mentalgifts.net/article/146253887.html
追加で外部ライブラリをいれる。
http://www.gdsstudios.com/processing/libraries/ocd/
http://hg.postspectacular.com/toxiclibs/downloads



processing用テクスチャ関数

processingのテクスチャ用関数つくってみた。
引数、x,yが座標
sがサイズ
imgがテクスチャ情報(先に宣言)

Tex(0,0,100,tex);
みたいにつかう。

void Tex(float x,float y,float s,PImage img){
   noStroke();
  beginShape();
    texture(img);
 vertex(x, y, 0, 0);
 vertex(x+s, y, 120, 0);
 vertex(x+s, y+s, 120, 120);
 vertex(x, y+s, 0, 120);
 endShape();
}