AddPresetTextureLayer

導入

v4.0

詳細

特定の入力オブジェクトに新しいテクスチャ レイヤを追加し、指定されたシェーダをレイヤに追加します。 レイヤの詳細については、「AddTextureLayer」を参照してください。

スクリプト構文

oReturn = AddPresetTextureLayer( PresetObj, [InputObjs], [Name], [After], [Reference] );

戻り値

作成された場合は、新しい TextureLayer オブジェクトを戻します。

パラメータ

パラメータ タイプ 説明
PresetObj 文字列 アタッチするシェーダを表すシェーダ プリセットの 1 つ
InputObjs 文字列 テクスチャ レイヤの追加先のコンテナ(シェーダまたはマテリアル)のリスト。 すべてのコンテナが単一のレンダ ツリーに含まれている必要があります。

デフォルト値: 現在選択されている値

Name 文字列 新しいレイヤに使用する名前。 既存のレイヤが渡された場合には、この引数は無視されます。
After Boolean True の場合は、新しいテクスチャ レイヤはリファレンス レイヤの後に挿入されます。 False の場合は、リファレンス レイヤの前に挿入されます。 リファレンス レイヤがないときは、True の場合はコンテナのリストの最後に、False の場合はリストの最初に追加されます。

デフォルト値: True

Reference 文字列またはオブジェクト 新しく追加されたレイヤが配置されるスタック内の位置を示す、リファレンス テクスチャ レイヤ。 レイヤはリファレンス レイヤの前後に挿入されます。 指定しない場合には、新しいレイヤは "After" 引数の値に応じて先頭または末尾に追加されます。

VBScript の例

' Create a sphere, add a default material and texture projection

NewScene , false

set oSphere =  CreatePrim("Sphere", "MeshSurface")

ApplyShader , , , , siLetLocalMaterialsOverlap

CreateProjection oSphere, siTxtPlanarXY, siTxtDefaultSpherical, "Texture_Support", "Texture_Projection"

' Add a new layer with an image shader

Dim oLayer

set oLayer = AddPresetTextureLayer("Image", oSphere.material & ".Phong")

logmessage "Created Layer " & oLayer

' Add the diffuse port to the layer

AddTextureLayerPorts oLayer, oSphere.material & ".Phong.diffuse"

' Add a layer with a cell shader

set oLayer = AddPresetTextureLayer("Cell", oSphere.material & ".Phong")

logmessage "Created Layer " & oLayer

' Make the cell shader's effect more pronounced

SetValue oLayer & ".weight", 1

' Add the ambient port to the layer

AddTextureLayerPorts oLayer, oSphere.material & ".Phong.ambient"

'-------------------------

' Output of script:

'

'INFO : "Created Layer Sources.DefaultLib.Material.Phong.Image_Layer"

'INFO : "Created Layer Sources.DefaultLib.Material.Phong.Cell_Layer"

'

' If you open the texture layer editor, you will find there are two layers, an Image layer

' affecting the diffuse component and a Cell shader affecting the ambient component.

' Rendering the sphere will give the sphere with an image, with a cell pattern on top.

'-------------------------

関連項目

AddTextureLayer RemoveTextureLayers MoveTextureLayers AddTextureLayerPorts AddImageTextureLayer AddClipTextureLayer BlendInTextureLayers Shader.CreateTextureLayer Shader.AddSharedTextureLayer Material.CreateTextureLayer Material.AddSharedTextureLayer