Instance/copy objects with nulls

Hey there,

when dealing with real commercial productions it is, at some point, necessary to place object instances by hand. There for you have four options in Softimage.

  1. A hard copy of the object
  2. A clone of the object
  3. Put it in a Model and use an model instance
  4. Use ICE to distribute instances in combination with Nulls that have an PPG with an integer attribute to detect the instance.

Point four is the workflow I like the most, because it is super flexible. After the placement it is possible to change all attributes e.g. with a random size or position. Now the question is, how do I adapt my known workflow to Houdini? Exact the same way I do it in SI. Fist we need to create a null object with an integer attribute “instNR” for instance number, some instances and a geometry that holds the geometry.

Lets dive into geometry level. First I have tried to build a setup the classical way. With maaaany attribute create sops. 

“Going from top to bottom you see that I create all attributes I need to transfer the data from the null objects: i@instNR, f@pscale, v@scale, v@euler_rot, 4f@orient. In the point vop I convert the euler rotation to a quaternion rotation. This is needed because the copy sop is using quaternions. With the path attribute of the object_merge sop we can access all attributes like this: ch(@objname + “/../instNR”). The only attribute we have to samp is the Instance Number. The syntax in the copy sop is like this: point(“../Input_GEO_OUT1”, $PT, “pinstNR”, 0). The switch node can now access this attribute like this: stamp(“../copy_InstancesToPoints”, “pinstNR”, 0). This is all we need to get it working.

Much slicker is to do all attribute manipulation in an attribute wrangle.

That’s all. Easy to setup and effective. The only thing to notice here is, that this is a copy NOT a instance workflow. To really instance objects I recommend this tutorial. https://vimeo.com/55292609 this workflows here can easily combined with this workflow. Here InstanceObjectsWithNulls you can download the example hip file.

Point in Volume (Feat VEX)

Hey!

In my last post I showed a simple “Point in Volume” VOP. Inspired from the Side FX VEX Webinar I ported this logic to VEX with an attribute wrangle.

float maxdist = ch("maxdist");
int maxpts = ch("maxpts");
@Cd = {0,0,0};

int closept[] = pcfind_radius(1, "P", "pscale", 1.0, @P, maxdist, maxpts);
i[]@closepoints = closept;

foreach( int pt; closept){
        vector pc_pos =  point(1, "P", pt);
        vector pc_normal = point(1, "N", pt);
        vector oCompo1 = pc_pos - @P;
        f@weight = dot(pc_normal, oCompo1);
}
if(@weight > 0){
    @Cd = 1;
}

Quite easy AND quite cool. Let’s explore VEX a little more  😉

Soft Contact Deformer

Hey!

In commercial work every artist had the case to place/ distribute/ scatter water droplets on to other objects. During the last days an artist came to me who had placed may spheres by hand and was annoyed of the shaping process after the placement.

So I made an easy usable setup in houdini, that enables the artist to do some basic contact shaping.

Here is my graph. First we need a Droplet Sphere and a Target object. The first needed step is a “Point in Volume” Point VOP. I do it in this way because a Group SOP is much much sower. So let’s dive in and this is what we’ll get.

As you see above, with the pcopen I do a closest location query and extract the closest P and N variable. Cool, with some math we get just 0 and 1 values. We’ll use this information later in the tree. With this done we can use an attribute promote to calculate the sum of point that are inside the target volume.

Then we use an attribute create to get the point percentage that is inside the volume. (This retuns values between 0-1)

In this VOP happens all the geometry manipulation. Stating at the right, we find a two way switch where we use the PointInVolume attribute to do either a shrink wrap or to do a simple push along the normals. As you go through the graph you will notice the detail import detail (percInVolume) that is a multiply for the push. With this method we make sure, that the normal push after a single point is in the target volume. I’m sure that it is possible to combine the two point vops, but I’ve still not found a way to do the attribute promotion on vop level. The rest is just an smoothing and subdiv sop. Nothing fancy.

Andreas

 

Convert Groups to Point Attributes

Hey – As a Houdini newbie, I’m still struggling a lot with groups and attributes. Today I wanted to do a circle of objects with the copy sop and give it a gradient color by polygon island. Good. Easy – I thought. BUT, the copy SOP creates just groups of objects. Now my question was, how to convert a bundle of object in an fresh point attribute from 0-1. My Approach was to convert the groups with the assemble SOP to a primitive attribute. After this I used an attribute promote to convert the primitive attribute to a point attribute. In the final step I created a fresh attribute and did a fit function to have a nice range from zero to one. fit(@island_index,0,ch(“../copy_copy360Deg/ncy”),0,1). Accordingly I was able the use this attribute in the color sop. the result, was the picture below.

To me it feels like a to involved process – I’m sure that the same process is also doable in one node e.g. in an attribute wrangle.