Controlling with attractors (modeling challenge)

   18240   31   0
User Avatar
Member
52 posts
Joined: March 2008
Offline
Can you please suggest how I can go about the following rough sketch of a task (I can do this outside of Houdini but am trying to understand how one might go about it here, so alternative routes are also of interest):


1. Generate a random distribution of points in a volume, assemble into a point cloud

2. Position 3 points in space to serve as attractors (BA, GA and RA)

3. Assign a color (or some attribute) to the points in the point cloud based on the proximity to the attractors, with gradual falloff

4. Create three different types of objects (BL, GL, RL)

5. Copy the objects to the points, matching the colors

6. Create another point F to serve as focus

7. Orient objects to look at F


Thank you very much

Attachments:
distribtion-sketch-01.gif (18.1 KB)

User Avatar
Member
519 posts
Joined:
Offline
Hi Anna,

you can try to do something like this:

1
  • Use whatever you want to generate a the volume, just a simple box, metaballs or an imported file. Use the pointsfromvolume sop to generate random points inside the geometry.
    2I created three primitive spheres to use as attractors (primitive type should be primitive) and colored them.
    3Add a series of attributes to calculate the distance. First start of with a 3 float attribute to calculate the distance of each point to each of the attractors(attribcreate_pointdistance). Then use an attributepromote to get the maximum value of each of these distances (promote to a detail attribute). Then you can normalize each of the distances by dividing the distance by the maximum distance and use these fro RGB values (color_volumepoints).
    4Add whatever you want
    5Use a copy sop with a stamp function to copy your geometry on the points. The trick here is to remap the RGB values to a value of 0-2 which you use in the switch sop with the stamp function. Have a look at Dave Koesters VOP scatter tutorial to get an idea how you can do that. The expression is in the attribute_H sop (the H is from HSV)
    6 and 7I used an add sop to create the focus point. After creating the points in the volume you can add a point SOP to create normals; use an expression for the normals (just subtract the position of the point in the volume from the focus point position). The copy sop will orientate the geometry from 4.

    Cheers,
    Hans

Attachments:
preview.png (477.1 KB)
network.png (46.6 KB)

User Avatar
Member
52 posts
Joined: March 2008
Offline
Thank you, very helpful. I shall try and build it. Shall report back.

Did you decide not to post the HIP file for pedagogical reasons?
User Avatar
Member
519 posts
Joined:
Offline
Yup i did

If you have trouble with it i can give you some more leads. I think the trickiest part is getting the right values for the switch sop but as i said, the vop scatter tutorials has some great pointers at how you can solve that. This setup also uses that atttributepromote SOP. So to answer your question from the other thread…when you have a detail attribute on your geometry you can uses it with the detail expression:

detail(“../pathtosop”, “attrname”, index)

Cheers,
Hans
User Avatar
Member
52 posts
Joined: March 2008
Offline
I started building it. The thing is I am not familiar with the Houdini nodes and the manner in which they communicate…

So… If I may…

What are color_point… nodes in your graph?

Why do you need null_basevolume?

And - yes - the question about promoting the attributes is still there… I am yet to get to them.
User Avatar
Member
2624 posts
Joined: Aug. 2006
Offline
Off the top of my head

Attractors : - Point colour_nodes . 3 attractors created , each point will want a Cd value. Points that are within a certain distance to attractor inherit Cd. You can then clearly tell what attactor is having influence on a set of points.

Null :- ofen used as a container to hold values that can be read from elsewhere in Houdini. ie the functions

npoints
nprims

and - yes - the question about promoting the attributes is still there… I am yet to get to them.

Watch the videos on expressions from this sites tutorial section the promotion of attributes is clearly explained. Also if you use the details and view and create your own attributes you can experiment and clearly show the effect of changing values.

rob
Gone fishing
User Avatar
Member
519 posts
Joined:
Offline
The color_point node is a renamed point sop. You can rename your nodes so that you, or somebody else, can figure out, to a certain extend, what they do. So this point sop adds the color attribute.

The null_basevolume is just a left over, it is not neccesarry in the current setup. But the null node is very handy as a “placeholder”. When you have scripts you can reference a null node and change the network above without having to worry that your script might break. I also use them because i am terribly lazy: it is easier to type PCOL in an expression than color_point or whatever name sops normally have.

When you are at the attribpromote SOP and you still haven't figured out what to do, post your hip file and i'll take a look.
User Avatar
Member
52 posts
Joined: March 2008
Offline
Thanks both. Much clearer. Have watched the VOP Color Scatter tutorial and shall now move to the one on expressions as recommended. I am moving along.

The thing that I find hard about Houdini at my ignorance level is how things are hidden within things. Instead of - I do not know - Analyse Values node, we have AttribPromote node, with its analytic capability unmanifested to the uninitiated. Or we have 4 identical-looking inputs to a VOP SOP (as discussed in that other thread) but one works differently to the other 3. Etc.

