## SetReference2

### Introduced

v9.0 (2011)

### Description

Sets reference parameter value for a shader parameter.

### Scripting Syntax

    SetReference2( Target, Value, [Time] );

### Parameters

Parameter | Type | Description
--- | --- | ---
Target | String | The parameter to set.
Value | String | The parameter representing the reference value.
Time | Integer | Frame at which to set the values. Default Value: Current frame.

### Examples

#### VBScript Example

    '
    ' This example demonstrates how to set a start and end point for a
    ' lightning bolt effect using the SetReference2 command
    '
    NewScene , False
    ' Create a sphere for the lightning volume shader -- make it transparent
    CreatePrim "Sphere", "MeshSurface"
    Scale , 1.78336557059961, 1.78336557059961, 1.78336557059961, siRelative, siGlobal, siObj, siXYZ, , , , , , , , 0
    ApplyShader , , , , siLetLocalMaterialsOverlap
    SetValue "sphere.Material.Phong.transparency.green", 1
    SetValue "sphere.Material.Phong.transparency.blue", 1
    SetValue "sphere.Material.Phong.transparency.red", 1
    ' Create two nulls to act as endpoints for the lightning bolt
    GetPrim "Null", "StartNull"
    Translate , -4, 2.98511157062997, -0.298511157062997, siAbsolute, siView, siObj, siXYZ, True, , , , , , , , , 0
    GetPrim "Null", "EndNull"
    Translate , 2, 3.98014876083996, -0.398014876083996, siAbsolute, siView, siObj, siXYZ, True, , , , , , , , , 0
    ' Apply the lightning shader
    SelectObj "sphere", , True
    SIApplyShaderToCnxPoint "Volume\Volume_lightning.Preset", "Sources.Materials.DefaultLib.Material.volume"
    ' Set the start and endpoints of the lightning bolt
    SIAddArrayElement "Sources.Materials.DefaultLib.Material.Volume_lightning.startpoint"
    SetReference2 "Sources.Materials.DefaultLib.Material.Volume_lightning.startpoint.Item", "StartNull"
    SIAddArrayElement "Sources.Materials.DefaultLib.Material.Volume_lightning.endpoint"
    SetReference2 "Sources.Materials.DefaultLib.Material.Volume_lightning.endpoint.Item", "EndNull"
    ' Draw a render region to see the lightning bolt

### See Also

SetReference