v7.0
shader
シェーダ コンパウンドを書き出します。 シェーダ コンパウンドは、これを定義する XML
ベースの形式(.xsirtcompound:Softimage Render Tree
Compound)でディスクに保存された場合、作成元のシーン外でしか使用できません。
デフォルトでは、シェーダ
コンパウンドはテキスト形式で保存され、ネストされたシェーダをファイルに直接埋め込んで保存することはなく、これらのシェーダを参照します。
ただし、ネストされたシェーダ自体が書き出されていない場合や、そのファイルが見つからない場合は、.xsirtcompound
ファイルに埋め込まれます。
シェーダ コンパウンドを一度書き出すと、任意のシーンで読み込んで参照したり、配布したりできます。
コンパウンドをエンコードされた形式に保存して保護する場合は、Private 引数に True
を渡してデフォルトの動作を変更できます。
oReturn = ExportShaderCompound( [Compound], FullPath, ForceEmbedded ); |
なし
| パラメータ | タイプ | 詳細 |
|---|---|---|
| Compound | 文字列 | 書き出すコンパウンド。
デフォルト値: 現在選択されている値 |
| FullPath | 文字列 | コンパウンドを保存するディスク上の場所。 |
| ForceEmbedded | ブール | True の場合、ネストされたシェーダ コンパウンドが書き出された同じ.xsirtcompound
ファイルに強制的に埋め込まれます。通常の場合と異なり、参照されることはありません。 注: ネストされたシェーダがまだ書き出されていない場合(つまり、ディスク上に.xsirtcompound ファイルがない場合)は、この設定に関わらず埋め込まれます。 デフォルト値: False |
/*
This example demonstrates how to set up and export a shader compound containing another nested
shader compound, where the nested shader compound can be either embedded or referenced.
*/
// For readability, we are always saving to the user's RTCompounds directory
var path = XSIUtils.BuildPath(
Application.InstallationPath(siUserPath),
"Data", "RTCompounds"
);
// Convenience function to create and export a shader compound (innerSC.xsirtcompound)
// that we will reference/nest in the outerSC*.xsirtcompound shader compounds.
function CreateInnerCompound()
{
NewScene( null, false );
CreatePrim( "Torus", "MeshSurface" );
CreateShaderFromPreset( "Shaders\\Texture\\Gradient.Preset",
"Sources.Materials.DefaultLib.Scene_Material" );
CreateShaderFromPreset( "Shaders\\Texture\\Grid.Preset",
"Sources.Materials.DefaultLib.Scene_Material" );
SIConnectShaderToCnxPoint( "Sources.Materials.DefaultLib.Scene_Material.Grid",
"Sources.Materials.DefaultLib.Scene_Material.Phong.ambient", false );
SIConnectShaderToCnxPoint( "Sources.Materials.DefaultLib.Scene_Material.Gradient",
"Sources.Materials.DefaultLib.Scene_Material.Grid.line_color", false );
CreateShaderCompound( "Sources.Materials.DefaultLib.Scene_Material.Gradient,"
+ "Sources.Materials.DefaultLib.Scene_Material.Grid" );
ExportShaderCompound( "Sources.Materials.DefaultLib.Scene_Material.ShaderCompound",
path+"\\innerSC.xsirtcompound" );
}
// Convenience function to create and export two shader compounds (outerSCembedd*.xsirtcompound)
// and outerSCreffed.xsirtcompound), both of which contain the nested shader compound created
// with the CreateInnerCompound() function. This function can be called to export the shader
// compound with either a referenced (default) nested shader, or an embedded nested shader.
function CreateOuterCompound( in_embed )
{
NewScene( null, false );
CreatePrim( "Torus", "MeshSurface" );
// This is where we reference and connect the exported shader compound already
// created in the CreateInnerCompound() function
ImportShaderCompound( "Sources.Materials.DefaultLib.Scene_Material",
path+"\\innerSC.xsirtcompound" );
SIConnectShaderToCnxPoint( "Sources.Materials.DefaultLib.Scene_Material.ShaderCompound.ambient",
"Sources.Materials.DefaultLib.Scene_Material.Phong.ambient", false );
CreateShaderFromPreset( "Shaders\\Texture\\Fractal.Preset",
"Sources.Materials.DefaultLib.Scene_Material" );
SIConnectShaderToCnxPoint( "Sources.Materials.DefaultLib.Scene_Material.Fractal",
"Sources.Materials.DefaultLib.Scene_Material.Phong.specular", false );
CreateShaderFromPreset( "Shaders\\Texture\\Ripple.Preset",
"Sources.Materials.DefaultLib.Scene_Material" );
SIConnectShaderToCnxPoint( "Sources.Materials.DefaultLib.Scene_Material.Ripple",
"Sources.Materials.DefaultLib.Scene_Material.Phong.diffuse", false );
CreateShaderCompound( "Sources.Materials.DefaultLib.Scene_Material.ShaderCompound,"
+ "Sources.Materials.DefaultLib.Scene_Material.Fractal,"
+ "Sources.Materials.DefaultLib.Scene_Material.Ripple" );
// Embedded or Referenced? This setting corresponds to the innerSC.xsirtcompound, which
// was imported and connected earlier in this function
if (in_embed) {
ExportShaderCompound( "Sources.Materials.DefaultLib.Scene_Material.ShaderCompound1",
path+"\\outerSCembedd.xsirtcompound", true );
} else {
ExportShaderCompound( "Sources.Materials.DefaultLib.Scene_Material.ShaderCompound1",
path+"\\outerSCreffed.xsirtcompound", false );
}
}
// Create a shader compound and save it disk
CreateInnerCompound();
// Create a shader compound which references the first one (innerSC.xsirtcompound)
// and then export two versions: one referenced (outerSCreffed.xsirtcompound) and
// the other embedded (outerSCembedd.xsirtcompound)
CreateOuterCompound();
CreateOuterCompound(true);
|
CreateShaderFromPreset CreateShadersFromMaterialPreset CreateShaderFromCLSID CreateShaderFromProgID CreateShaderCompound NestShaders UnnestShaders AddShaderCompoundPort RemoveShaderCompoundPort MoveShaderCompoundPort RenameShaderCompoundPort ImportShaderCompound ExplodeShaderCompound SetShaderCompoundPropertiesEx GetShaderCompoundProperties EditShaderCompoundPPGLogic