/*
This example demonstrates how to create an object
with a texture shader
*/
NewScene("", false);
var root = Application.ActiveProject.ActiveScene.Root;
var object = root.AddGeometry( "Cube", "MeshSurface" );
BlendInPresets( "Image", object, 1, false );
CreateProjection( object, siTxtSpherical, siTxtDefaultSpherical, "TxtSupport", "TxtProjection" );
var filename = XSIUtils.BuildPath(
Application.InstallationPath(siFactoryPath),
"Data", "XSI_SAMPLES", "Pictures", "xsilogo.jpg"
);
var imageclip = CreateImageClip( filename, "XSILogo" );
// Find the texture shader using the built-in Softimage shader filter
var colShaders = object.Material.FindShaders(siShaderFilter);
var textureshader = colShaders("Image");
// Set up a texture projection and image clip for the texture shader
SetInstanceDataValue(null, textureshader+".tspace_id", "TxtProjection");
textureshader.Parameters("tex").Connect(imageclip); |