## CreateShaderCompound

### Introduced

v7.0

### Description

Creates a shader compound.

### Scripting Syntax

    oReturn = CreateShaderCompound( InputObj, [Name] );

### Return Value

The new shader compound node as a Shader or Texture object.

### Parameters

Parameter | Type | Description
--- | --- | ---
InputObj | String | Shaders to be compounded. Default Value: If not specified, the user is prompted to make a selection.
Name | String | Name of the new shader compound. Default Value: ""

### Examples

#### 1. JScript Example

    /*
            This example demonstrates how to use the CreateShaderCompound command.
    */
    NewScene(null, false);
    CreatePrim("Sphere", "MeshSurface", null, null);
    // Create an Image Shader using its ProgID and nest it under the material
    CreateShaderFromProgID( "Softimage.txt2d-image-explicit.1",
            "Sources.Materials.DefaultLib.Scene_Material", "Image");
    SIConnectShaderToCnxPoint("Sources.Materials.DefaultLib.Scene_Material.Image",
            "Sources.Materials.DefaultLib.Scene_Material.Phong.diffuse", false);
    // Create a shader compound containing the Phong Shader and automatically
    // exposing the Diffuse Port because there is a connection on it.
    CreateShaderCompound("Sources.Materials.DefaultLib.Scene_Material.Phong", "MyCompound");
    // Create a Fractal Shader using its ProgID and nest it under the shader compound.
    CreateShaderFromProgID( "Softimage.txt3d-fractal_v3.1",
            "Sources.Materials.DefaultLib.Scene_Material.MyCompound", "Fractal");
    SIConnectShaderToCnxPoint("Sources.Materials.DefaultLib.Scene_Material.MyCompound.Fractal",
            "Sources.Materials.DefaultLib.Scene_Material.MyCompound.Phong.specular", false);

#### 2. VBScript Example

    '
    ' This example demonstrates how to build a very simple shader compound.
    '
    NewScene , false
    CreatePrim "Torus", "MeshSurface"
    ' Connect a Texture Grid shader to the Phong's Ambient property
    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
    ' Connect a Gradient shader to the Texture Grid's Line Color property
    CreateShaderFromPreset "Shaders\Texture\Gradient.Preset",  _
            "Sources.Materials.DefaultLib.Scene_Material"
    SIConnectShaderToCnxPoint "Sources.Materials.DefaultLib.Scene_Material.Gradient", _
            "Sources.Materials.DefaultLib.Scene_Material.Grid.line_color", False
    ' Create a shader compound out of the Gradient and Grid shaders and expose some input ports
    ' (the output port was automatically created since the Grid was connected to the Phong
    CreateShaderCompound "Sources.Materials.DefaultLib.Scene_Material.Gradient," _
            + "Sources.Materials.DefaultLib.Scene_Material.Grid"
    AddShaderCompoundPort "Sources.Materials.DefaultLib.Scene_Material.ShaderCompound.Gradient.range_min", _
            "Sources.Materials.DefaultLib.Scene_Material.ShaderCompound"
    AddShaderCompoundPort "Sources.Materials.DefaultLib.Scene_Material.ShaderCompound.Gradient.range_max", _
            "Sources.Materials.DefaultLib.Scene_Material.ShaderCompound"

### See Also

CreateShaderFromPreset CreateShadersFromMaterialPreset CreateShaderFromCLSID CreateShaderFromProgID NestShaders UnnestShaders AddShaderCompoundPort RemoveShaderCompoundPort MoveShaderCompoundPort RenameShaderCompoundPort ExportShaderCompound ImportShaderCompound ExplodeShaderCompound SetShaderCompoundPropertiesEx GetShaderCompoundProperties EditShaderCompoundPPGLogic ShaderContainer.CreateCompound