Sunday, September 23, 2012

Dan Lane has kindly provided a script for me that creates 4x4 matrix node(s) based on the global kinematics of multiple objects selected (as well as the ICE tree to paste the nodes in).

The code also demonstrates how to add comments to the nodes.

(Thanks Dan!)

[code]
var iceTreeArray = new Array();
var objectArray = new Array();



// Loop through selection and check their type store them in arrays
for ( var i = 0 ; i < selection.count ; i++)
{

var objType = selection.item(i).type

if ( objType == "ICETree")
{
// it's an ice tree store it in the iceTree Array
iceTreeArray[iceTreeArray.length] = selection.item(i);

}else{

// it's an object store it in the object Array
objectArray[objectArray.length] = selection.item(i);

}// end else

}// end i loop



// check if we have ice trees and objects
if(objectArray.length != 0 && iceTreeArray.length != 0 )
{

// loop through the ice tree array
for ( var i = 0 ; i < iceTreeArray.length ; i++)
{
// get an ice tree from the array to work with
var currentIceTree = iceTreeArray[i];

// loop through the obj
for (var j = 0 ; j < objectArray.length; j++ )
{

var currentObject = objectArray[j];

var IceMatrixNode = AddICENode("$XSI_DSPRESETS\\ICENodes\\4x4MatrixNode.Preset" , currentIceTree.fullname );

// name the matrix node so we know which object it relates to.
CreateICENodeComment(IceMatrixNode.fullname);
SetValue( IceMatrixNode.fullname + ".ICETreeComment.Text", currentObject.fullname , null);

// collect the objects transform
var obj_Trans = currentObject.Kinematics.Global.GetTransform2(0);

// convert transform to 4x4 matrix
var GlobalMatrix = XSIMath.CreateMatrix4();
obj_Trans.GetMatrix4( GlobalMatrix );


// loop through object matrix rows and colums and insert values into ice node
for ( var row = 0 ; row < 4 ; row++ )
{

for( var col = 0 ; col < 4 ; col++ )
{
var the = GlobalMatrix.Value( row, col );
SetValue(IceMatrixNode.fullname + ".value_" + row + col , the , null);
}// end colume loop

}// end row loop
}// end j loop
}// end i loop

}// end if

[/code]

Monday, August 27, 2012

ICE: Scaling Particles From Bottom

A user on XsiBase was asking how to scale box particles from the base of the particle rather than from the center.

The easiest solution, if all particles are oriented upward, would be to add 1/2 of the yScale to the y position of the particles.  The problem arises when the particles are oriented out to the side.  Rather than just moving the particles upward, we need to move them along the direction they are pointing in.  This is easily accomplished by multiplying 1/2 of the yScale's 3d-vector (0,yScale/2, 0) by the rotational 3x3 matrix of the particle, and adding that to the particle's position.

Tuesday, August 7, 2012

Asteroid Test

Softimage ICE Asteroid test.  I encountered a problem when I tried to rotate the center null, but I thought it looked kinda cool so I did a quick render.  I think the way to fix this is to create null and disc at world origin, and then multiply the particle's 4x4 matrix by the null's 4x4 matrix to allow you to reposition and rotate the asteroid field.





Wednesday, July 25, 2012

Wool test

A user on XSI Base was looking for a way to create wool.  Here's my test based off of ICE's Create/Dynamic Strands.  I didn't think it looked that great, but figured I'd post it anyways in case somebody had an idea how to improve it.  First picture includes a polygonized mesh of the strands (length of strands was modified for this version to create difference)





Friday, July 6, 2012

Here's an ICE 2 Bone IK chain with UV support that I've been working on for a while.  I think I've got it stable now (no weird flipping).  If you've got ideas to maybe optimize or expand this, I'd love to hear it.

Hopefully you can follow my screenshot for setting this up.  First I create 4 nulls and 2 implicit bones.  2 of the nulls are the root and effector controllers, 1 of the nulls is the Up Vector controller, and 1 of the nulls is for the ICE rig.  I had problems with reference names, that's why you see the same name in the screenshot.  Make sure to update both names with your own names.  To calculate the bone lengths, I first create a temp 2 bone chain (Animate/Create/Skeleton/Draw 2D Chain) and get the lengths from that.  Occasionally ICE fails to update the bone lengths of the implicit bones.  To set the correct length, temporarily Show Values between Get Rig.L_Thigh_Length and self.length.  Seems to fix it for me.

Let me know what you think!


Download ICE compound:  http://www.si-community.com/community/viewtopic.php?f=15&t=2515

Tuesday, June 5, 2012

Offset Camera Position/Rotation By Object

A user on XSIBase was wanting to point the camera at an object, but offset its position when it gets too close.  Not the best ICE Tree, but it sort of works...

Friday, April 13, 2012

"Hiding" Particles Based on Texture Map


After creating a texture map on my grid, I read the Texture Map color's brightness and tested if it was Less Than or Equal to .5.  If it was, I "hid" the particles by scaling them to 0,0,0. 

I couldn't figure out how to delete the points; if you could, I'm not sure it would work correctly with an animated texture.

Also note, I scaled the texture projection down slightly to avoid incorrect values around the edge of the image.

Hopefully this helps.

Sunday, March 25, 2012

Emitting Particles At Fixed Intervals

Emitting particles at fixed intervals is primarily achieved by using the Modulo node.  By Modulo-ing our Current Time by a value of 48, we generate a looping set of numbers 0, 1....47, 48, 0, 1...47, 48, etc.

In order to emit our particles for only 3 frames, we can test the result from Modulo, and see If it is Less Than or Equal to 3.  If it is we emit 1000 particles (per second), if not 0.