Well, I hope I shall see the light sooner rather than later.

On practicalities:

In your chart, how are:

a. The color_point… nodes relate to the spheres created earlier in the chain?

b. What is point_lookat node and how does that one connect to the Focus group (if it does)?

Thank you for the patience.
User Avatar
Member
2624 posts
Joined: Aug. 2006
Offline
Anna your heading on the right path …

When using VOPs use the attribute create vop , to read values at various points in the VOP network. The values are shown in the details view, but you must pin the details view at the sop level.



rob
Gone fishing
User Avatar
Member
519 posts
Joined:
Offline
In the lookat node there is an expression to create the normals. It is also a point SOP like the color node. Since there is nothing but points in the scene atm it is very easy to create a vector (the normal in this case) by subtracting the two point positions:

point(“../FOCUS, 0, ”P", 0)-$TX

which means, get the x-value of point number 0 on the FOCUS node and subtract the x-value of the current point (the points part of the lookat sop).

In the color_point node pretty much the same thing happens except for the color attributes.

I'll post the first part of the network later tonight. In the meantime try to figure out how the attribpromote sop works.




*edit* Rob…you changed Australia for NY?
User Avatar
Member
2624 posts
Joined: Aug. 2006
Offline
*edit* Rob…you changed Australia for NY?

Indeed, its been a while since Ive been around in Houdini land. Left working in Aus for a job in NY. You coming over ?.

Rob
Gone fishing
User Avatar
Member
519 posts
Joined:
Offline
When?
User Avatar
Member
519 posts
Joined:
Offline
Anna,

first part of the setup…

Attachments:
pc_color_001.hip (241.8 KB)

User Avatar
Member
52 posts
Joined: March 2008
Offline
Super. As I am working on this, can one write


point(“../FOCUS, 0, ”P", 0)-$TX

in the same place in Python and if so, how would that look like?
User Avatar
Member
1908 posts
Joined: Nov. 2006
Online
You can write it in Python by doing something like this:
# For the X coordinate.
px = pwd().node(“../FOCUS”).geometry().iterPoints().position()
return px - pwd().curPoint().position()

However I think there are still some problems with hou.SopNode.curPoint() in H11. I'd probably do this in a Python SOP since that will work more reliably and be a bit faster.

Personally though I'd just do this in a VOP SOP. Same for calculating distances from the points to the attractors. Never did like dealing with vectors in hscript expressions.
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
52 posts
Joined: March 2008
Offline
Thanks for the Python version and for the warning about potential problems, looks more verbose too. I was interested because the docs on point expression already say it is being fazed out and recommend Python.

I have built the orientation part with expressions and with a VOP SOP. Had to lock the “orient to” point with a constant, otherwise the missing points we padded with zeros.

Not sure why the link to the VOP SOP is dashed - is it OK or something to worry about? I thought it meant to show improper type casting…

Also, do I need to output both Point Positions and Point Normals from my VOP SOP? Not always sure about he default behaviors.

Thanks once more.

Attachments:
progress-01.gif (46.9 KB)

User Avatar
Member
1908 posts
Joined: Nov. 2006
Online
It's not so much that it's being replaced by Python, but that certain python methods are roughly the equivalent to that. Hscript expressions definitely aren't going anywhere.

Dashed lines in SOPs only apply to connections that are connected to inputs that aren't the first input. Basically it just means this isn't plugged into the primary connection and isn't being directly output. In VOPs the dashed lines do indicate a type conversion.

Unless you are modifying/creating an attribute you don't need to output it. In this case you are modifying the normals so they should be connected to the output but since nothing is happening to change the positions you don't need to connect that output.
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
52 posts
Joined: March 2008
Offline
Thanks.

As for the roles of different languages, here is what point expression help page says:

“The old expression language is still available in Houdini for compatibility with older files and scripts. For new animations, we recommend you use the new HOM scripting architecture instead.”

Sounds quite unequivocal… Perhaps stronger than intended.
User Avatar
Member
52 posts
Joined: March 2008
Offline
My next question is again about color_point… nodes in Pagefan's setup.

I see that they add color to groups but do not see where the groups are defined and named. The merge node Help recommends using a Group node before which is missing. Rearranging Transform inputs within Merge changes colors. So, does the Merge node group by input and it is a reliable grouping to use elsewhere?

Thanks.
User Avatar
Member
1908 posts
Joined: Nov. 2006
Online
Since they are Point SOPs, as well as named groups, the Group parameter also accepts point numbers, ranges of point numbers, etc.

They change when you reorder the group inputs because the point order is changing and they are applying colors based on the point number. The first color_point node colors the first point, the second node colors the second point, etc. An alternative would be to have the Point SOPs after the transform and before the merge and remove the point numbers from the group fields all together since the operator will only be applying to a single point.
Graham Thompson, Technical Artist @ Rockstar Games
  • Quick Links