Simple example of a parametric point cloud


Here’s a simple parametric point cloud that shows the two techniques for using arrays instead of Repeats that I blogged about earlier:

Using arrays to avoid Repeat part I
Using arrays to avoid Repeat part II

I used this set of parametric equations to get a cylinder point cloud:

x = sin(u)
y = cos(u)
z = v

where

0 <= u <= 2*PI
-2 <= v <= 2

For this exercise, I simply used Build Interpolated Array to build arrays of U and V values, but I probably should use something like the XYZ_Grid_Generator technique described by Daniel Brassard on si-community.

Here’s a version of the ICE tree with some Show Values.

I use the Modulo technique to build an array of the XY values for all points in the cloud.

Then I use the Divide by Scalar technique (the integer result is truncated) to build an array of the Z values.

Finally, I add XY vectors to the Z vectors to get the final point positions.

Using the Schematic view to understand ICE scene setups


The Schematic view can show you the ICE scene references that “connect” different objects in a scene.

In this example:

  • ICETree on pointcloud has a scene reference to grid
  • Transform_From_Array on null has a scene reference to xform_container_pointcloud.
  • Get_Particles_Transform on xform_container_pointcloud has a scene reference to pointcloud.

Here’s a slightly more complicated schematic, for the Modeling_Basic_Shattering sample scene:

Moving the timeline pointer back to frame 1 with xsibatch


UPDATE: In the comments, Vladimir suggests a better way to do this: use the scntoc. That way, the scene will always open at frame 1.
Use a text editor to add Application.SetValue(“PlayControl.Current”, 1) to the onload script. This script will run when you open the scene, and move the timeline pointer back to frame 1 to avoid the re-simulation.

   <PostLoadScript>
      <Language>Python</Language>
      <Function>postLoad</Function>
      <Script_Content>
	<![CDATA[
Application.SetValue("PlayControl.Current", 1)
	]]></Script_Content>
   </PostLoadScript>

After you save the scene, Softimage will write out the scntoc without the CDATA section (Softimage will replace special characters like < and ” with entities).

   <PostLoadScript>
      <Language>Python</Language>
      <Function></Function>
      <Script_Content>
	
Application.SetValue(&quot;PlayControl.Current&quot;, 1)</Script_Content>
   </PostLoadScript>


So you have a heavy simulation, and you saved the scene with the timeline pointer at frame 1000. Now when you open the scene, you have to sit and wait while the scene re-simulates.

You can fix this by using xsibatch to move the timeline pointer back to frame 1.

It’s probably a good idea to save heavy sim scenes with the timeline pointer at frame 1 😉

  • Save this JScript in a .js file.
    var sScene = "C:\\Users\\blairs\\Support\\Scenes\\Test.scn"
    OpenScene(sScene, null, null);
    SetValue("PlayControl.Current", 1, null);
    SaveScene();
    
  • In a command prompt, use xsibatch -processing -script to run the script:
    xsibatch -processing -script C:\Users\blairs\Documents\resetPlayControlCurrent.js
    

Now you can open your scene without it resimulating.

Tip for using Show Values with the Filter node


Use the SKip Default Values During Display or Show Values Computed at Current Frame options when you do a Show Values on the output of a Filter node.

With the default Show Values settings, you’ll see default values for the elements that didn’t pass the filter condition:

If you enable SKip Default Values During Display or Show Values Computed at Current Frame , then you see values for the filtered elements only:

Making circles on the surface of a mesh


Taking a cluster of points and moving them on to a circle turned it to be easier than I thought… At first it seemed more complicated to get at the points, because sometimes the Show Values on the output of a Filter node is, let’s face it, misleading. Based on what a certain Show Values showed me, I started off using arrays instead of Filters, and that made the graph a little messier.

First, I calculate the point I want to use as the center of the circle. That gives me the first vector I need.

Subtracting the CC (circle center) vector from the PP (Point Position) vectors gives me a set of vectors that take me from the circle center to the points.

I just resize the PP-CC vectors to get point positions that fit on a circle:

Creating ICE Trees after you create a cluster


In brief: don’t click Create ICE Tree immediately after you create a cluster that you want to use in your ICE tree, because the ICE tree will be created on the cluster. And the ICE tree will be in the wrong place in the operator stack.

Check this out: in the ICE Tree view expolorer, I have two ICETree operators with the same name.

So, how did this happen? Like this:

  • Create a polygon cluster.
  • In the ICE Tree view, click Create ICE Tree (this creates an ICETree on the cluster, not on the mesh).
  • Select the mesh object.
  • In the ICE Tree view, click Create ICE Tree (this ICETree is on the mesh).

This can lead to problems when you use the cluster in the ICE tree. For example, if you use IsElement, it will return False for everything, and NbElements will return 0.

To understand why, take a look at the dump of the connection stack.

Line 6 is the ICETree on the cluster. That ICETree is below the ops that create the cluster, so you cannot use IsElement in that ICETree.

# sphere1.polymsh.modelingmarker
# sphere1.polymsh.ICETree (out)
# sphere1.polymsh.ICETree (in)
# sphere1.polymsh.cls.poly.clslist.Polygon.AddToClsOp (out)
# sphere1.polymsh.cls.poly.default_Polygon.SetClsOp (out)
# sphere1.polymsh.ICETree (in)
# Unnamed Operator (out)
# sphere1.polymsh.geom (in)

Using vector subtraction to move a point onto a circle


Circles, spheres, and radii…

For a couple of reasons, I was playing around a bit with spherifying/circulizing this weekend:

Based on this basic idea: “every point on a sphere/circle is the same distance from the center”, I was able to rough-out a couple of ICE trees:


Creating a circle on the surface of a mesh required just a little bit of 3d vector math. Here’s a little video that goes over using vector subtraction to move a point onto a circle. I spent more time setting up the “Show Values” in my demo then I did recording the thing.

http://vimeo.com/36286395