RemoveObjectsFromShader

Introduced

v1.0

Description

Removes lights or objects from shaders.

Scripting Syntax

RemoveObjectsFromShader( [InputObjs], [Target] );

Parameters

Parameter Type Description
InputObjs String List of objects to remove.

Default Value: Current selection. If there is no current selection, the user is prompted to pick the objects.

Target String List of shader properties (lights, difflights, or objs).

Default Value: Current selection

Examples

VBScript Example

'

' This example creates a spotlight with a realistic light emission 

' by adding a spotlight to the scene, applying a volume shader to the 

' default pass, and then connecting it to the spotlight. 

'

NewScene , false

' Get a pointer to the default pass

Set oDefPass = GetValue( "Passes.Default_Pass" )

' Here we are using a utility function that will set up the spotlights

' connected to the volume shader on the default pass. The function

' passes back the names for the spotlight and the connection point.

aSpotInfo = setUpSpots( "Spot1", oDefPass, false )

' The 2nd time around we don't need the info, so we won't use another

' array of returned values

setUpSpots "Spot2", oDefPass, true

' Render a single frame of the default pass just to see both spotlights

' after connecting them to the volume shader: you can see that both spots

' emit their own spotlight beam (from opposite sides)

RenderPasses oDefPass, 1, 1

' Now remove the first spot from the light list and render another frame

' to see the effect. 

RemoveObjectsFromShader aSpotInfo(0), aSpotInfo(1)

' Render a single frame of the default pass: you can see that since the

' first one was removed from the volume shader, it does not appear to 

' emit a spotlight beam

RenderPasses oDefPass, 1, 1

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

function setUpSpots( in_spot_name, in_pass, in_move_me )

	' Define these locally only

	Dim oSpotObj, oRetValue, oLightShader, sVolShader, sLightCnxPnt

	' Get a spot light

	GetPrimLight "Spot", in_spot_name, , , oSpotObj

	' This is just a cheat to make sure we translate only one of the spots

	If in_move_me Then

		Translate  oSpotObj, -7, 1, 0

	End If 

	' Apply a light shader and get an object pointer to it (the returned

	' value is an XSICollection containing the shader as its only member)

	Set oRetValue = SIApplyShader( "Fast_light_effects.Preset", oSpotObj )

	Set oLightShader = oRetValue(0)

	' Add a volume shader on the default pass and save its fullname

	sVolShader = SIApplyShaderToCnxPoint( "Fast_volume_effects.Preset", _

			in_pass & ".VolumeShaderStack", , false )

	sLightCnxPnt = sVolShader & ".Lights"

	' Now add the Spot to the Volume shader light list

	AddObjectsToShader oSpotObj, sLightCnxPnt

	' Return the array of names we will need later

	setUpSpots = Array( oSpotObj, sLightCnxPnt )

end function

See Also

AddObjectsToShader ApplyShader RemoveShaderFromCnxPoint RemoveAllShadersFromCnxPoint SIConnectShaderToCnxPoint