基本的な Pixel Bender 3D カーネルの書き方に続いて、Pixel Bender 3D でテクスチャマッピングを行う方法をご紹介します。
テクスチャマッピングは見た目に関する処理なので、関係するのはマテリアルカーネルだけです。
早速、マテリアルカーネルの定義です。まずは、変数の宣言からです。今回新しく登場しているのは input image です。
{
input vertex float4 UVCoord;
interpolated float4 interpolatedUVCoord;
input image4 inputImage;
output float4 finalColor;
}
input image の変数宣言の記述は、ちょっと input vertex とは異なります。"input image 型 変数名" ではなくて、"input 型 変数名" です。その際、型として、image1, image2, image3, image4 のどれかを指定するという制限がつきます。
