Invisiprim/ja

Invisiprim
インビジプリム は特殊なテクスチャを持ったプリムです。このテクスチャは透明で、アルファ レイヤ (透明度を表現するレイヤ) を含んだアイテムを全て隠してしまう効果があります。これには水、雲、パーティクル、全てのデフォルト アバターの構成要素が含まれます。インビジテクスチャを含んだテクスチャは、ビューアの 透明オブジェクトを強調表示 設定でも赤く表示されません。(メニューの ビュー > 透明オブジェクトを強調表示)
インビジプリムは、ファーリーやそのほか人間以外のアバター制作で、人間のデフォルト アバターの一部を隠すため、しばしば使われます。
テクスチャはスクリプトによってのみ設定可能で (llSetTexture を参照のこと)、その Key は "38b86f85-2575-52a9-a531-23108d8da837" または "e97cf410-8e61-7005-ec06-629eba4cd1fb" です。
インビジプリムに対する批判
テクスチャがアバターの一部だけでなく、周囲の一部までも隠してしまうため (いわば望ましくない X 線効果)、インビジプリムの代用として、デフォルト アバターにアルファ レイヤーを加えられるようにするという要求が VWR-812 で出されました。この機能に関するリクエストは ここ で見られます。
例のスクリプト
以下は、invisiprim を作成するための簡単な LSL/ja コードです。 使用するには、インベントリに新しいスクリプトを作成し、そこに以下のコードを貼り付けます。 次に、スクリプトをプリムにドラッグして、インビシプリムに変更します。
<source lang="lsl2"> default {
state_entry() { // Make this prim an invisiprim. llSetPrimitiveParams([PRIM_BUMP_SHINY, ALL_SIDES, PRIM_SHINY_NONE, PRIM_BUMP_NONE, PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>, 1.0, PRIM_TEXGEN, ALL_SIDES, PRIM_TEXGEN_DEFAULT, PRIM_TEXTURE, ALL_SIDES, "e97cf410-8e61-7005-ec06-629eba4cd1fb", ZERO_VECTOR, ZERO_VECTOR, 0.0]); // Delete ourselves from the prim; we are no longer needed. llRemoveInventory(llGetScriptName()); }
} </source>
これがどのように機能するかを理解したいプログラマーのために、上記と同じコードを以下に再掲し、コードが何を行っているかを示す徹底的なコメントを付けます。
<source lang="lsl2"> default {
state_entry() { // Here we explain the whys and wherefores of making an invisiprim. // We use an llSetPrimitiveParams call to set a lot of options at once. llSetPrimitiveParams([ // Turn off bump mapping and shiny. If either of these options are on, // they will have their usual effects, causing the invisiprim to be seen // even though the special effects of hiding alpha textures continues. PRIM_BUMP_SHINY, ALL_SIDES, PRIM_SHINY_NONE, PRIM_BUMP_NONE, // Set the color and alpha to white and full opacity, respectively. // Color has no effect on the invisiprim, but the prim must be FULLY opaque, // or the special effect is lost. PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>, 1.0, // For completeness we set mapping to default, even though it has no effect. PRIM_TEXGEN, ALL_SIDES, PRIM_TEXGEN_DEFAULT, // Now we set the actual texture, which makes this an invisiprim. We set it on // all sides, but there is nothing stopping you setting it only on certain faces. // We also set repeat, offset and rotation to zero. PRIM_TEXTURE, ALL_SIDES, "e97cf410-8e61-7005-ec06-629eba4cd1fb", ZERO_VECTOR, ZERO_VECTOR, 0.0 ]);
// Now remove this script from the prim to save on server resources. The script is only // required in order to set the texture; it does not need to stay in the prim for the // invisiprim's special effects to continue. llRemoveInventory(llGetScriptName()); }
} </source>
注意
グラフィックの設定で、高度な照明モデルがONの場合は、インビジプリムが機能しません